Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME680 with a bit-banging SPI

    BME680 with a bit-banging SPI

    Xt4ckl3
    New Poster

    Hi there,

    I'm using a standard BME680 breakout board on the Arduino Nano 33 IoT and we're trying to get the sensor to run with the Bsec software. 

    Previously I used Adafruit's Library, which provided an easy virtual SPI interface, so I was free to choose any digital port for SPI. However, the BSec software requires an SPIClass parameter, but the default hardware SPI is unavailable.

    Is there a simple way to use bit-banging SPI together with the Bsec library?

     

    Thanks!

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Hello Xt4ckl3,

    Actually, BSEC software is very portable for software architecture. You could see SPI related interface functions in "examples\bsec_iot_example.c", it is not bound to the hardware platform. No matter what your hardware platform is, you only need to implement the functions in the read, write interface function according to the hardware platform you use.

    /*!
    * @brief Write operation in either I2C or SPI
    *
    * param[in] dev_addr I2C or SPI device address
    * param[in] reg_addr register address
    * param[in] reg_data_ptr pointer to the data to be written
    * param[in] data_len number of bytes to be written
    *
    * @return result of the bus communication function
    */
    int8_t bus_write(uint8_t dev_addr, uint8_t reg_addr, uint8_t *reg_data_ptr, uint16_t data_len)
    {
    // ...
    // Please insert system specific function to write to the bus where BME680 is connected
    // ...
    return 0;
    }

    /*!
    * @brief Read operation in either I2C or SPI
    *
    * param[in] dev_addr I2C or SPI device address
    * param[in] reg_addr register address
    * param[out] reg_data_ptr pointer to the memory to be used to store the read data
    * param[in] data_len number of bytes to be read
    *
    * @return result of the bus communication function
    */
    int8_t bus_read(uint8_t dev_addr, uint8_t reg_addr, uint8_t *reg_data_ptr, uint16_t data_len)
    {
    // ...
    // Please insert system specific function to read from bus where BME680 is connected
    // ...
    return 0;
    }

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist