EM7180_SENtral_sensor_hub icon indicating copy to clipboard operation
EM7180_SENtral_sensor_hub copied to clipboard

ESP32 received no Data

Open themuck opened this issue 6 years ago • 22 comments

Hello i tried to use the Ultimate Sensor with an ESP32, but it looks like i have no SENtral device information.

Scanning...
I2C device found at address 0x28  !
done

EM7180 ROM Version: 0x00
Should be: 0xE609
EM7180 RAM Version: 0x00
EM7180 ProductID: 0x0 Should be: 0x80
EM7180 RevisionID: 0x0 Should be: 0x02
EEPROM upload successful!
Beginning Parameter Adjustments

and it hangs there...

That i found on the master bus

Scanning...
I2C device found at address 0x50  !
I2C device found at address 0x58  !
I2C device found at address 0x68  !
I2C device found at address 0x76  !
done

any ideas what is wrong?

//  Wire.endTransmission(I2C_NOSTOP);        // Send the Tx buffer, but send a restart to keep connection alive
  Wire.endTransmission(false);             // Send the Tx buffer, but send a restart to keep connection alive

i have changed some of this parts, but nothing happens.

Best regards Malte

themuck avatar Sep 07 '18 07:09 themuck

Hi Malte,

Looks like you don't have firmware in your EEPROM. Can you send me a picture of the EM7180 board? Did this ever work? Did it work with ther MCUs?

On Fri, Sep 7, 2018 at 12:26 AM themuck [email protected] wrote:

Hello i tried to use the Ultimate Sensor with an ESP32, but it looks like i have no SENtral device information.

`Scanning... I2C device found at address 0x28 ! done

EM7180 ROM Version: 0x00 Should be: 0xE609 EM7180 RAM Version: 0x00 EM7180 ProductID: 0x0 Should be: 0x80 EM7180 RevisionID: 0x0 Should be: 0x02 EEPROM upload successful! Beginning Parameter Adjustments ` and it hangs there...

That i found on the master bus Scanning... I2C device found at address 0x50 ! I2C device found at address 0x58 ! I2C device found at address 0x68 ! I2C device found at address 0x76 ! done

any ideas what is wrong?

// Wire.endTransmission(I2C_NOSTOP); // Send the Tx buffer, but send a restart to keep connection alive Wire.endTransmission(false); // Send the Tx buffer, but send a restart to keep connection alive

i have changed some of this parts, but nothing happens.

Best regards Malte

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qulRdMZOHtz_noFRn6tZM-Th8677ks5uYh-JgaJpZM4WeUMY .

kriswiner avatar Sep 07 '18 17:09 kriswiner

Hi, it is a new sensor from here... https://www.tindie.com/products/onehorse/ultimate-sensor-fusion-solution-mpu9250/

an Adafruit BNO055 works well. And when i look at the "read" and "write" -functions there is no big difference in the codes...

https://drive.google.com/file/d/1qiI_mmkYXjXQ1CANHQXgkCvi_9Lw5-jD/view?usp=sharing

themuck avatar Sep 08 '18 06:09 themuck

OK, these boards "should" all have the proper firmware loaded onto the EEPROM and have been function tested but maybe this one slipped through the cracks. Just to be sure, you are using the bottom left SDA/SCL pins to connect to the MCU and test the program? The top right are for the master I2C bus that normally isn't accessed by the host MCU.

I can offer a refund or replacement your choice. I would like to get the "bad" board back for forensics.

Please send me an e-mail at tleracorp@gmail with your preference.

On Fri, Sep 7, 2018 at 11:56 PM themuck [email protected] wrote:

Hi, it is a new sensor from here...

https://www.tindie.com/products/onehorse/ultimate-sensor-fusion-solution-mpu9250/

an Adafruit BNO055 works well. And when i look at the "read" and "write" -functions there is no big difference in the codes...

https://drive.google.com/file/d/1qiI_mmkYXjXQ1CANHQXgkCvi_9Lw5-jD/view?usp=sharing

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36#issuecomment-419618576, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qv5Fm0AVtj0xbk-8r5kV05buHQ3wks5uY2oBgaJpZM4WeUMY .

