kriswiner / EM7180_SENtral_sensor_hub

(Affordable) Ultimate Sensor Fusion Solution
https://www.tindie.com/products/onehorse/ultimate-sensor-fusion-solution/
96 stars 37 forks source link

CpuReset #47

Closed Julspower closed 5 years ago

Julspower commented 5 years ago

Im trying to use the SENtral using rpi zero w connected correctly I can read version and everything but im I try to use it I get EM7180_EventStatus == 0x01

at start I do wiringPiI2CWriteReg8(ni2cFD, EM7180_ResetRequest, 0x01); while(wiringPiI2CReadReg8(ni2cFD, EM7180_ResetRequest) != 0x00) QThread::msleep(250); while(1) n = wiringPiI2CReadReg8(ni2cFD, EM7180_EventStatus); // reading clears the register I always read n at 0x01 when in the debugger any idea?

kriswiner commented 5 years ago

Nope, never use Raspberry pi.

Does the SENtral produce data as expected?

What does the RAM version say? is it reading the EEPROM?

On Sat, Jan 19, 2019 at 8:43 AM Julspower notifications@github.com wrote:

Im trying to use the SENtral using rpi zero w connected correctly I can read version and everything but im I try to use it I get EM7180_EventStatus == 0x01

at start I do wiringPiI2CWriteReg8(ni2cFD, EM7180_ResetRequest, 0x01); while(wiringPiI2CReadReg8(ni2cFD, EM7180_ResetRequest) != 0x00) QThread::msleep(250); while(1) n = wiringPiI2CReadReg8(ni2cFD, EM7180_EventStatus); // reading clears the register I always read n at 0x01 when in the debugger any idea?

— 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/47, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qiMvOunY0NDh1gewY2K4QOqkPTl7ks5vE0sqgaJpZM4aJODp .

Julspower commented 5 years ago

The event status register never report quaterions data I did not try to read the quat register (even if no new data is reported) Ram version 1 and 2 are: 0xAE, 0x23

kriswiner commented 5 years ago

RAM version should be 0x17435 if the EEPROM is being properly read as here (scroll down):

https://github.com/kriswiner/EM7180_SENtral_sensor_hub/wiki/C.-Managing-the-Configuration-File

Do you see the EM7180 on the I2C bus at 0x28?

Is it in normal (master) mode?

It should read the EEPROM automatically in master mode and the code should wurey the ROM, RAM versions as well as the products and revision IDs to be sure of proper communication between HOST and EM7180 and between EM7180 and EEPROM.

On Sat, Jan 19, 2019 at 2:33 PM Julspower notifications@github.com wrote:

The event status register never report quaterions data I did not try to read the quat register (even if no new data is reported) Ram version 1 and 2 are: 0xAE, 0x23

— 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/47#issuecomment-455820800, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qtkfecNwKrQgQoWB6PlBRe3jHx9Qks5vE50pgaJpZM4aJODp .

Julspower commented 5 years ago

Yes I see it at 0x28 the status bit tell me the eeprom has been loaded: EM7180_SentralStatus 0x01 != 0 I do set EM7180_HostControl to 0x01 and read it back to 0x01, but after the bit cpureset has been set it return to 0x00

cRam1 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion1);
cRam2 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion2);
//wait EEPROM
n = wiringPiI2CReadReg8(ni2cFD, EM7180_SentralStatus);
while((n & 0x01) == 0)
{
    QThread::msleep(250);
    n = wiringPiI2CReadReg8(ni2cFD, EM7180_SentralStatus);
}
cRam1 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion1);
cRam2 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion2);

here the first time I read cRam1 and 2 they are at 0 the second time I read 0xAE23

how could ram version be 0x17435 since its 2 bytes long? ProductID = 0x80 RevisionID = 0x02 Could it be a wrong eeprom config? EM7180_SentralStatus gets to 0x03 but I never have the 0x08 bit (initialized)

my I2C clock between host and SENtral is 400khz

Edit: interesting fact: When I reset the SENtral with the resetrequest register and I wait 1.5Sec then read sentralstatus its at 0x0b Then I set hostcontrol at 0 passthrucontrol at 0 then hostcontrol back to 0x01 now the sentralstatus is 0x03 even if I wait 1 minutes stays at 0x03

kriswiner commented 5 years ago

void USFS::getChipID() { // Read SENtral device information uint16_t ROM1 = _i2c_bus->readByte(EM7180_ADDRESS, EM7180_ROMVersion1); uint16_t ROM2 = _i2c_bus->readByte(EM7180_ADDRESS, EM7180_ROMVersion2); Serial.print("EM7180 ROM Version: 0x"); Serial.print(ROM1, HEX); Serial.println(ROM2, HEX); Serial.println("Should be: 0xE609"); uint16_t RAM1 = _i2c_bus->readByte(EM7180_ADDRESS, EM7180_RAMVersion1); uint16_t RAM2 = _i2c_bus->readByte(EM7180_ADDRESS, EM7180_RAMVersion2); Serial.print("EM7180 RAM Version: 0x"); Serial.print(RAM1); Serial.println(RAM2); uint8_t PID = _i2c_bus->readByte(EM7180_ADDRESS, EM7180_ProductID); Serial.print("EM7180 ProductID: 0x"); Serial.print(PID, HEX); Serial.println(" Should be: 0x80"); uint8_t RID = _i2c_bus->readByte(EM7180_ADDRESS, EM7180_RevisionID); Serial.print("EM7180 RevisionID: 0x"); Serial.print(RID, HEX); Serial.println(" Should be: 0x02"); }

RAM versionhould return 17435 int which is AE23 hex,

so all looks OK.

Looks like you are having trouble with your I2C. Can you get some other I2C sensor to work?

On Sun, Jan 20, 2019 at 7:56 AM Julspower notifications@github.com wrote:

Yes I see it at 0x28 the status bit tell me the eeprom has been loaded: EM7180_SentralStatus 0x01 != 0 I do set EM7180_HostControl to 0x01 and read it back to 0x01, but after the bit cpureset has been set it return to 0x00

` cRam1 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion1); cRam2 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion2);

//Attend l'EEPROM n = wiringPiI2CReadReg8(ni2cFD, EM7180_SentralStatus); while((n & 0x01) == 0) { QThread::msleep(250); n = wiringPiI2CReadReg8(ni2cFD, EM7180_SentralStatus); } cRam1 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion1); cRam2 = wiringPiI2CReadReg8(ni2cFD, EM7180_RAMVersion2);

` here the first time I read cRam1 and 2 they are at 0 the second time I read 0xAE23

ProductID = 0x80 RevisionID = 0x02 Could it be a wrong eeprom config?

my I2C clock between host and SENtral is 400khz

— 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/47#issuecomment-455877924, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qgLB1IVpkGNuzdH1iQ_emZ7Ss-Qjks5vFJGjgaJpZM4aJODp .

Julspower commented 5 years ago

Found out that This works Must be my initialization that caused problem