Closed 01Space closed 11 months ago
To which pins did you connnect the MPU6050? It should be SDA=23 SCL=22, or adapt hw_RP2040.h to match your pins.
Apparently the output is generated with an ESP32. In the I2C scan it says I2C: Found 112 device(s)
which is an indication that SDA and SCL are not connected at all. Connect SDA to pin 23 and SCL to pin 22 and the I2C scan should report a single device. Use the reported I2C address as #define IMU_I2C_ADR
in madflight.ino. Now the IMU sensor should work.
I'm closing this issue. Please open a new issue, including your connections if you still have problems.
yes,ESP32 SDA=23 SCL=22 imu_INT_PIN = 39 RP2040 i2c_SDA_PIN = 20; i2c_SCL_PIN = 21 INT_PIN = 22 I carefully checked the hardware cable connections and they are all correct
Hello! this project is fantastic and I am very interested in it! I tried using RP2040 and ESP32 to test your code, but couldn't recognize MPU6050 I tested MPU6050 using other code and the hardware is working properly I only connected to MPU6050, I did not connect to RC receiver //========================================================================================================================// // INCLUDES // //========================================================================================================================// //include hardware specific code
if defined ARDUINO_ARCH_ESP32
include "hw_ESP32.h"
elif defined ARDUINO_ARCH_RP2040
include "hw_RP2040.h"
include //FreeRTOS
include //FreeRTOS
else
error "Unknown hardware architecture"
endif
include "ahrs.h"
//========================================================================================================================// // USER-SPECIFIED DEFINES // //========================================================================================================================//
//------------------------------------- // APPLICATION SETTINGS //-------------------------------------
define USE_IMU_INTERRUPT //Uncomment to use interrupt pin and not loop() to trigger loop_imu()
//------------------------------------- // RC RECEIVER //------------------------------------- //Uncomment only one receiver type
define USE_RCIN_PPM
//#define USE_RCIN_PWM //#define USE_RCIN_SBUS //#define USE_RCIN_DSM
include "src/RCIN/RCIN.h" //first define USE_RCIN_xxx then include RCIN.h
//------------------------------------- // IMU SENSOR //------------------------------------- //Uncomment only one IMU
define USE_IMU_MPU6050_I2C //acc/gyro
//#define USE_IMU_MPU9150_I2C //acc/gyro/mag //#define USE_IMU_MPU6500_I2C //acc/gyro Note: SPI interface is faster //#define USE_IMU_MPU9250_I2C //acc/gyro/mag Note: SPI interface is faster //#define USE_IMU_MPU6500_SPI //acc/gyro //#define USE_IMU_MPU9250_SPI //acc/gyro/mag
//Uncomment one I2C address. If unknown, see output of print_i2c_scan()
define IMU_I2C_ADR 0x68 //MPU9250
//#define IMU_I2C_ADR 0x77 //MPU9150
//Full scale gyro range in deg/sec. Most IMUs support 250,500,1000,2000. Can use any value here, driver will pick next greater setting.
define IMU_GYRO_DPS 250
//Full scale gyro accelerometer in G's. Most IMUs support 2,4,8,16. Can use any value here, driver will pick next greater setting.
define IMU_ACCEL_G 2
//Uncomment only one sensor orientation. The labels is yaw / roll (in that order) needed to rotate the sensor from it's normal position to it's mounted position. //if not sure what is needed: try each setting until roll-right gives positive ahrs_roll, pitch-up gives positive ahrs_pitch, and yaw-right gives increasing ahrs_yaw //#define IMU_ROTATE_NONE
define IMU_ROTATE_YAW90
//#define IMU_ROTATE_YAW180 //#define IMU_ROTATE_YAW270 //#define IMU_ROTATE_ROLL180 //#define IMU_ROTATE_YAW90_ROLL180 //#define IMU_ROTATE_YAW180_ROLL180 //#define IMU_ROTATE_YAW270_ROLL180
include "src/IMU/IMU.h" //first define IMU_xxx then include IMO.h
The serial port outputs the following information
madflight starting 5 ... madflight starting 4 ... madflight starting 3 ... madflight starting 2 ... madflight starting 1 ... USE_HW_ESP32 I2C: SDA=23 SCL=22 SPI: MOSI=21 MISO=36 SCLK=19 CS=18 I2C: Scanning ... I2C: Found address: 0x08 (8) I2C: Found address: 0x09 (9) I2C: Found address: 0x0A (10) I2C: Found address: 0x0B (11) I2C: Found address: 0x0C (12) I2C: Found address: 0x0D (13) I2C: Found address: 0x0E (14) I2C: Found address: 0x0F (15) I2C: Found address: 0x10 (16) I2C: Found address: 0x11 (17) I2C: Found address: 0x12 (18) I2C: Found address: 0x13 (19) I2C: Found address: 0x14 (20) I2C: Found address: 0x15 (21) I2C: Found address: 0x16 (22) I2C: Found address: 0x17 (23) I2C: Found address: 0x18 (24) I2C: Found address: 0x19 (25) I2C: Found address: 0x1A (26) I2C: Found address: 0x1B (27) I2C: Found address: 0x1C (28) I2C: Found address: 0x1D (29) I2C: Found address: 0x1E (30) I2C: Found address: 0x1F (31) I2C: Found address: 0x20 (32) I2C: Found address: 0x21 (33) I2C: Found address: 0x22 (34) I2C: Found address: 0x23 (35) I2C: Found address: 0x24 (36) I2C: Found address: 0x25 (37) I2C: Found address: 0x26 (38) I2C: Found address: 0x27 (39) I2C: Found address: 0x28 (40) I2C: Found address: 0x29 (41) I2C: Found address: 0x2A (42) I2C: Found address: 0x2B (43) I2C: Found address: 0x2C (44) I2C: Found address: 0x2D (45) I2C: Found address: 0x2E (46) I2C: Found address: 0x2F (47) I2C: Found address: 0x30 (48) I2C: Found address: 0x31 (49) I2C: Found address: 0x32 (50) I2C: Found address: 0x33 (51) I2C: Found address: 0x34 (52) I2C: Found address: 0x35 (53) I2C: Found address: 0x36 (54) I2C: Found address: 0x37 (55) I2C: Found address: 0x38 (56) I2C: Found address: 0x39 (57) I2C: Found address: 0x3A (58) I2C: Found address: 0x3B (59) I2C: Found address: 0x3C (60) I2C: Found address: 0x3D (61) I2C: Found address: 0x3E (62) I2C: Found address: 0x3F (63) I2C: Found address: 0x40 (64) I2C: Found address: 0x41 (65) I2C: Found address: 0x42 (66) I2C: Found address: 0x43 (67) I2C: Found address: 0x44 (68) I2C: Found address: 0x45 (69) I2C: Found address: 0x46 (70) I2C: Found address: 0x47 (71) I2C: Found address: 0x48 (72) I2C: Found address: 0x49 (73) I2C: Found address: 0x4A (74) I2C: Found address: 0x4B (75) I2C: Found address: 0x4C (76) I2C: Found address: 0x4D (77) I2C: Found address: 0x4E (78) I2C: Found address: 0x4F (79) I2C: Found address: 0x50 (80) I2C: Found address: 0x51 (81) I2C: Found address: 0x52 (82) I2C: Found address: 0x53 (83) I2C: Found address: 0x54 (84) I2C: Found address: 0x55 (85) I2C: Found address: 0x56 (86) I2C: Found address: 0x57 (87) I2C: Found address: 0x58 (88) I2C: Found address: 0x59 (89) I2C: Found address: 0x5A (90) I2C: Found address: 0x5B (91) I2C: Found address: 0x5C (92) I2C: Found address: 0x5D (93) I2C: Found address: 0x5E (94) I2C: Found address: 0x5F (95) I2C: Found address: 0x60 (96) I2C: Found address: 0x61 (97) I2C: Found address: 0x62 (98) I2C: Found address: 0x63 (99) I2C: Found address: 0x64 (100) I2C: Found address: 0x65 (101) I2C: Found address: 0x66 (102) I2C: Found address: 0x67 (103) I2C: Found address: 0x68 (104) I2C: Found address: 0x69 (105) I2C: Found address: 0x6A (106) I2C: Found address: 0x6B (107) I2C: Found address: 0x6C (108) I2C: Found address: 0x6D (109) I2C: Found address: 0x6E (110) I2C: Found address: 0x6F (111) I2C: Found address: 0x70 (112) I2C: Found address: 0x71 (113) I2C: Found address: 0x72 (114) I2C: Found address: 0x73 (115) I2C: Found address: 0x74 (116) I2C: Found address: 0x75 (117) I2C: Found address: 0x76 (118) I2C: Found address: 0x77 (119) I2C: Found 112 device(s) USE_RX_PPM pin=35 USE_IMU_MPU6050_I2C E (4348) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48 E (4348) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97 E (4360) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195 E (4371) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48 E (4383) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97 E (4394) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195 E (4405) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48 E (4417) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97 E (4428) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195 E (4440) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48 E (4451) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97 E (4462) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195 float AccErrorX = +0.000000; float AccErrorY = +0.000000; float AccErrorZ = -1.000000; float GyroErrorX = +0.000000; float GyroErrorY = +0.000000; float GyroErrorZ = +0.000000; Paste these values in user specified variables section and comment out calculate_IMU_error() in void setup. ahrs_Setup() No Magnetometer ahrs_Setup() Estimated yaw:-0.00 gx:+0.00 gy:+0.00 gz:+0.00 ax:+0.00 ay:+0.00 az:+0.00 mx:+0.00 my:+0.00 mz:+0.00 roll:+0.0 pitch:-0.0 yaw:+0.0 yaw_mag:-0.0 imu_err_cnt:0
gx:+0.00 gy:+0.00 gz:+0.00 ax:+0.00 ay:+0.00 az:+0.00 mx:+0.00 my:+0.00 mz:+0.00 roll:+0.0 pitch:-0.0 yaw:+0.0 yaw_mag:-0.0 imu_err_cnt:0
Thank you!