kriswiner avatar Sep 08 '18 16:09 kriswiner

I2C device found at address 0x28  !
done

EM7180 ROM Version: 0xE69
Should be: 0xE609
EM7180 RAM Version: 0x17435
EM7180 ProductID: 0x80 Should be: 0x80
EM7180 RevisionID: 0x2 Should be: 0x02
A barometer is installed
A temperature sensor is installed
EEPROM detected on the sensor bus!
EEPROM uploaded config file!
EM7180 in initialized state!
EEPROM upload successful!
Beginning Parameter Adjustments
Magnetometer Default Full Scale Range: +/-1000uT
Accelerometer Default Full Scale Range: +/-4g
Gyroscope Default Full Scale Range: +/-2000dps
Magnetometer New Full Scale Range: +/-1000uT
Accelerometer New Full Scale Range: +/-8g
Gyroscope New Full Scale Range: +/-2000dps

maybe this looks better... compiled for a Arduino 2560 ;)... so i have to search for the problem! Thanks for the fast support!...

best regards Malte

Edit... it works now on the ESP32...

//	Wire.endTransmission(false);
Wire.endTransmission(); //works fine ;)

themuck avatar Sep 09 '18 07:09 themuck

Yes, this "

EM7180 RAM Version: 0x17435

" means you are reading the firmware loaded on the EEPROM. So, surprisingly, it does seem to be your MCU/software that is the problem. Maybe switch to a Ladybug or Butterfly?

On Sun, Sep 9, 2018 at 12:06 AM themuck [email protected] wrote:

I2C device found at address 0x28 ! done

EM7180 ROM Version: 0xE69 Should be: 0xE609 EM7180 RAM Version: 0x17435 EM7180 ProductID: 0x80 Should be: 0x80 EM7180 RevisionID: 0x2 Should be: 0x02 A barometer is installed A temperature sensor is installed EEPROM detected on the sensor bus! EEPROM uploaded config file! EM7180 in initialized state! EEPROM upload successful! Beginning Parameter Adjustments Magnetometer Default Full Scale Range: +/-1000uT Accelerometer Default Full Scale Range: +/-4g Gyroscope Default Full Scale Range: +/-2000dps Magnetometer New Full Scale Range: +/-1000uT Accelerometer New Full Scale Range: +/-8g Gyroscope New Full Scale Range: +/-2000dps

maybe this looks better... compiled for a Arduino 2560 ;)... so i have to search for the problem! Thanks for the fast support!...

best regards Malte

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36#issuecomment-419695608, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qlHBQADbauEUkX4jgGG70XuG7PIaks5uZL4EgaJpZM4WeUMY .

kriswiner avatar Sep 09 '18 16:09 kriswiner

Neither of these look fine since the magnetometer values are all zero and the gyro is reading 5000 degree per second. Something is very wrong.

On many AVR MCUs the I2C read/write buffer is limited to 32 bytes. The warm start parameters are read in a single 128 byte chunk in our sketches. So in order to make this worm on your Arduino you either have to increase the Wire.h buffer sinze to 128 bytes or rewrite the warm start parameter read part of the sketch to read the warm start parameters in 32 byte chunks.

On Sun, Sep 16, 2018 at 5:16 AM themuck [email protected] wrote:

Hello again :/... i am sorry but i tried the Warm start feature and it looks like the readSenParams(); crashed the device? I yust test it on a Mega 2560, later i will try my ESP32.

Scanning... I2C device found at address 0x28 ! done

