kriswiner/EM7180_SENtral_sensor_hub

CpuReset

Closed this issue · 6 comments

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?

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

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

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