I am working on manufacturing and selftest firmware for our product and want to force BHI160 to run selftests on itself and the attached sensors.
I have followed the example at ...
but the only meta event I am seeing is BHY_META_EVENT_TYPE_INITIALIZED = 16; I do not see any BHY_META_EVENT_TYPE_SELF_TEST_RESULTS = 15.
Do I have to use special sensortech firmware?
Do I have to do something to enable the selftest events?
Solved! Go to Solution.
At every boot, BHI160 will initialized each part and will only succesfully boot if each slave answers, so it is guaranteed that communication work. But that is not a true self-test. Luckily the self-test code for each slave is pre-programmed in the Sensor Hub.
The init function typically boots up the hub directly, which is why you don't get self-test results. to trigger it, this piece of code is the important bit:
bhy_set_chip_control(0); bhy_set_host_interface_control(BHY_HOST_SELFTEST, ENABLE); delay_ms(100); bhy_set_chip_control(1);
At boot it checks the value of the self_test_enable bit, and if true will perform the self-test, this is why you need to stop the CPU and restart it.