EM7180 ROM Version: 0xE69 Should be: 0xE609 EM7180 RAM Version: 0x17435 EM7180 ProductID: 0x80 Should be: 0x80 EM7180 RevisionID: 0x2 Should be: 0x02 A barometer is installed A temperature sensor is installed EEPROM detected on the sensor bus! EEPROM uploaded config file! EM7180 in initialized state! EEPROM upload successful! Send '1' for Warm Start, '0' for no Warm Start !!!Warm Start active!!! Send '2' to apply Accelerometer Cal, '0' to not apply Accelerometer Cal No Accel Cal Beginning Parameter Adjustments Magnetometer Default Full Scale Range: +/-1000uT Accelerometer Default Full Scale Range: +/-4g Gyroscope Default Full Scale Range: +/-2000dps Magnetometer New Full Scale Range: +/-1000uT Accelerometer New Full Scale Range: +/-8g Gyroscope New Full Scale Range: +/-2000dps EM7180 run status = normal mode EM7180 sensor status = 0 Actual MagRate = 0 Hz Actual AccelRate = 0 Hz Actual GyroRate = 0 Hz Actual BaroRate = 0 Hz


Send '1' to store Warm Start configuration


ax = -87.35 ay = -0.49 az = 1003.82 mg gx = 5013.35 gy = 5013.35 gz = 5013.35 deg/s mx = 0 my = 0 mz = 0 mG Software quaternions (ENU): q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00 Hardware quaternions (NED): Q0 = -0.65 Qx = -0.01 Qy = 0.76 Qz = 0.01 Software yaw, pitch, roll: 13.80, 0.00, 0.00 Hardware Yaw, Pitch, Roll: 184.99, 80.43, -9.43 BMP280: Altimeter temperature = 25.39 C Altimeter temperature = 77.70 F Altimeter pressure = 1010.76 mbar Altitude = 68.05 feet

Without Warm start, everything looks fine...

Scanning... I2C device found at address 0x28 ! done

EM7180 ROM Version: 0xE69 Should be: 0xE609 EM7180 RAM Version: 0x17435 EM7180 ProductID: 0x80 Should be: 0x80 EM7180 RevisionID: 0x2 Should be: 0x02 A barometer is installed A temperature sensor is installed EEPROM detected on the sensor bus! EEPROM uploaded config file! EEPROM upload successful! Send '1' for Warm Start, '0' for no Warm Start No Warm Start Send '2' to apply Accelerometer Cal, '0' to not apply Accelerometer Cal No Accel Cal Beginning Parameter Adjustments Magnetometer Default Full Scale Range: +/-1000uT Accelerometer Default Full Scale Range: +/-8g Gyroscope Default Full Scale Range: +/-2000dps Magnetometer New Full Scale Range: +/-1000uT Accelerometer New Full Scale Range: +/-8g Gyroscope New Full Scale Range: +/-2000dps EM7180 magnetic anomaly detected EM7180 new quaternion result EM7180 new mag result EM7180 new accel result EM7180 new gyro result EM7180 sensor status = 0 Actual MagRate = 100 Hz Actual AccelRate = 200 Hz Actual GyroRate = 200 Hz Actual BaroRate = 50 Hz


Send '1' to store Warm Start configuration


ax = -73.20 ay = -17.57 az = 1007.23 mg gx = 5013.35 gy = 5013.35 gz = 5013.35 deg/s mx = 0 my = 0 mz = 0 mG Software quaternions (ENU): q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00 Hardware quaternions (NED): Q0 = 0.84 Qx = 0.07 Qy = 0.53 Qz = 0.03 Software yaw, pitch, roll: 13.80, 0.00, 0.00 Hardware Yaw, Pitch, Roll: 34.40, -63.09, 162.84 BMP280: Altimeter temperature = 25.16 C Altimeter temperature = 77.29 F Altimeter pressure = 1010.68 mbar Altitude = 70.23 feet

best regards Malte

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36#issuecomment-421755712, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qitTIgsYgS6lShKqtWiIdnhoiVayks5ubkEygaJpZM4WeUMY .

kriswiner avatar Sep 16 '18 16:09 kriswiner

Hello, thanks for the fast support! i think it works now... but i changed to the ESP32 and edited the Wire.h. I will test the arduino later.

but what i dont understand is this

Actual MagRate = 0 Hz
Actual AccelRate = 0 Hz
Actual GyroRate = 0 Hz
Actual BaroRate = 0 Hz
I2C device found at address 0x28  !
done

