Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    SPI interface with bhi260ap and ATSAMD51 MCU

    SPI interface with bhi260ap and ATSAMD51 MCU

    rajesh_s
    Established Member

    Hi,

    I am using bhi260ap IMU for my project from command line as well as low level interface i can able to communicate with imu via I2C, but if i try to do the same with SPI i couldn't able to do it with either way.please help me with this issue.

    Steps followed:

    1.Directly connected IMU sensor with MCU which is having 1.8V as supply and communication voltage(Not working).
    2.Using a level shifter, connected 3.3V supply MCU to IMU. connected MISO,MOSI,SCK,SS and VDD,VDDIO(1.8V given) and ground connected(Not working).

    NOTE: Above two steps are working fine with I2C interface with their respective connections.

    We have gone through the entire Datasheet and still this issue persisit. Is there any other connection required for SPI?

    14 REPLIES 14

    rajesh_s
    Established Member

    HI,
    After doing this i just have to call bhy2_get_product_id() in main function with all dependency library. Is that right? or any spi configuration needed.

    BSTRobin
    Community Moderator
    Community Moderator

    Hi rajesh_s,

    Did you run previous example code we provided?
    We are not familiar with your host platform, make sure bhy2_spi_read(), bhy2_spi_write(), bst_delay_us() are implemented by host platform.
    PDEBUG("Use SPI interface\r\n");
    rslt = bhy2_init(BHY2_SPI_INTERFACE, bhy2_spi_read, bhy2_spi_write, bst_delay_us, BHY2_RD_WR_LEN, NULL, &bhy2);

    Run into demo_sensor() function, it will call bhy2_get_product_id().

    rajesh_s
    Established Member

    Hi BSTRobin,
    we are having a stm32f4 discovery board and we tried the example code that you provided since it is having multiple dependency library from coines we are mergin it, but my doubt is if i do i2c readWrite(0x1c) to bosch shuttle board by querying product id without any of your code or coines function i am getting the response as 0x89 then why using spi i could not able to do it.In spi we did connection based on data sheet and used mode 0 with proper cloak frequency.still we cannot able to do it.could you tell us why?(not working even with stm32f4). we want normal spi read write and get response from bosch shuttle board. could you try a normal spi read write with stm32f4 without coines and try to get response from bosch shuttle board. Because this condition helps us to make our project more progress since we are starting from scratch.

    BSTRobin
    Community Moderator
    Community Moderator

    Hi rajesh_s,

    Prevous example code run on STM32F401, has no dependency library from coines.
    We confirmed previous example can run on STM32, you can check your host software code even you can't run example code on STM32.

    For SPI/I2C communictaion timing with host, you can refer chapter 19.5 Timing Characteristics in BHI260AP  data sheet.

    BHI260AP host SPI interface timing.png

    rajesh_s
    Established Member

    Hi BSTRObin,
    It's been a month still spi issue exist. i tried with your example code still i am getting 0xff. i am attaching my entire stm32 workspace project here  please try the same on your side . With the same configuration other slaves are responding but not BHI260ap.
    Steps followed:

    1.bhi260ap shuttle board connected to stable 1.8v for vdd and vddio and ground connected.
    2.using a level shifter MISO,MOSI,CS and SCK of bhi260ap 1.8v spi comm connected to 3.3v stm32f4 discovery SPI1(or SPI2) peripheral.
    3.checked continuity on both sides.
    4. Did a soft reset using command 0x14 and request product id using 0x9c (cmd 0x1c with mask for read 0x80) still getting 0xff.
    5.tried with different spi config but i am mentioning one of them(spi mode: 0 ,spi clock speed 2mhz)

    Once again i am attaching my schematics and spi configuration. please help us with this.

    please note ATSAMD51 mcu is our original setup but also tried with stm32f4 same connection as mentioned in schematics  and tested. still 0xff as response.

    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