I recently acquired an Atmel BNO055 Xplained Pro board, which features a 9-axis absolute orientation sensor, or at least that is the part I’m interested in. Then I found that the ASF does not provide BNo055 support for the SAM4S. Luckily, it does for the SAM E70. So I adapted the SAM E70 drivers to work with the SAM4S, and surprisingly it worked without any issues.
Note that the drivers in the ASF are a port from the ones provided by Bochs (BNO055 chip manufacturer).
In the downloads you will find an Atmel Studio 7 solution. The /ASF/ThirdParty/bno055 folder contains the driver’s source code, and /config/conf_bno055.h is the configuration file. It is tested for ASFv3.34.1.
The downloads also include three examples. motion_example.c demonstrates how to configure the sensor in low power mode. That is, when no motion is detected the sensor’s MCU goes to sleep, and, when it detects movement (while sleeping), it wakes up and interrupts the main MCU (SAM4S in this case). orientation_example.c configures the sensor in normal mode (no interrupts) and reads orientation values. Lastly, motion_and_orientation.c is a combination of the two, and demonstrate how to read the sensor only when it is awake.
Reading other output data
Like I mentioned above, I was not interested in anything other than orientation values, but it is possible to query the sensor for other fused and non-fused data (e.g. raw accelerometer data). I have not test them, but the SAM E70 example was using these:
struct bno055_linear_accel_t bno055_linear_accel_data; struct bno055_gravity_t bno055_gravity_data; struct bno055_accel_t bno055_accel_data; struct bno055_gyro_t bno055_gyro_data; struct bno055_mag_t bno055_mag_data; bno055_read_accel_xyz(&bno055_accel_data); bno055_read_gyro_xyz(&bno055_gyro_data); bno055_read_mag_xyz(&bno055_mag_data); bno055_read_linear_accel_xyz(&bno055_linear_accel_data); bno055_read_gravity_xyz(&bno055_gravity_data);
Possibly useful documentation
Atmel Studio SolutionDownload