EM7180 ROM Version: 0xE69
Should be: 0xE609
EM7180 RAM Version: 0x17435
EM7180 ProductID: 0x80 Should be: 0x80
EM7180 RevisionID: 0x2 Should be: 0x02
A barometer is installed
A temperature sensor is installed
EEPROM detected on the sensor bus!
EEPROM uploaded config file!
EEPROM upload successful!
Send '1' for Warm Start, '0' for no Warm Start
!!!Warm Start active!!!
Send '2' to apply Accelerometer Cal, '0' to not apply Accelerometer Cal
!!!Accel Cal Active!!!
X-acc max: 2008
Y-acc max: 2013
Z-acc max: 2073
X-acc min: -2092
Y-acc min: -2077
Z-acc min: -2036
Beginning Parameter Adjustments
Magnetometer Default Full Scale Range: +/-1000uT
Accelerometer Default Full Scale Range: +/-8g
Gyroscope Default Full Scale Range: +/-2000dps
Magnetometer New Full Scale Range: +/-1000uT
Accelerometer New Full Scale Range: +/-8g
Gyroscope New Full Scale Range: +/-2000dps
 EM7180 run status = normal mode
 EM7180 mag calibration completed
 EM7180 magnetic anomaly detected
 EM7180 sensor status = 0
Actual MagRate = 0 Hz
Actual AccelRate = 0 Hz
Actual GyroRate = 0 Hz
Actual BaroRate = 0 Hz

*******************************************
Send '1' to store Warm Start configuration
*******************************************

ax = -52.22 ay = -22.94 az = 1008.21 mg
gx = -0.15 gy = -0.15 gz = 0.00 deg/s
mx = -200 my = -135 mz = 363 mG
Software quaternions (ENU):
q0 = 0.06 qx = -0.30 qy = 0.94 qz = 0.17
Hardware quaternions (NED):
Q0 = -0.03 Qx = -0.00 Qy = 0.95 Qz = 0.30
Software yaw, pitch, roll: 227.88, 12.05, 163.10
Hardware Yaw, Pitch, Roll: 158.42, 2.92, -1.34
BMP280:
Altimeter temperature = 25.05 C
Altimeter temperature = 77.09 F
Altimeter pressure = 1008.52 mbar
Altitude = 129.37 feet

then i copy a sensorStatus report in the loop function and it looks like...

 EM7180 sensor status = 0
Actual MagRate = 100 Hz
Actual AccelRate = 200 Hz
Actual GyroRate = 200 Hz
Actual BaroRate = 50 Hz

best regards Malte

themuck avatar Sep 16 '18 17:09 themuck

then i copy a sensorStatus report in the loop function and it looks good...

EM7180 sensor status = 0 Actual MagRate = 100 Hz Actual AccelRate = 200 Hz Actual GyroRate = 200 Hz Actual BaroRate = 50 Hz

Not sue what you mean by "copy a sensorStatus report"

When the EM7180 is working properly, it should reort non-zero sensor rates. If a sensor rate is reported as zero, it means this sensor was not present or not detected.

On Sun, Sep 16, 2018 at 10:25 AM themuck [email protected] wrote:

Hello, thanks for the fast support! i think it works now... but i changed to the ESP32 and edited the Wire.h. I will test the arduino later.

but what i dont understand is this

Actual MagRate = 0 Hz Actual AccelRate = 0 Hz Actual GyroRate = 0 Hz Actual BaroRate = 0 Hz

I2C device found at address 0x28 ! done

