07-27-2021 06:57 AM
I'm using the BM68X API to read data off of a BME688 via a Nordic nRF52840 development kit. The only major changes to the code are the I2C initialization, read, and write functions as well as the delay function. Otherwise the code is mostly the same from the API using the force mode example. However, I'm not able to receive data from the sensor and a no new data error is thrown.
Below is the terminal output for the various steps to initialize the sensor and attempt to read data. For sequential reads and writes, the index (M) as well as the register and data is written to the terminal. The I2C interface seems to be working but I can't quite tell what the source of the problem is.
So far I've been able to make the BME280 API work with similar write, read, and delay functions and checked all the logic with a logic analyzer but I'm not sure what to try next. My only concern is that I can't implement a multi-byte read because of limitations with the interface, maximum of 3 bytes, so I just use individual 1 byte reads. This is sufficient for the BME280 API but maybe not the BME68X API.
---Interface init.---
I2C Interface
---BME68X init.---
---Soft reset---
----I2C write----
Length: 1
Reg addr e0 - Data b6
----I2C Read----
Reg addr d0
Length: 1
Reg data: M: 0 - Data 61
----I2C Read----
Reg addr f0
Length: 1
Reg data: M: 0 - Data 1
---Get calibration---
---Cal: get regs1---
----I2C Read----
Reg addr 8a
Length: 23
Reg data: M: 0 - Data 17
Reg data: M: 1 - Data 67
Reg data: M: 2 - Data 3
Reg data: M: 3 - Data 0
Reg data: M: 4 - Data 70
Reg data: M: 5 - Data 8c
Reg data: M: 6 - Data 88
Reg data: M: 7 - Data d7
Reg data: M: 8 - Data 58
Reg data: M: 9 - Data 0
Reg data: M: 10 - Data 86
Reg data: M: 11 - Data 29
Reg data: M: 12 - Data eb
Reg data: M: 13 - Data fe
Reg data: M: 14 - Data 1d
Reg data: M: 15 - Data 1e
Reg data: M: 16 - Data 0
Reg data: M: 17 - Data 0
Reg data: M: 18 - Data d2
Reg data: M: 19 - Data fb
Reg data: M: 20 - Data 56
Reg data: M: 21 - Data f3
Reg data: M: 22 - Data 1e
---Cal: get regs2---
----I2C Read----
Reg addr e1
Length: 14
Reg data: M: 0 - Data 3e
Reg data: M: 1 - Data 2c
Reg data: M: 2 - Data 35
Reg data: M: 3 - Data 0
Reg data: M: 4 - Data 2d
Reg data: M: 5 - Data 14
Reg data: M: 6 - Data 78
Reg data: M: 7 - Data 9c
Reg data: M: 8 - Data 68
Reg data: M: 9 - Data 66
Reg data: M: 10 - Data e5
Reg data: M: 11 - Data e8
Reg data: M: 12 - Data c5
Reg data: M: 13 - Data 12
---Cal: get regs3---
----I2C Read----
Reg addr 0
Length: 5
Reg data: M: 0 - Data 2a
Reg data: M: 1 - Data aa
Reg data: M: 2 - Data 16
Reg data: M: 3 - Data 4b
Reg data: M: 4 - Data 3
---Set Config.---
---Get op mode---
----I2C Read----
Reg addr 74
Length: 1
Reg data: M: 0 - Data 0
---Set op mode---
----I2C Read----
Reg addr 74
Length: 1
Reg data: M: 0 - Data 0
---Get regs---
----I2C Read----
Reg addr 71
Length: 5
Reg data: M: 0 - Data 0
Reg data: M: 1 - Data 0
Reg data: M: 2 - Data 0
Reg data: M: 3 - Data 0
Reg data: M: 4 - Data 0
---Set regs2---
----I2C write----
Length: 9
M: 0 - Reg addr 71 - Data 80
M: 1 - Reg addr 72 - Data 5
M: 3 - Reg addr 73 - Data 0
M: 5 - Reg addr 74 - Data 44
M: 7 - Reg addr 75 - Data 0
---Heater Config---.
Set op mode
----I2C Read----
Reg addr 74
Length: 1
Reg data: M: 0 - Data 0
----I2C write----
Length: 1
Reg addr 5a - Data 6a
----I2C write----
Length: 1
Reg addr 64 - Data 59
----I2C Read----
Reg addr 70
Length: 2
Reg data: M: 0 - Data 0
Reg data: M: 1 - Data 0
Set regs
----I2C write----
Length: 3
M: 0 - Reg addr 70 - Data 8
M: 1 - Reg addr 71 - Data 0
---Set op mode---
----I2C Read----
Reg addr 74
Length: 1
Reg data: M: 0 - Data 0
---Already asleep---
----I2C write----
Length: 1
Reg addr 74 - Data 1
Sample, TimeStamp(ms), Temperature(deg C), Pressure(Pa), Humidity(%), Gas resistance(ohm), Status
Read field data
----I2C Read----
Reg addr 1d
Length: 17
Reg data: M: 0 - Data 0
Reg data: M: 1 - Data 0
Reg data: M: 2 - Data 80
Reg data: M: 3 - Data 0
Reg data: M: 4 - Data 0
Reg data: M: 5 - Data 80
Reg data: M: 6 - Data 0
Reg data: M: 7 - Data 0
Reg data: M: 8 - Data 80
Reg data: M: 9 - Data 0
Reg data: M: 10 - Data 80
Reg data: M: 11 - Data 0
Reg data: M: 12 - Data 0
Reg data: M: 13 - Data 0
Reg data: M: 14 - Data 4
Reg data: M: 15 - Data 0
Reg data: M: 16 - Data 4
API name [bme68x_get_data] Warning [2] : No new data found
Solved! Go to Solution.
07-27-2021 07:39 AM
Hello Value_Judgement,
There was MCU reference code in another ticket, you could refer it from here:https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-with-BSEC-produces-on-0-0s-even-a...
08-04-2021 05:38 PM
I doubled the stack size but the problem persisits.
When data is written to registers, how much permenance do they have? I've tried reading back the same written values just after they're written but I don't ncessarily get the same values back. There's delays associated with printing out the text but I'm not sure if written values last for milliseconds, seconds, or stay until they're changed.
08-11-2021 10:42 AM
Hello Value_Judgement,
For "I've tried reading back the same written values just after they're written but I don't ncessarily get the same values back.", first you should check your I2C read, write function, and second you should ensure that the registers being operated have read and write permissions.
08-11-2021 07:07 PM
I've been able to verify that all the I2C writes are correct using a logic analyzer, see attached PDF. And I can take the same read, write, and delay functions to the BME280 API and that code works correctly. The only difference between the two is that the write function for the 688 account for multiple writes to different addresses.
Upon reviewing the registers, some of the writes are to bit positions that are reserved. Example:
M: 0 - Reg addr 0x71 - Data 0x80 (0b10000000)
Register 0x71 is reserved for bits 5, 6 , and 7 but I haven't changed any of the configuration settings and they're copied verbatim from the forced mode example code.
Can you provide an example of the I2C writes and reads for that example so I can compare?