Replies: 13 comments
-
If I use your code directly, i2c_ Scan cannot recognize the device |
Beta Was this translation helpful? Give feedback.
-
I used the code here |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for trying this out. As I understand it, you changed the SDA pin from 23 to 21 in hw_ESP32.h. But did you also change the HW_PIN_SPI_MOSI pin from 21 to 23??? Otherwise you have pin 21 defined twice, that does not work. You should have something like this
Maybe try a fresh git clone, I've been making quite a few updates the last couple of days. Here is the output I'm getting on an ESP32 with MPU9150 (= MPU6050 + magnetometer) connected.
|
Beta Was this translation helpful? Give feedback.
-
Thank you! Pin 21 is only defined once ,MPU9150 (=MPU6500+magnetometer), so MPU9250 and MPU6050 are completely different,I will test MPU6500 immediately //SPI: |
Beta Was this translation helpful? Give feedback.
-
I tested using MPU6500, but your code still cannot recognize the device |
Beta Was this translation helpful? Give feedback.
-
I used the code you updated today, RP2040 can recognize MPU6050 and MPU6500, but ESP32 cannot recognize MPU6050 and MPU6500. RP2040 connected to MPU6050 madflight starting 3 ... RP2040 connected to MPU6500. madflight starting 5 ... |
Beta Was this translation helpful? Give feedback.
-
I've updated imu.h, RP2040 connected to MPU6500 should work now. "NodeMCU ESP32 S Dev Kit" - I'm not 100% sure this is a ESP32 or a ESP32-Sx variant, or some sort of fake. I've never seen the ESP32S module on the picture. Anyway, I've added Please give it a try, and let me know. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Pushed a new version today with some barometers. Still fighting with I2C on the ESP32, added a note in hw_ESP32.h Did not test on RP2040 today, hope it still works ;-)
These are certainly options. I'm working on barometers now, then maybe GPS. The rest probably won't happen (not enough time to work on this...) But if you feel like, please go ahead and add the new functions/sensors and send me a pull request.
Sounds good! Actually RP2040 can do 6 hardware serial ports with the PIO see here |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Definitely use SPI for the IMU: faster and more stable. I would not bother to include ELRS on the board, but provide a 4 pin connector to connect an external ELRS module. Rather include a current shunt and voltage sense resistor divider (see new BAT_ADC pin on my pinout) or use an INA226. You can use more modern IMU/BARO chips, but you will need to write drivers for them as I'm focusing on easily available sensor breakout boards at the moment. Options like LCD or SDCARD will probably need SPI, which is already used for IMU or you need to sacrifice 4 pins for a second SPI. Looking forward to see your design! |
Beta Was this translation helpful? Give feedback.
-
@01Space I've converted the issue to a discussion, so that we can keep in touch on this topic. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your suggestion. I will add voltage measurement circuits and current measurement circuits |
Beta Was this translation helpful? Give feedback.
-
I modified the print_ I2c_ Scan() section code ,I modified the I2C PINS and now I can find the I2C device. So now I can confirm that the software is not working properly
void print_i2c_scan() {
//Serial.printf("I2C: Scanning ...\n");
// byte count = 0;
//i2c->begin();
//for (byte i = 8; i < 120; i++) {
// i2c->beginTransmission(i); // Begin I2C transmission Address (i)
// if (i2c->endTransmission() == 0) { // Receive 0 = success (ACK response)
// Serial.printf("I2C: Found address: 0x%02X (%d)\n",i,i);
// count++;
// }
//}
//Serial.printf("I2C: Found %d device(s)\n", count);
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
WIRE.beginTransmission(address);
error = WIRE.endTransmission();
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
}
madflight starting 5 ...
madflight starting 4 ...
madflight starting 3 ...
madflight starting 2 ...
madflight starting 1 ...
USE_HW_ESP32
I2C: SDA=21 SCL=22
SPI: MOSI=23 MISO=19 SCLK=18 CS=15
Scanning...
I2C device found at address 0x68 !
done
USE_RX_PPM pin=35
USE_IMU_MPU6050_I2C
E (4065) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4066) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4077) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4089) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4100) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4111) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4123) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4134) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4145) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4157) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4168) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4180) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
float AccErrorX = +0.000061;
float AccErrorY = +0.000061;
float AccErrorZ = -1.000061;
float GyroErrorX = -0.007634;
float GyroErrorY = -0.007634;
float GyroErrorZ = +0.007634;
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
Beta Was this translation helpful? Give feedback.
All reactions