EM7180 ROM Version: 0xE69 Should be: 0xE609 EM7180 RAM Version: 0x17435 EM7180 ProductID: 0x80 Should be: 0x80 EM7180 RevisionID: 0x2 Should be: 0x02 A barometer is installed A temperature sensor is installed EEPROM detected on the sensor bus! EEPROM uploaded config file! EEPROM upload successful! Send '1' for Warm Start, '0' for no Warm Start !!!Warm Start active!!! Send '2' to apply Accelerometer Cal, '0' to not apply Accelerometer Cal !!!Accel Cal Active!!! X-acc max: 2008 Y-acc max: 2013 Z-acc max: 2073 X-acc min: -2092 Y-acc min: -2077 Z-acc min: -2036 Beginning Parameter Adjustments Magnetometer Default Full Scale Range: +/-1000uT Accelerometer Default Full Scale Range: +/-8g Gyroscope Default Full Scale Range: +/-2000dps Magnetometer New Full Scale Range: +/-1000uT Accelerometer New Full Scale Range: +/-8g Gyroscope New Full Scale Range: +/-2000dps EM7180 run status = normal mode EM7180 mag calibration completed EM7180 magnetic anomaly detected EM7180 sensor status = 0 Actual MagRate = 0 Hz Actual AccelRate = 0 Hz Actual GyroRate = 0 Hz Actual BaroRate = 0 Hz


Send '1' to store Warm Start configuration


ax = -52.22 ay = -22.94 az = 1008.21 mg gx = -0.15 gy = -0.15 gz = 0.00 deg/s mx = -200 my = -135 mz = 363 mG Software quaternions (ENU): q0 = 0.06 qx = -0.30 qy = 0.94 qz = 0.17 Hardware quaternions (NED): Q0 = -0.03 Qx = -0.00 Qy = 0.95 Qz = 0.30 Software yaw, pitch, roll: 227.88, 12.05, 163.10 Hardware Yaw, Pitch, Roll: 158.42, 2.92, -1.34 BMP280: Altimeter temperature = 25.05 C Altimeter temperature = 77.09 F Altimeter pressure = 1008.52 mbar Altitude = 129.37 feet

then i copy a sensorStatus report in the loop function and it looks good...

EM7180 sensor status = 0 Actual MagRate = 100 Hz Actual AccelRate = 200 Hz Actual GyroRate = 200 Hz Actual BaroRate = 50 Hz

best regards Malte

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36#issuecomment-421799829, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qusp3qlZxwRGW6BqLSMh2ZOeUMdLks5ubomOgaJpZM4WeUMY .

kriswiner avatar Sep 16 '18 17:09 kriswiner

i have a look at the sensor status bits in the loop() function

 // Check sensor status
    uint8_t sensorStatus = readByte(EM7180_ADDRESS, EM7180_SensorStatus);
    Serial.print(" EM7180 sensor status = "); Serial.println(sensorStatus);
    if(sensorStatus & 0x01) Serial.print("Magnetometer not acknowledging!");
    if(sensorStatus & 0x02) Serial.print("Accelerometer not acknowledging!");
    if(sensorStatus & 0x04) Serial.print("Gyro not acknowledging!");
    if(sensorStatus & 0x10) Serial.print("Magnetometer ID not recognized!");
    if(sensorStatus & 0x20) Serial.print("Accelerometer ID not recognized!");
    if(sensorStatus & 0x40) Serial.print("Gyro ID not recognized!");
  
    Serial.print("Actual MagRate = "); Serial.print(readByte(EM7180_ADDRESS, EM7180_ActualMagRate)); Serial.println(" Hz"); 
    Serial.print("Actual AccelRate = "); Serial.print(10*readByte(EM7180_ADDRESS, EM7180_ActualAccelRate)); Serial.println(" Hz"); 
    Serial.print("Actual GyroRate = "); Serial.print(10*readByte(EM7180_ADDRESS, EM7180_ActualGyroRate)); Serial.println(" Hz"); 
    Serial.print("Actual BaroRate = "); Serial.print(readByte(EM7180_ADDRESS, EM7180_ActualBaroRate)); Serial.println(" Hz");
    Serial.println(""); Serial.println("*******************************************");
    

in the WarmStart sketch... these are the settings...

