Hi All,
I am using a BNO080 on a custom board over SPI using an STM32F103 which is not completely responding as expected. I have ordered the SparkFun board for testing I2C but I will have that after 2 weeks. I hope there is someone who can think with me to find a possible solution.
I have the BNO080 and MPU9250 on the same SPI bus. MPU9250 in fully working as expected and from the BNO080 I am also receiving some expected data. In that sense I can say that the SPI bus is working fine.
Besides that I have the WAKE, RESET and INT pins in use for the BNO080.
As I am not using arduino sketch and I am programming in C, I took the SparkFun library and took parts that I need for getting it work. Then I print out the messages I am receiving and sending for debugging.
Here I have a schematic of how I connected the BNO080:
Here is the code for start-up. Where I reset the device and try to request the feature command:
void BNO080_Reset(void)
{
uint8_t SendData[1];
SendData[0] = 1; //Reset
// Do a Hard reset, then receive all data
BNO080_Wake_High();
BNO080_Reset_Low();
delay100u(500);
BNO080_Reset_High();
delay100u(5000);
while( BNO080_ReceivePacket() )
{
BNO080_ReceivePacket();
delay100u(3000);
}
while( BNO080_Interrupt_Pin() );
while( BNO080_ReceivePacket() )
{
BNO080_ReceivePacket();
delay100u(3000);
}
// Wakeup sensor and send a Soft reset, then receive all data
BNO080_NeedWakeup = 1;
BNO080_SendPacket(BNO080_CHANNEL_EXECUTABLE, SendData, 1); //Transmit packet on channel 1, 1 byte
delay100u(5000);
while( BNO080_ReceivePacket() )
{
BNO080_ReceivePacket();
delay100u(3000);
}
while( BNO080_Interrupt_Pin() );
while( BNO080_ReceivePacket() )
{
BNO080_ReceivePacket();
delay100u(3000);
}
// Random delay for testing
delay100u(20000);
// Wakeup sensor and send feature request
BNO080_NeedWakeup = 1;
BNO080_EnableRawAccelerometer(20);
}
Below I show the log of what I receive in the terminal. "IN xx: " means xx received bytes and "OUT xx: " means xx amount of bytes sent out. The data bytes are represented in Decimal. Data length above 100 are not printed on the terminal.
Below I have added comments in brackets to explain the response from the BNO080.
(From a HARD reset I receive the expected data twice)
IN 276:
IN 20: 20 0 2 0 241 0 132 0 0 0 1 0 0 0 0 0 0 0 0 0
IN 5: 5 0 1 0 1
IN 276:
IN 20: 20 0 2 0 241 0 132 0 0 0 1 0 0 0 0 0 0 0 0 0
IN 5: 5 0 1 0 1
(I send a SOFT reset and I receive the expected data twice)
OUT 5: 5 0 1 0 1
IN 276:
IN 20: 20 0 2 0 241 0 132 0 0 0 1 0 0 0 0 0 0 0 0 0
IN 5: 5 0 1 0 1
IN 276:
IN 20: 20 0 2 0 241 0 132 0 0 0 1 0 0 0 0 0 0 0 0 0
IN 5: 5 0 1 0 1
(I send a feature command request for RAW acc data)
OUT 21: 21 0 2 0 253 20 0 0 0 32 78 0 0 0 0 0 0 0 0 0 0
I am not sure why I receive the data twice after a reset.
After I send a feature command I expect to have the INT pin getting LOW and having me receive all the RAW data from the BNO080.
Also I need to get the sensor out of a sleep state. I do see it is noticed in the datasheet but I do not see this action in the SparkFun library.
The datasheet is stating the following about a startup sequence:
After the Reset function is finished I call BNO080_ReceivePacket(); every 1 mS and it will check for the INT pin to be pulled LOW.
Does anyone have an idea why I am not getting any acceleration data from the sensor?
Thank you in advance.