BME688 sensor library for nRF52832

Hi,

I'm developing a project with nRF52832 and BOSH BME688 sensor.

I downloaded the library from github to use the sensor (here it is the link https://github.com/BoschSensortec/BME68x-Sensor-API).

I found a big problem: the libraries refer to another library, called coines, that is not included in the github repository, because it is a low level library specific for each microprocessor (here the explanation https://www.bosch-sensortec.com/software-tools/tools/coines/).

I try to download the installer but it creates a multiple other library that creates problem.

So, I was wondering if someone already has the coines.h and coines.c files to import in my project.

Thanks for helping.

Parents
  • Yes, I find out that I have to modify the following codes

    In particular, I have to replace all the elements that refer to coines with the specific function of nRF52832 (to adapt the generic library to the  microcontroller that I use)

    For example, I replace 

    coines_delay_usec(1000); with nrf_delay_us(1000);
    but for the other instructions I'm not sure or I do not know how to do; in particular for 
    coines_set_shuttleboard_vdd_vddio_config(3300, 3300);
    coines_config_spi_bus(COINES_SPI_BUS_0, COINES_SPI_SPEED_7_5_MHZ, COINES_SPI_MODE0);
    coines_soft_reset();
    coines_close_comm_intf(COINES_COMM_INTF_USB);
    Thanks for helping
Reply
  • Yes, I find out that I have to modify the following codes

    In particular, I have to replace all the elements that refer to coines with the specific function of nRF52832 (to adapt the generic library to the  microcontroller that I use)

    For example, I replace 

    coines_delay_usec(1000); with nrf_delay_us(1000);
    but for the other instructions I'm not sure or I do not know how to do; in particular for 
    coines_set_shuttleboard_vdd_vddio_config(3300, 3300);
    coines_config_spi_bus(COINES_SPI_BUS_0, COINES_SPI_SPEED_7_5_MHZ, COINES_SPI_MODE0);
    coines_soft_reset();
    coines_close_comm_intf(COINES_COMM_INTF_USB);
    Thanks for helping
Children
  • Andrea Rossi said:
    coines_set_shuttleboard_vdd_vddio_config(3300, 3300);

    The shuttleboard probably have a SW configurable power supply that you will not need to use. You do need to make sure that the BME688's VDDIO net is at the same voltage potential as the nRF52's VDD net. 

    Andrea Rossi said:
    coines_config_spi_bus(COINES_SPI_BUS_0, COINES_SPI_SPEED_7_5_MHZ, COINES_SPI_MODE0);

    You will have to replace this function with the nrfx_spim_init function. 

    Andrea Rossi said:
    coines_soft_reset();

    You need to read the definition of this function to figure out what it does and why.


    Andrea Rossi said:
    coines_close_comm_intf(COINES_COMM_INTF_USB);

    I don't think you need this at all. I assume it just disables a USB interface on the shuttleboard.


  • I think you're a bit off-track. The COINES thing seems to be some kind of C interface library for desktop PC's. 

    You should only need the bme68x.c, bme68x.h, and bme68x_defs.h I think. 

    From the bme68x_defs.h: 



    You need to create a bme68x_dev in the source file that will call the bme68x driver APIs, with the proper function pointers and data. This device is what the the functions in bme68x.c will use to call the appropriate low-level SPI driver calls, etc. 

  • Hi, Thanks for the help.

    After deeper search, I understand that I have to adapt the common.c file to the platform that I'm using, so I have to replace all the generic function (with coines) with the specific one for my microcontroller.

    For example, I replace

    BME68X_INTF_RET_TYPE bme68x_i2c_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
    {
        uint8_t dev_addr = *(uint8_t*)intf_ptr;
        return coines_write_i2c(dev_addr, reg_addr, (uint8_t *)reg_data, (uint16_t)len);
    }
    with 
    BME68X_INTF_RET_TYPE bme68x_i2c_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
    {
    uint8_t dev_addr = *(uint8_t*)intf_ptr;
    return nrf_drv_twi_tx(dev_addr, reg_addr, (uint8_t *)reg_data, (uint16_t)len, false);
    }
    (I hope that I put correctly the various parameters, if not, I would be very glad if you can tell me which are the correct ones).
    But I cannot understand how to replace this command
    coines_config_i2c_bus(COINES_I2C_BUS_0, COINES_I2C_STANDARD_MODE);
    I don't know if this information is important, but in my project I have already initialized the twi comunication for transmit data to other sensors.
  • Again, my advice is to chuck the whole COINES thing out the window as it does not seem to add anything useful for your project. The COINES framework is used to talk to bosch sensors from a PC via an MCU. If you don't need to do that you should not use that framework. 

    If you do need COINES for your project I suggest you ask Bosch for assistance in setting it up.

  • Yes, I have deleted the coines file to my project.

    Now I have to adapt the common file to nRF52832 in order to make the Bosch API working (I asked also help at Bosh assistance and they confirm).

    https://github.com/BoschSensortec/BME68x-Sensor-API/tree/master/examples/common

    Here there is the common file. I have to do that because some Bosch function are based on this file. So if I can adapt this file to nRF, also the Bosch API will work