// Set accel/gyro/mage desired ODR rates
   writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x02); // 100 Hz
   writeByte(EM7180_ADDRESS, EM7180_MagRate, 0x64); // 100 Hz
   writeByte(EM7180_ADDRESS, EM7180_AccelRate, 0x14); // 200/10 Hz
   writeByte(EM7180_ADDRESS, EM7180_GyroRate, 0x14); // 200/10 Hz
   writeByte(EM7180_ADDRESS, EM7180_BaroRate, 0x80 | 0x32);  // set enable bit and set Baro rate to 25 Hz

So in the loop it looks OK, but why not in the Startup part when the WarmStart values are loaded? But not sure this is a problem...

themuck avatar Sep 16 '18 17:09 themuck

No idea. If you want quats at 100 Hz use a qrate divisor of 1.

On Sun, Sep 16, 2018 at 10:55 AM themuck [email protected] wrote:

i have a look at the sensor status bits in the loop() function

// Check sensor status uint8_t sensorStatus = readByte(EM7180_ADDRESS, EM7180_SensorStatus); Serial.print(" EM7180 sensor status = "); Serial.println(sensorStatus); if(sensorStatus & 0x01) Serial.print("Magnetometer not acknowledging!"); if(sensorStatus & 0x02) Serial.print("Accelerometer not acknowledging!"); if(sensorStatus & 0x04) Serial.print("Gyro not acknowledging!"); if(sensorStatus & 0x10) Serial.print("Magnetometer ID not recognized!"); if(sensorStatus & 0x20) Serial.print("Accelerometer ID not recognized!"); if(sensorStatus & 0x40) Serial.print("Gyro ID not recognized!");

Serial.print("Actual MagRate = "); Serial.print(readByte(EM7180_ADDRESS, EM7180_ActualMagRate)); Serial.println(" Hz");
Serial.print("Actual AccelRate = "); Serial.print(10*readByte(EM7180_ADDRESS, EM7180_ActualAccelRate)); Serial.println(" Hz");
Serial.print("Actual GyroRate = "); Serial.print(10*readByte(EM7180_ADDRESS, EM7180_ActualGyroRate)); Serial.println(" Hz");
Serial.print("Actual BaroRate = "); Serial.print(readByte(EM7180_ADDRESS, EM7180_ActualBaroRate)); Serial.println(" Hz");
Serial.println(""); Serial.println("*******************************************");

in the WarmStart sketch... these are the settings...

// Set accel/gyro/mage desired ODR rates writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x02); // 100 Hz writeByte(EM7180_ADDRESS, EM7180_MagRate, 0x64); // 100 Hz writeByte(EM7180_ADDRESS, EM7180_AccelRate, 0x14); // 200/10 Hz writeByte(EM7180_ADDRESS, EM7180_GyroRate, 0x14); // 200/10 Hz writeByte(EM7180_ADDRESS, EM7180_BaroRate, 0x80 | 0x32); // set enable bit and set Baro rate to 25 Hz

So in the loop it looks OK, but why not in the Startup part when the WarmStart values are loaded?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36#issuecomment-421804168, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qmeSeW5K4fHWL-dDDqTqPF3hwcoYks5ubpCJgaJpZM4WeUMY .

kriswiner avatar Sep 16 '18 18:09 kriswiner

@themuck: Even with the latest arduino-esp32 code, Wire.endTransmission(false) in I2C read routines from @kriswiner won't run correctly but works fine with Wire.endTransmission(true). With his example code, I also had to use polling in my main loop instead of interrupts, to get the I2C reads to be reliable at 400 KHz clock with no hangs. This might be improved with arduino-esp32 PR #1877. I will try interrupts again! See also comments at arduino-esp32 PR #1717. Seems the ESP32 I2C and USFS board have some relationship problems . . .

CaptIgmu avatar Sep 29 '18 06:09 CaptIgmu

The current release of Arduino-esp32 (1.0.0, July 28, 2018) does not work with ReSTART operations. The current GitHub repo has been fixed. If you are using Release 1.0.0, you need to substitute the four i2c from the GitHub repo:

  • \cores\esp32\esp32-hal-i2c.h
  • \cores\esp32\esp32-hal-i2c.c
  • \libraries\Wire\src\Wire.h
  • \libraries\Wire\src\Wire.cpp

