This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BNO080 IMU data over BLE and main context

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

  • Hi,

    I am not able to make sense of this. It is not possible to call SoftDevice API from a too high interrupt priority, but main context should not cause any problems. Do you get an error returned from any calls? Or how do you see the error manifest itself in other ways? What have you done to debug? IIs it possible to reproduce on a DK with dummy data (without a BNO080)? If so it could be interesting to test your code.

Related