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.
08-12-2021 10:50 PM
Issue resolved. The I2C writes needed two bytes at a time, address and data value, instead of sequential writes with one byte at a time, alternating between register address and value. Stated in the datasheet but I just took the wrong implementation with the Nordic SDK I2C write function.
08-13-2021 03:55 AM
Hello Value_Judgement,
Good news.
Yes, I2C write and read had different time sequence.
04-08-2022 02:05 PM
Hi, I've got the same problme. Please, could you share the commn.c file where you have written the read write i2c functions?
I'm sorry to ask, but I cannot resolve the problem.
Thanks
04-08-2022 04:30 PM
Your common.c should be something similar to the API example but the problem is likely in your I2C write/read functions. Make sure you're actually writing and reading the right data to and from the right registers in the right format (page 46 in the datasheet).
04-08-2022 04:37 PM
Yeah, I have looked at pag 46 of the datasheet and I think I respect what they ask, but still not working.
Could you let me see your bme68x_i2c_write and bme68x_i2c_read functions, please? I do not know how to make them in a different way