07-13-2021 03:31 PM
Hi Bosch Sensortech Community
I'm struggling to interface the BME680 chip with the nRF52840 using the BME680 API and the BSEC library.
At first I only used the BME680 API, which resulted in the BME680_W_NO_NEW_DATA status when trying to read the measurement results.
I then saw that there was a newer version of the BME680 API (the BME68x API). Tried that and got the same results.
I then tried using the BME680 API along with the BSEC library, hoping that this will solve my problem, but still got the same result - BME680_W_NO_NEW_DATA .
To my knowledge my I2C functions are correct as I was checking on a digital osccilloscope to sort out initial I2C errors and I'm also not getting any errors when initialising the BME680 API and BSEC library.
I have attached my code as reference.
Any assistance would be much appreciated.
Regards,
Charl
Solved! Go to Solution.
07-14-2021 05:04 AM
Hello CharlMN,
There was reference code in another ticket: https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-with-BSEC-produces-on-0-0s-even-a...
For your code, you need to check I2C write and read function. Move the I2C address one bit to the left, and refer to the I2C timing in data sheet.
int8_t SensorAPI_I2Cx_Read(uint8_t slave_address7, uint8_t subaddress, uint8_t *pBuffer, uint16_t ReadNumbr)
{
uint16_t DevAddress = slave_address7 << 1;
...
}
int8_t SensorAPI_I2Cx_Write(uint8_t slave_address7, uint8_t subaddress, uint8_t *pBuffer, uint16_t WriteNumbr)
{
uint16_t DevAddress = slave_address7 << 1;
...
}
07-14-2021 10:04 AM
Morning BSTRobin
Thank you for your response.
I have checked this before by shifting the address left by one bit, that is why I'm quite certain that the I2C write function is working. When I do shift the address left by one bit, the device will give an error when trying to initialise the BME680 API (BME680_E_DEV_NOT_FOUND). The nsI2C_REG_WRITE function in my code calls other internal write functions, which shifts the address.
I have added images below to show that the nsI2C_REG_WRITE function is working, showing the Soft Reset command write and the ACKs that I'm receiving.
I will check if the stack size is maybe also causing my issue as you mentioned in the post that you referenced and I'm double checking that my I2C write and read functions are correct, especially when it comes to multi-byte writes and reads.
Will revert back on this.
BR,
Charl
07-14-2021 10:18 AM
Hi BSTRobin
Also, to check if my multi-byte reads are correct, can you confirm that the calibration parameters are correct that was read back from the chip?
BR,
Charl
07-14-2021 02:33 PM
Hi BSTRobin
Apologies, you would be able to see from the two scope images that my I2C write funtion was not correct. It added a second start condition between the register address and data value.
I fixed it and now I am successfully receiving the measurement data from the BME680 sensor.
Thank you for your assistance.
BR,
Charl