Bosch Sensortec Community

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

    Nicla Sense - BHI260 - physical sensor IDs for self test

    Nicla Sense - BHI260 - physical sensor IDs for self test

    sebp
    New Poster

    Hello,

    I am calling the function bhy2_perform_self_test() of the C API using the virtual  sensor IDs of the Accelerometer, Gyrosscope and Magnetometer. The call  succeeds, but the test result returns test_status=9. It seems one has to use the BSX physical sensor IDs?

    I found this: https://github.com/BoschSensortec/BSX4-HAL-4.1NoFusion/blob/master/sensord/bsx/inc/bsx_physical_sens...

    With these IDs the self test succeed. Are these the correct IDs to use?

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    Hi sebp,

    As you call the function bhy2_perform_self_test() to do self test, sensor ID should use BSX input physical sensor ID, not use virtual sensor ID.

    BHI260AP BSX input physical sensor ID.png
    Yes, you could use them.

    kise1_off
    Member

    Hi!

    Can you share an example of a self-test code?

    It will be very helpful! Thanks!

    I am using the Arduino IDE. Because the Arduino_BHY2 lib does not expose all functionality of the bhy2 C API and also does not give access to the bhy2_dev structure, you have to add the following code to the BoschSensortec class in BoschSensortec.h:

    public:
    bhy2_dev& dev() {return _bhy2;}; 

     

    In the setup() function of the Arduino sketch I do this:

    void setup()
    {
    
    ...
    	
    	struct bhy2_self_test_resp accel_result;
    	int err = bhy2_perform_self_test(BSX_PHYS_SENS_ID_ACCEL, &accel_result, &sensortec.dev());
    	if (err != BHY2_OK) {		
    		goto Error;			
    	}
    	if (accel_result.test_status != 0) {		
    		goto Error;
    	}
    
    
    ...
    
    
    	set_LED_color(0xff,0xff,0); // yellow	
    	return;
    	
    Error:
    	set_LED_color(0xff,0,0);	
    }

    "sensortec" is a global variable defined by the Arduino_BHY2 lib.

    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