Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL8720DN not working with MPU6050 0.6.0 arduino library #131

Closed
rkuo2000 opened this issue Oct 6, 2022 · 5 comments
Closed

RTL8720DN not working with MPU6050 0.6.0 arduino library #131

rkuo2000 opened this issue Oct 6, 2022 · 5 comments

Comments

@rkuo2000
Copy link

rkuo2000 commented Oct 6, 2022

MPU6050 & MPU9250 are very popular IMUs (3-axis accelerator, 3-axis gyroscope, 3-axis compass)
The Arduino MPU6050 library works well with ESP32, but hang if using RTL8720DN.

https://github.com/ElectronicCats/mpu6050

Could you tell why this I2Cdev.cpp are not compatible with RTL8720DN ? and find a fix to make RTL8720DN working with MPU6050 / MPU9250.

@rkuo2000 rkuo2000 changed the title RTL8720DN did not work with Arduino MPU6050 library RTL8720DN not working with Arduino MPU6050 library Oct 6, 2022
@xidameng
Copy link
Contributor

xidameng commented Oct 18, 2022

Hi @rkuo2000

Thanks for reaching out to us. May I ask if you can elaborate on how it "hang if using RTL8720DN"?

Because, after fixing a small compilation issue (this will be fixed soon), the library you mentioned works well with RTL8720DN, no sign of hanging. Just FYI, I have tried both MPU6050_raw and IMU_Zera examples, both works fine.

If you don't mind, you can also try Adafruit_MPU6050 library which also works well with RTL8720DN.

xidameng added a commit to xidameng/ambd_arduino that referenced this issue Oct 18, 2022
…ty libs

- Fix compilation error with issue (Ameba-AIoT#131)
- Update Arduino.h to include dtostrf and itoa libraries

Verification:
- Tested against WiFiSSLClient and Blink example and passed
xidameng added a commit to xidameng/ambd_arduino that referenced this issue Oct 18, 2022
…ty libs

- Fix compilation error with issue (Ameba-AIoT#131)
- Update Arduino.h to include dtostrf and itoa libraries

Verification:
- Tested against WiFiSSLClient and Blink example and passed
M-ichae-l pushed a commit that referenced this issue Oct 18, 2022
)

- Fix compilation error with issue (#131)
- Update Arduino.h to include dtostrf and itoa libraries

Verification:
- Tested against WiFiSSLClient and Blink example and passed
@rkuo2000
Copy link
Author

rkuo2000 commented Oct 18, 2022 via email

@rkuo2000 rkuo2000 changed the title RTL8720DN not working with Arduino MPU6050 library RTL8720DN not working with MPU6050 0.6.0 arduino library Oct 18, 2022
@xidameng
Copy link
Contributor

xidameng commented Oct 20, 2022

Hi @rkuo2000

Symptom1: digitalPinToInterrupt(INTERRUPT_PIN) error
digitalPinToInterrupt is indeed NOT supported on Ameba D as of now, but adding it is very simple so it would be added in the upcoming release

Symptom 2. printfloatX error because missing dtostrf
This is already fixed in the PR above, please expect this fix in the next release

Sympton 3. successfully upload to RTL8720DN, but hang after mpu6050 initialization
There are a few changes needed to make, but after that, the example works on my side, check my log below

#calibration_ok:[2:19:11]
15:02:44.204 -> Initializing I2C devices...
15:02:44.204 -> Testing device connections...
15:02:44.204 -> MPU6050 connection successful
15:02:44.204 ->
15:02:44.204 -> Send any character to begin DMP programming and demo:
15:02:51.761 -> Initializing DMP...
15:02:52.372 -> >......>......
15:02:54.384 -> // X Accel Y Accel Z Accel X Gyro Y Gyro Z Gyro
15:02:54.384 -> //OFFSETS -6270, 483, 1638, 150, 70, 11
15:02:54.384 -> Enabling DMP...
15:02:54.384 -> Enabling interrupt detection (Arduino external interrupt 2)...
15:02:54.433 -> DMP ready! Waiting for first interrupt...
15:02:54.433 -> ypr 0.01 -0.01 0.44
15:02:54.433 -> ypr 0.01 -0.01 0.44
15:02:54.433 -> ypr 0.01 -0.01 0.43
15:02:54.480 -> ypr 0.01 -0.01 0.43

PS: I didn't use your code, as it's heavily modified. The code I used is this one
https://github.com/ElectronicCats/mpu6050/blob/master/examples/MPU6050_DMP6/MPU6050_DMP6.ino

Look out to my PR for all the changes and bug fixes

xidameng added a commit to xidameng/ambd_arduino that referenced this issue Oct 21, 2022
…mpatibility

- Fix compilation error with issue (Ameba-AIoT#131)
- Update variant.h in all boards to add a missing macro

Verification:
- Tested against WiFiSSLClient and Blink example and passed
xidameng added a commit to xidameng/ambd_arduino that referenced this issue Oct 21, 2022
…mpatibility

- Fix compilation error with issue (Ameba-AIoT#131)
- Update variant.h in all boards to add a missing macro

Verification:
- Tested against WiFiSSLClient and Blink example and passed
M-ichae-l pushed a commit that referenced this issue Oct 21, 2022
#139)

- Fix compilation error with issue (#131)
- Update variant.h in all boards to add a missing macro

Verification:
- Tested against WiFiSSLClient and Blink example and passed
@xidameng
Copy link
Contributor

xidameng commented Oct 21, 2022

Hi @rkuo2000

Please refer to PR #139 for fix to your issues.

Also, there are 2 things you need to change on your side,

  1. On Arduino IDE, under Tools tab, look for Standard Lib Enable: menu, then choose Arduino_STD_PRINTF option. This would enable GCC standard lib such as <stdio.h> and and etc. so as to solve the Format not supported error

  2. On top of your example code, re-define M_PI to PI macro
    #define M_PI PI

These 2 fixes are required to compile and run the example correctly, after these fix, the example works fine

Please note: All these fixes won't be available in your Arduino package until next release( in a couple weeks), unless you manually copy the changes to your 3.1.4 arduino package.

@M-ichae-l
Copy link
Contributor

@xidameng has provide the solution, processed to closed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants