01-07-2021 11:16 AM
Hello,
I am trying to get the BME680 working with the Bosch Lib and a PIC32MM0256GPM064.
I am able to read and write registers and see the correct values via printf's and on my logic analyzer.
If the example code is reading the sensor data via bme680_get_sensor_data the rslt is everytime BME680_W_NO_NEW_DATA.
I also tried it with a PIC18F46K42 and got the same problem (but different I2C code provided by MCC).
My code to verify the I2C functions:
user_i2c_read(0x77, 0xD0, buffer, 1);
printf("Read Reg 0x%X: 0x%X (0x61 expected)\n",(0xD0),buffer[0]);
user_delay_ms(100);
buffer[0] = 0x03;
user_i2c_write(0x77, 0x72, buffer, 1);
printf("writing 0x03 to 0x72...\n");
buffer[0] = 0x04;
user_i2c_write(0x77, 0x64, buffer, 1);
printf("writing 0x04 to 0x64...\n");
buffer[0] = 0x05;
user_i2c_write(0x77, 0x5A, buffer, 1);
printf("writing 0x05 to 0x5A...\n");
buffer[0] = 0x06;
user_i2c_write(0x77, 0x50, buffer, 1);
printf("writing 0x06 to 0x50...\n");
user_delay_ms(100);
buffer[0] = 0;
user_i2c_read(0x77, 0x72, buffer, 1); // read
printf("Read Reg 0x%X: 0x%X (0x03 expected)\n",(0x72),buffer[0]);
buffer[0] = 0;
user_i2c_read(0x77, 0x64, buffer, 1); // read
printf("Read Reg 0x%X: 0x%X (0x04 expected)\n",(0x64),buffer[0]);
buffer[0] = 0;
user_i2c_read(0x77, 0x5A, buffer, 1); // read
printf("Read Reg 0x%X: 0x%X (0x05 expected)\n",(0x5A),buffer[0]);
buffer[0] = 0;
user_i2c_read(0x77, 0x50, buffer, 1); // read
printf("Read Reg 0x%X: 0x%X (0x06 expected)\n",(0x50),buffer[0]);
Console output is:
Logic Analyzer:
Looks good for me.
But if I let the example code running, BME680_W_NO_NEW_DATA is the result.
If I let it run once and then read out the wait and heat registers there are wrong (but constant) numbers in.
What could I do? Is my verification correct?
Thanks!
01-27-2021 03:47 AM
Hi Sir:
Reading your code of your write function, according to the related comments, I have not found any errors.
Do you mean you hope us to offer the logic plot?
Please confirm the related whole source code of BME680 API operation again, I will re-check it and capture the logic plot to share with you.