08-17-2020 04:12 PM
Hello everyone, I have an error when I read BME680 the values never change and humidity is at 100 % but the read fonction return a zero which means everything ok. I don't know why it's not working I guess it's in my read and write functions but I don't find my mistake.
Here is my code : thank you for your time and have a good day.
NB : NRF_LOG is used for display like Serial.print in arduino.
err = nrf_drv_twi_rx(&m_twi, dev_id, tampon, len); : this function is like the Wire.request(tampon, len ) on arduino.
nrf_drv_twi_tx(&m_twi, dev_id, reg, len+1, false); : this function is like the Wire.begintransmission(dev_id) then wire.write(reg);
Solved! Go to Solution.
08-18-2020 12:44 AM
what is the chip_id read back from BME680 in the function BME680_init?
Maybe you can also post a logic anayzer pattern for better understanding.
08-18-2020 09:09 AM - edited 08-18-2020 09:31 AM
hello thank you for your answer the chip select is 97 :
below this is the information that I read on the serial for debugging. For this one I put a while(1) just after the init so I am not performing the read_data.
<info> app: TWI scanner started.
<info> app: write
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 97
<info> app: read
<info> app: read : len 25 :
<info> app: read : wire.available 25 :
<info> app: 0
<info> app: 129
<info> app: 103
<info> app: 3
<info> app: 0
<info> app: 55
<info> app: 141
<info> app: 42
<info> app: 215
<info> app: 88
<info> app: 0
<info> app: 92
<info> app: 13
<info> app: 228
<info> app: 255
<info> app: 23
<info> app: 30
<info> app: 0
<info> app: 0
<info> app: 214
<info> app: 254
<info> app: 25
<info> app: 242
<info> app: 30
<info> app: 162
<info> app: read
<info> app: read : len 16 :
<info> app: read : wire.available 16 :
<info> app: 62
<info> app: 202
<info> app: 50
<info> app: 0
<info> app: 45
<info> app: 20
<info> app: 120
<info> app: 156
<info> app: 65
<info> app: 103
<info> app: 223
<info> app: 249
<info> app: 196
<info> app: 18
<info> app: 127
<info> app: 0
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 22
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 51
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 227
<info> app: chip_id : 97 :
<info> app: write
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 0
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 0
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 0
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 0
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 0
<info> app: write
<info> app: read
<info> app: read : len 1 :
<info> app: read : wire.available 1 :
<info> app: 0
<info> app: write
<info> app: Rslt : 0
When I read the data.status after a read it displays data.status = 128, But I have a code working with arduino which should be exactly the same display a data.status : 160.
thank you
08-18-2020 08:23 PM - edited 08-18-2020 08:24 PM
In the log, i can find following information:
1. bme680_init execute:
a. read chip_id register successfully as 0x61 (97)
b. read calibration parameter page 1 successfully (25 bytes)
c. read calibration parameter page 2 successfully (16 bytes)
d. print out the chip id in your code
2. a while (1) is put just after this funciton and you keep read back as 0. which register you are reading here?
3. in our code, data->status = buff[0] & BME680_NEW_DATA_MSK; here BME680_NEW_DATA_MSK = 0x80. this is new data indicate. if status = 128, means there is new data available. it is read from register 0x1d. the value in 0x1d = 0xa0 (160) means new data available and measing is still going on. So actually 128 from data->status is expected value. And you should have value in corresponding data register.
08-19-2020 09:09 AM
Here is all the serial screen when I perform init and one reading :