Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 SPI with NRF52

    BMI270 SPI with NRF52

    MESS
    New Poster

    Hello i cant use BMI270 with NRF52. Pleas Help me. Cannt found any thıng. 
    here my code.

    BMI2_INTF_RETURN_TYPE bmi2_spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr)
    {
    (void)(intf_ptr);
    static uint8_t txarr[500];
    uint8_t rxarr[500];
    txarr[0] = 0x80 | reg_addr;

    nrf_drv_spi_transfer(&spi, &txarr[0], 1, rxarr, len+1 );

    for (int i = 0; i < len+1; i++)
    {
    *(reg_data + i) = rxarr[i+1];
    }

    return BMI2_INTF_RET_SUCCESS;
    }


    BMI2_INTF_RETURN_TYPE bmi2_spi_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
    {
    (void)(intf_ptr);
    volatile static uint8_t txarr[5000];
    txarr[0] = reg_addr;
    for (uint8_t i = 0; i < len; i++)
    {
    txarr[i + 1] = *(reg_data + i);
    }

    nrf_drv_spi_transfer(&spi, &txarr[0], (uint16_t)len + 1 , (void *)0, 0);
    return BMI2_INTF_RET_SUCCESS;
    }void bmi2_delay_us(uint32_t period, void *intf_ptr)
    {
    nrf_delay_us(period);
    }

    4 REPLIES 4

    Minhwan
    Community Moderator
    Community Moderator

    Hi Mess, 

     

    I saw your msg in different loop. You got -9 error correct? 

    That means when you downloaded config file, there is some issue. 

    I assume your read write length is not enough for our default length 46. 

    Could you go common.c and change READ_WRITE_LEN value as 8? 

    Also, it would be great if you capture and share it to me. 

    Thank you. 

    Hello Minhwan 

    do you mean #define READ_WRITE_LEN UINT8_C(8) here?

    i  do but stil same 😞 

    i add picture. please help me 

    thank you for your ansver.

    Minhwan
    Community Moderator
    Community Moderator

    Hi @MESS , 

     

    Sorry for late response. 

    Did you solve your issue? If not, could you capture your data and share it with me? 

    Thank you. 

    Merhaba Minhwan 

    hala bu sorunu yaşıyorum.

    Hata [-9] : Yapılandırma yükleme hatası. Konfigürasyonun sensöre yüklenmesi sırasında arıza gözlemlendiğinde meydana gelir.

    BMI270-Sensor-API kütüphanelerini  kullanıyorum  

    Tüm kodlarımı ekliyorum. 

    ve bu benim yazma ve okuma işlevlerim.

    BMI2_INTF_RETURN_TYPE bmi2_spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr)
    {
    (void)(intf_ptr);
    statik uint8_t txarr[500];
    uint8_t rxarr[500];
    txarr[0] = 0x80 | reg_addr;

    nrf_drv_spi_transfer(&spi, &txarr[0], 1, rxarr, len+1 );

    for (int i = 0; i < len+1; i++)
    {
    *(reg_data + i) = rxarr[i+1];
    }

    BMI2_INTF_RET_SUCCESS'i döndür;
    }

    /*!
    * SPI fonksiyon haritasını COINES platformuna yazar
    */
    BMI2_INTF_RETURN_TYPE bmi2_spi_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
    {
    (void)(intf_ptr);
    uçucu statik uint8_t txarr[500];
    txarr[0] = reg_addr;
    for (uint8_t i = 0; i < len; i++)
    {
    txarr[i + 1] = *(reg_data + i);
    }

    nrf_drv_spi_transfer(&spi, &txarr[0], (uint16_t)len + 1 , (void *)0, 0);
    BMI2_INTF_RET_SUCCESS'i döndür;
    }

     

    Bana yardım için teşekkür ederim 🙂

     

    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