Hi all,
I am working with a BNO080 imu and have ported an Adafruit library into the ble_app_template and created a custom service.
Independently, the IMU code and the custom service work great.
When trying to send IMU data over BLE i run into issues.
I have a function call in main that checks for a sensor event:
for (;;) { scanSensorEvent(); idle_state_handle(); }
}
void scanSensorEvent(void * p_event_data, uint16_t event_size) //void scanSensorEvent(void) { if (drv_motion_wasReset()) { NRF_LOG_INFO("sensor was reset "); setReports(); } if (drv_motion_getSensorEvent(&sensorValue)) // Check if there is a new report available { drv_motion_evt_handler(); //nrf_delay_ms(10); } }
if new data (report) is available from the IMU then grab the data, store it, and process it for sending over BLE.
drv_motion_evt_handler() is basically a switch statement that checks which of the sensor data has come in for processing. In here, i process and then call my ble_cus_custom_value_update function to send the data.
It is here that i cannot get the data to send at all. I have tried a test to send data from a timeout handler instead of the IMU handler and this works perfectly. So I think that this issue has to do with the prioritization of the Softdevice.
My goal is to avoid using a timer as the data is already coming in at a predefined rate (10ms) and i want to avoid synchronisation issues between a timer and the IMU timing.
Any suggestions?
Thanks