Nordic NRF52 with Bosch BMP3

Hello,

I am trying to get sensor readings from the BMP384 on a Nordic NRF52 chip. I am using segger embedded studio, as well as the Bosch libraries (bmp3.c, bmp3.h, bmp3_defs.h). Additionally I have intgreated the COINES common.c, and common.h libraries into the enviroment so I can use Bosch's starter code and examples.

I am currently trying to run the read_sensor_data example: https://github.com/BoschSensortec/BMP3-Sensor-API/blob/master/examples/read_sensor_data/read_sensor_data.c

I am running into an issue where the status.intr.drdy value is never enabled. I have force enabled the value but this only reads static values.

My code github link is posted here: https://github.com/kbaseba/glider/tree/master

I am also running into what I think is another issue. In the bmp3.c file, after the data is read through i2c and returns succesfully, the code still enters the communication error if case. This is shown below:

        else
        {
            /* Read the data using I2C */
            dev->intf_rslt = dev->read(reg_addr, reg_data, len, dev->intf_ptr);
        }

        /* Check for communication error */
        if (dev->intf_rslt != BMP3_INTF_RET_SUCCESS)
        {
            rslt = BMP3_E_COMM_FAIL;
        }

 My wrapper function for the coines common.c i2c read function is shown below:

BMP3_INTF_RET_TYPE bmp3_i2c_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr)
{
    uint8_t dev_addr = *(uint8_t*)intf_ptr; 
    ret_code_t ret_code;
    ret_code = nrf_drv_twi_tx(&m_twi, dev_addr, ®_addr, 1, false);
    if(ret_code != NRF_SUCCESS)
    {
        return ret_code;
    }

    ret_code = nrf_drv_twi_rx(&m_twi, dev_addr, reg_data, len);
    if (ret_code == NRF_SUCCESS) 
        return BMP3_INTF_RET_SUCCESS;
    else 
        return 1;
}

This consistently returns succesfully with no errors, but somehow the code still enters the communication error case check.

Any help with this issue would be very appreciated.

Thank you!

3 replies