BME68x_SensorAPI icon indicating copy to clipboard operation
BME68x_SensorAPI copied to clipboard

Endless loop in bme68x_set_op_mode

Open emArts-IoT opened this issue 2 years ago • 2 comments

When the device cannot be set to sleep mode (for whatever reason) the function never returns.

do { } while ((pow_mode != BME68X_SLEEP_MODE) && (rslt == BME68X_OK));

emArts-IoT avatar Dec 29 '22 18:12 emArts-IoT

@emArts-IoT , can you provide more details about the issue you are facing and the steps to reproduce it. In case the write functions are not working as expected, the code can get stuck in an endless loop.

kgoveas avatar Jan 02 '23 09:01 kgoveas

I know this is an older issue, but I ran into the same issue, and wanted to explain how I fixed it.

In my case, the write function was not to blame. It seemed to be that the read function is trying to read from register 0xF4 instead of 0x74, which has one bit different. After digging through the library a bit, this seems to be related to the SPI bus paging, but I am using I2C. I realized that I forgot to set the data device data structure to use the I2C interface instead of the SPI one. @emArts-IoT You might want to double check that you did not make the same mistake that I did.

@kgoveas It might be useful for the library to have a limit for the number of retries, and once it reaches that it outputs an error, so that the system does not get stuck in an endless loop in the library, which can be a little bit harder to trace down.

marsfan avatar Dec 17 '23 05:12 marsfan