08-29-2019 09:55 PM
I ran the self test from the BMP3-Sensor-API library and the response I am getting is BMP3_TRIMMING_DATA_OUT_OF_BOUND, because function validate_trimming_param() failed which is the CRC check on the calibration parameters. This agrees with the strange temp/pressure values I am seeing come from the `bmp3_get_sensor_data()` API. These calibration values are set at manufacturing time I gather, so what can I do about this?
https://github.com/BoschSensortec/BMP3-Sensor-API/blob/master/self-test/bmp3_selftest.c
08-30-2019 10:16 AM
The trimming values are set at the time of manufacture and stored in the sensor for the following compensation calculations.
Could you please share your trimming data so that we can look into it?
08-30-2019 02:36 PM
(I'm answeirng for Joem since he's out for a long weekend)
The following is the `calib_data`, as received during initialization. I verified over two reboots that the data was consistent:
```
000005.468,I,BMP388,get_calib_data results:
00 DD 6A 51 49 F6 C9 00 1E F6 23 00 55 61 CA 77 F3 F6 A3 3F 16
```
Is this the right data?
The code used to print the above data is copied below:
```
static int8_t get_calib_data(struct bmp3_dev *dev)
{
int8_t rslt;
uint8_t reg_addr = BMP3_CALIB_DATA_ADDR;
/* Array to store calibration data */
uint8_t calib_data[BMP3_CALIB_DATA_LEN] = { 0 };
/* Read the calibration data from the sensor */
rslt = bmp3_get_regs(reg_addr, calib_data, BMP3_CALIB_DATA_LEN, dev);
LOG_C_INFO("BMP388", "get_calib_data results: ");
for(int idx = 0; idx < BMP3_CALIB_DATA_LEN; idx++) {
LOG_C_INFO_BASIC("%02X ", (unsigned int) calib_data[idx]);
}
LOG_C_INFO_BASIC("\n");
/* Parse calibration data and store it in device structure */
parse_calib_data(calib_data, dev);
return rslt;
}
```
08-30-2019 02:49 PM
Here is it run again, but printing the parsed information
000007.974,I,BMP388,get_calib_data results:
00 DD 6A 51 49 F6 C9 00 1E F6 23 00 55 61 CA 77 F3 F6 A3 3F 16
000008.055,I,BMP388,get_calib_data parsed results:
000008.059,I,BMP388,dev->calib_data.reg_calib_data.par_p1: -13834
000008.063,I,BMP388,dev->calib_data.reg_calib_data.par_p2: 7680
000008.067,I,BMP388,dev->calib_data.reg_calib_data.par_p3: -10
000008.072,I,BMP388,dev->calib_data.reg_calib_data.par_p4: 35
000008.076,I,BMP388,dev->calib_data.reg_calib_data.par_p5: 21760
000008.080,I,BMP388,dev->calib_data.reg_calib_data.par_p6: 51809
000008.084,I,BMP388,dev->calib_data.reg_calib_data.par_p7: 119
000008.088,I,BMP388,dev->calib_data.reg_calib_data.par_p8: -13
000008.092,I,BMP388,dev->calib_data.reg_calib_data.par_p9: -23562
000008.096,I,BMP388,dev->calib_data.reg_calib_data.par_p10: 63
000008.100,I,BMP388,dev->calib_data.reg_calib_data.par_p11: 22
Code to produce this is:
static int8_t get_calib_data(struct bmp3_dev *dev)
{
int8_t rslt;
uint8_t reg_addr = BMP3_CALIB_DATA_ADDR;
/* Array to store calibration data */
uint8_t calib_data[BMP3_CALIB_DATA_LEN] = { 0 };
/* Read the calibration data from the sensor */
rslt = bmp3_get_regs(reg_addr, calib_data, BMP3_CALIB_DATA_LEN, dev);
LOG_C_INFO("BMP388", "get_calib_data results: ");
for(int idx = 0; idx < BMP3_CALIB_DATA_LEN; idx++) {
LOG_C_INFO_BASIC("%02X ", (unsigned int) calib_data[idx]);
}
LOG_C_INFO_BASIC("\n");
/* Parse calibration data and store it in device structure */
parse_calib_data(calib_data, dev);
LOG_C_INFO("BMP388", "get_calib_data parsed results: ");
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p1: %d", (int) dev->calib_data.reg_calib_data.par_p1);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p2: %d", (int) dev->calib_data.reg_calib_data.par_p2);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p3: %d", (int) dev->calib_data.reg_calib_data.par_p3);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p4: %d", (int) dev->calib_data.reg_calib_data.par_p4);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p5: %u", (int) dev->calib_data.reg_calib_data.par_p5);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p6: %u", (int) dev->calib_data.reg_calib_data.par_p6);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p7: %d", (int) dev->calib_data.reg_calib_data.par_p7);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p8: %d", (int) dev->calib_data.reg_calib_data.par_p8);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p9: %d", (int) dev->calib_data.reg_calib_data.par_p9);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p10: %d", (int) dev->calib_data.reg_calib_data.par_p10);
LOG_C_INFO("BMP388", "dev->calib_data.reg_calib_data.par_p11: %d", (int) dev->calib_data.reg_calib_data.par_p11);
return rslt;
}
09-06-2019 02:43 PM
shellywang, any luck with these numbers?