Chuck.

stickbreaker avatar Sep 29 '18 15:09 stickbreaker

I have the sensor board working great on the Teensy 3.6 @ 5khz. Managed to compile for ESP32 but gee its bad at less than 700hz and looks like a huge delay in the loop. Id love to see some proper functioning code for the ESP32 if any of you fellas feel like sharing. As for the I2c files stickbreaker Ill give it a go

carbonadam avatar Oct 15 '18 16:10 carbonadam

I have used the EM7180 sensor board with the ESP32 and didn't have any trouble. But I understand that I2C has been "fixed" in the ESP32 Arduino core several times so this might no longer be the case.

On Mon, Oct 15, 2018 at 9:39 AM Adam [email protected] wrote:

I have the sensor board working great on the Teensy 3.6 @ 5khz. Managed to compile for ESP32 but gee its bad at less than 700hz and looks like a huge delay in the loop. Id love to see some proper functioning code for the ESP32 if any of you fellas feel like sharing. As for the I2c files stickbreaker Ill give it a go

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36#issuecomment-429926059, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qsSOcB6zFVgmp4Roy4pUDWAU1vYsks5ulLpPgaJpZM4WeUMY .

kriswiner avatar Oct 15 '18 16:10 kriswiner

Yep chasing my tail on this one, one good reason to have the teensy though just to know how fantastic it can be. Ill send you a mail and perhaps I can get it to have sensible output.

carbonadam avatar Oct 15 '18 16:10 carbonadam

ok little chasing things down. Seems on on STICKBREAKER V0.2.2 for an adapted version for the teensy code (just changed the Wire.endTransmission to true ). Ran some older code from Kris which actually runs at 29khz but the software heading seems a bit wonky while hardware is ok. The wire stuff is kinda baffling though as I had thought that I am actually no loner using stickbreaker but rather official release.

#define STICKBREAKER V0.2.2

hmm what now

carbonadam avatar Oct 15 '18 18:10 carbonadam

@carbonadam you have two choices, modify your release 1.0.0 code or start using the Dev Code.

modification

Dev branch installation instructions

A modified version of my code became the official release. During prerelease testing and debugging, this ReSTART failure was introduced.

Chuck.

stickbreaker avatar Oct 15 '18 18:10 stickbreaker

So now running with latest github version #define STICKBREAKER V1.0.1

I get the following results. Something still isnt right for the update @ rate = 705.95 Hz Sub par.

carbonadam avatar Oct 15 '18 20:10 carbonadam

Can you post the code that does the scan, maybe i can optimize it.

Chuck.

stickbreaker avatar Oct 15 '18 21:10 stickbreaker

Not sure which part is causing this to be slow so uploaded the sketch as text. Cheers Chuck. any insight welcome. EM7180_MPU9250_BMP280_prepESP32.txt

carbonadam avatar Oct 15 '18 21:10 carbonadam

Couple things.

writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x02); // 100 Hz writeByte(EM7180_ADDRESS, EM7180_MagRate, 0x64); // 100 Hz writeByte(EM7180_ADDRESS, EM7180_AccelRate, 0x14); // 200/10 Hz writeByte(EM7180_ADDRESS, EM7180_GyroRate, 0x14); // 200/10 Hz

means you are running with a quaternion update rate of 200/(1 _ 2) ~ 66Hz, not 100 Hz

You are not using interrupts, so you are wasting a lot of time looping around reading the status registers waiting for new data, not optimal.

You don't need any of the passthough sections if you only need the EM7180 "hardware" sensor fusion solution.

On Mon, Oct 15, 2018 at 2:30 PM Adam [email protected] wrote:

Not sure which part is causing this to be slow so uploaded the sketch as text. Cheers Chuck. any insight welcome. EM7180_MPU9250_BMP280_prepESP32.txt https://github.com/kriswiner/EM7180_SENtral_sensor_hub/files/2480632/EM7180_MPU9250_BMP280_prepESP32.txt

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/36#issuecomment-430020635, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qlXMUfBOrpQvUQs0UWY6YJs57r0Fks5ulP5lgaJpZM4WeUMY .

