Bosch Sensortec Community

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

    BHI160B : bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)

    Eyalb
    Member

    BHI160B : bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)

    I use BHI160B.

    I call bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status) and get all parameters zero value.

    other than that I have gyro example working, but I want to know which dynamic range value is set after I called :

    bhy_enable_virtual_sensor(VS_TYPE_GYROSCOPE, VS_WAKEUP, sample_range, 0, VS_FLUSH_NONE, 0, dynamic_range);

    this because I want my computation to be right : float_tmp = pi_const * (sensor_data->data_vector.x) * dynamic_range / 32768 / 180 ;

    thanks.

    eyal.

    4 REPLIES 4
    BSTRobin
    Community Moderator

    Re: BHI160B : bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)

    Hello Eyalb,

    Before you call sensor API, have you finished sensor initialization?

    By the way, which example code you used?

    https://github.com/BoschSensortec/BHy1_driver_and_MCU_solution/tree/master/examples

    Eyalb
    Member

    Re: BHI160B : bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)

    hello.

    Yes. I finished sensor init  and then called func to get parameters.

    I use this code :

    bhy_driver_init(&bhy_fw);

    semTake(imuSem,WAIT_FOREVER);

    if(bhy_install_sensor_callback(VS_TYPE_GYROSCOPE, VS_WAKEUP, sensors_callback))
    {
    DEBUG("Fail to install VS_TYPE_GYROSCOPE callback\n");
    return;
    }
    /* enables the virtual sensors : */
    if (bhy_enable_virtual_sensor(VS_TYPE_GYROSCOPE, VS_WAKEUP, sample_range, 0, VS_FLUSH_NONE, 0, 0/*dynamic_range*/))
    {
    DEBUG("==========================Fail to enable sensor id=%d==================================\n", VS_TYPE_GYROSCOPE);
    return;
    }
    if (!( bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)))
    {
    dynamic_range = gyro_status.gyro_dynamic_range;
    DEBUG("read dynamic_range. value is : %d \n",dynamic_range);
    }
    else
    DEBUG("error read dynamic_range. \n");

    while(1) {

    semTake(imuSem,WAIT_FOREVER);
    /*while (!ioport_get_pin_level(BHY_INT) && !bytes_remaining);*/
    bhy_read_fifo(fifo + bytes_left_in_fifo, FIFO_SIZE - bytes_left_in_fifo, &bytes_read, &bytes_remaining);

    ...... 

     

    thanks.

     

    BSTRobin
    Community Moderator

    Re: BHI160B : bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)

    Hello Eyalb,

    There was a example in github to read sensor status, could you test it on your platform?

    https://github.com/BoschSensortec/BHy1_driver_and_MCU_solution/blob/master/examples/custom_sensor_ex...

    Eyalb
    Member

    Re: BHI160B : bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)

    I'll test it ASAP. thanks.

     

    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