Hi Rosso9,
Could you get chip ID?
And did all code run successfully before you call bme68x_get_data()?
This code is in example, please compare your code if it correct?
I2C write:
uint16_t DevAddress = dev_addr << 1;
I2C read:
GTXBuffer[0] = subaddress | 0x80;
Hi,
Yes I can get chip ID and it is 0x61.
Yes, before I call bme68x_get_data() everything is ok. The output, indeed, is:
API name [bme68x_interface_init]: All ok
API name [bme68x_init]: All ok
API name [bme68x_set_conf]: All ok
chip id 0x61
API name [bme68x_set_heatr_conf]: All ok
Sample, TimeStamp(ms), Temperature(deg C), Pressure(Pa), Humidity(%), Gas resistance(ohm), Status
API name [bme68x_set_op_mode]: All ok
API name [bme68x_get_data] Warning [2] : No new data found
API name [bme68x_set_op_mode]: All ok
API name [bme68x_get_data] Warning [2] : No new data found
I2C write: uint16_t DevAddress = dev_addr << 1; I try to add this line to the code but the output does not change
I2C read: GTXBuffer[0] = subaddress | 0x80; I also try to use it, but also in this case the output does not change. (I have not used this line before because in the example you sent me, this line is in the SPI function)
Hi Rosso9,
You can debug read_field_data() function with single step, see that the read data is incorrect. And capture the communication waveform with the logic analyzer to see whether the actual data is correct.
Hi, thanks again.
At the moment, I do not have a logic analyzer. However, I try to understood which is the problem in the function. The problem is during function bme68x_get_data, when it goes to function read_field_data.
In function read_field_data this happens:
- it enters in the while at line 1211 and does bme68x_get_regs correctly. It obtains the following values in buff.
buff[0]: 12
buff[1]: 93
buff[2]: 236
buff[3]: 30
buff[4]: 134
buff[5]: 141
buff[6]: 0
buff[7]: 0
buff[8]: 0
buff[9]: 0
buff[10]: 0
buff[11]: 0
buff[12]: 0
buff[13]: 0
buff[14]: 0
buff[15]: 51
buff[16]: 0
- then it calculates data->status: data->status = buff[0] & BME68X_NEW_DATA_MSK; The result of this operation is zero, and so it does not enter in the following if at line 1243
(I have no modified the bme68x.c file)
Hi Rosso9,
The data is not normal.
It seemed that you didn't refer to the example code completely. When I run the reference code, I couldn't reproduce your problem.
Suggest you refer to the example code completely, and test it again.