kriswiner avatar Oct 15 '18 21:10 kriswiner

@carbonadam Try swapping out these functions:


void readSENtralQuatData(float * destination)
{
  uint8_t rawData[16];  // x/y/z quaternion register data stored here
//  readBytes(EM7180_ADDRESS, EM7180_QX, 16, &rawData[0]);       // Read the sixteen raw data registers into data array
  uint8_t reg=EM7180_QW;
  uint8_t err =Wire.writeTransmission(EM7180_ADDRESS, &reg, 1, false);
  if(err == I2C_ERROR_CONTINUE ){// continue because of ReSTART
    err= Wire.readTransmission(EM7180_ADDRESS, &rawData, 16);

	destination[0] = uint32_reg_to_float (&rawData[0]);
	destination[1] = uint32_reg_to_float (&rawData[4]);
	destination[2] = uint32_reg_to_float (&rawData[8]);
	destination[3] = uint32_reg_to_float (&rawData[12]);  // SENtral stores quats as qx, qy, qz, q0!
  }
}

void readSENtralAccelData(int16_t * destination)
{
  uint8_t rawData[6];  // x/y/z accel register data stored here
//  readBytes(EM7180_ADDRESS, EM7180_AX, 6, &rawData[0]);       // Read the six raw data registers into data array
  uint8_t reg = EM7180_AX;
  uint8_t err = Wire.writeTransmission(EM7180_ADDRESS,&reg,1,false);
  if(err ==  I2C_ERROR_CONTINUE) {// ReSTART
    err = Wire.readTransmission(EM7180_ADDRESS,&rawData,6);
	
	destination[0] = (int16_t) (((int16_t)rawData[1] << 8) | rawData[0]);  // Turn the MSB and LSB into a signed 16-bit value
	destination[1] = (int16_t) (((int16_t)rawData[3] << 8) | rawData[2]);  
	destination[2] = (int16_t) (((int16_t)rawData[5] << 8) | rawData[4]); 
  }
}

void readSENtralGyroData(int16_t * destination)
{
  uint8_t rawData[6];  // x/y/z gyro register data stored here
//  readBytes(EM7180_ADDRESS, EM7180_GX, 6, &rawData[0]);  // Read the six raw data registers sequentially into data array
  uint8_t reg = EM7180_GX;
  uint8_t err = Wire.writeTransmission(EM7180_ADDRESS,&reg,1,false);
  if(err== I2C_ERROR_CONTINUE){ // ReSTART
	err = Wire.readTransmission(EM7180_ADDRESS,&rawData,6);
	destination[0] = (int16_t) (((int16_t)rawData[1] << 8) | rawData[0]);   // Turn the MSB and LSB into a signed 16-bit value
	destination[1] = (int16_t) (((int16_t)rawData[3] << 8) | rawData[2]);  
	destination[2] = (int16_t) (((int16_t)rawData[5] << 8) | rawData[4]); 
  }
}

void readSENtralMagData(int16_t * destination)
{
  uint8_t rawData[6];  // x/y/z gyro register data stored here
//  readBytes(EM7180_ADDRESS, EM7180_MX, 6, &rawData[0]);  // Read the six raw data registers sequentially into data array
  uint8_t reg = EM7180_MX;
  uint8_t err = Wire.writeTransmission(EM7180_ADDRESS,&reg,1,false);
  if(err ==  I2C_ERROR_CONTINUE) {// ReSTART
    err = Wire.readTransmission(EM7180_ADDRESS,&rawData,6);
	destination[0] = (int16_t) (((int16_t)rawData[1] << 8) | rawData[0]);   // Turn the MSB and LSB into a signed 16-bit value
	destination[1] = (int16_t) (((int16_t)rawData[3] << 8) | rawData[2]);  
	destination[2] = (int16_t) (((int16_t)rawData[5] << 8) | rawData[4]); 
	}
}

Chuck.

stickbreaker avatar Oct 15 '18 22:10 stickbreaker