Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Help with Zephyr driver for BHI360

    Help with Zephyr driver for BHI360

    chris_collie
    New Poster

    We are implementing the BHI360 chip with the BMM350 as an auxilary in our product. We are using the nrf9160 with the standard Zephyr RTOS. Is anyone able to point me towards a driver for these chips with Zephyr or even an example of implementation? Or if there is someone who knows how to do this I would be happy to pay for some help. 

    Thanks!

    4 REPLIES 4

    BSTRobin
    Community Moderator
    Community Moderator

    Hi chris_collie,

    This is official BHI360 sensor API and example code on github https://github.com/boschsensortec/BHY2-Sensor-API
    I also uploaed example code run on STM32F4 for your reference.

    Hello, Using your shuttle3 board I have been able to get your reference code working with the parse_quaternion() and it is absolutely perfect. However when I attempt to change the #if to enable parse_euler(). The callback never hits, I am wondering if it is to do with the calibration levels of the mag/acc. For some reason the gyro appears to be the only device that goes to full calibration. Note this is the example code above running on an STM32 nucleo board over SPI bus. Do you have any idea how I can get the parse_euler to work on this setup?

     

    StartBHI260Task
    Use SPI interface
    BHI260/BHA260 found. Product ID read 89
    Host interrupt control
    Wake up FIFO enabled.
    Non wake up FIFO enabled.
    Status FIFO disabled.
    Debugging disabled.
    Fault enabled.
    Interrupt is active high.
    Interrupt is level triggered.
    Interrupt pin drive is push-pull.
    Loading firmware into RAM.
    Booting from RAM.
    Boot successful. Kernel version 5991.
    [META EVENT WAKE UP] Firmware initialized. Firmware version 5991
    [META EVENT] Firmware initialized. Firmware version 5991
    Enable Accelerometer corrected wake up at 1.00Hz.
    BHY2_SENSOR_ID_ACC_WU:range=8, sample_rate=1.562500
    Enable Gyroscope wake up at 1.00Hz.
    BHY2_SENSOR_ID_GYRO_WU:range=2000, sample_rate=1.562500
    Enable Magnetometer wake up at 1.00Hz.
    Enable Rotation vector wake up at 1.00Hz.
    [META EVENT WAKE UP] Power mode changed for sensor id 6
    [META EVENT WAKE UP] Sample rate changed for sensor id 6
    [META EVENT WAKE UP] Power mode changed for sensor id 15
    [META EVENT WAKE UP] Sample rate changed for sensor id 15
    [META EVENT WAKE UP] Power mode changed for sensor id 24
    [META EVENT WAKE UP] Sample rate changed for sensor id 24
    [META EVENT WAKE UP] Power mode changed for sensor id 35
    [META EVENT WAKE UP] Sample rate changed for sensor id 35
    [META EVENT WAKE UP] Accuracy for sensor id 15 changed to 0
    [META EVENT WAKE UP] Accuracy for sensor id 24 changed to 0
    [META EVENT WAKE UP] Accuracy for sensor id 6 changed to 0
    [META EVENT WAKE UP] Accuracy for sensor id 6 changed to 1
    [META EVENT WAKE UP] Accuracy for sensor id 15 changed to 1
    [META EVENT WAKE UP] Accuracy for sensor id 15 changed to 2
    [META EVENT WAKE UP] Accuracy for sensor id 15 changed to 3
    BHY2_PHYS_SENSOR_ID_GYROSCOPE profile----------------------------bhi260_prof_len=512, actual_len=200---------------------
    0x03,0x54,0x00,0x04,0x00,0xb0,0x00,0x40,0x0e,0x00,0x6f,0x00,0x00,0x00,0x3e,0x00,0x00,0xa7,0x0c,0xa9,0x10,0xc0,0x5e,0x01,0xa7,0xb7,0x1b,0xfe,0x89,0x3f,0x62,0xc1,0x00,0x03,0x0c,0x00,0x08,0x00,0x00,0x02,0x00,0x75,0x0c,0xa8,0x10,0xc0,0x09,0x04,0xbb,0x6a,0x1c,0xf1,0x90,0x3f,0x45,0xc1,0x00,0x00,0x0c,0x80,0x08,0x3f,0x00,0x07,0x00,0xa7,0x0c,0xa9,0x10,0xc0,0x5e,0x08,0xa7,0xb7,0x1b,0xfe,0x89,0x3f,0x62,0xc1,0x00,0x26,0x0c,0xc4,0x10,0xc0,0xda,0x09,0xfa,0x6a,0x26,0xa0,0xc6,0x3f,0xcf,0xc1,0x00,0x60,0x0c,0x90,0x10,0xc0,0x6c,0x0a,0xc3,0x41,0x0c,0x39,0xe4,0x40,0x43,0xc1,0x00,0xec,0x0c,0xf9,0x10,0xc0,0x47,0x0b,0x31,0xb8,0x41,0xc3,0xa9,0xbe,0x9e,0xc1,0x00,0x34,0x0c,0x37,0x10,0xc0,0xfd,0x0c,0x1a,0x66,0xe5,0x91,0x02,0x40,0x0f,0xc0,0x00,0x08,0x0c,0x00,0x08,0x00,0x00,0x0d,0x00,0x08,0x0c,0x00,0x08,0x00,0x00,0x0e,0x00,0x00,0x0c,0x20,0x08,0x41,0x00,0x0f,0x00,0xa7,0x07,0xa9,0x10,0xc0,0x5e,0x01,0xa7,0xb7,0x1b,0xfe,0x89,0x3f,0x62,0xc1,0x00,0x03,0x07,0x00,0x08,0x00,0x00,0x02,0x00,0x3c,0x00,0x00,0x21,0x00,0x3d,0x00,

    Hi ChrisDesjardins,

    You need to enable the following code if you would like to get euler angle data from parse_euler().

    rslt = bhy2_register_fifo_parse_callback(BHY2_SENSOR_ID_ORI_WU, parse_euler, (void*)&euler_accuracy, &bhy2dev);
    print_api_error(rslt, &bhy2dev);

    rslt = bhy2_set_virt_sensor_cfg(BHY2_SENSOR_ID_ORI_WU, sample_rate, report_latency_ms, &bhy2dev);
    print_api_error(rslt, &bhy2dev);
    PDEBUG("Enable %s at %.2fHz.\r\n", get_sensor_name(BHY2_SENSOR_ID_ORI_WU), sample_rate);

    Hello, I have gotten the ORI sensor working, and still it doesn't seem to get the proper orientation. There appear to be a number of issues, for example if we rotate the device 90 degrees, the orientation does not always change by 90 degrees. Further more if we boot the device up in some random orientation then the heading is off. For example if we have the device at heading 0, and then power it down, and move it, then power it back on, re-calibrate the sensors including MAG and put it back to heading 0, it is can be off by a huge amount, seems random in fact.  What can we do to improve the performance?

    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