SAM4S Drivers for the BNO055 Xpro

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;



Possibly useful documentation



Atmel Studio Solution



Use examples




By |2017-06-26T06:17:19+00:00June 15th, 2016|Prototyping, SAM4S Xpro|6 Comments


  1. jawad October 10, 2016 at 6:55 am - Reply

    I purchased the atsamv71q21 to integrate it with bno055 at the behest that already there is an example project of samd21 with bno055 in ATMEL Studio 7. Sadly, I could not locate the latter example project in ATMEL studio 7. Albeit, an example of same70 exists with bno055. I do not have enough knowledge how to utilize the drivers from there!!!!!
    I need help, please, in installing the driver available in github for BNO055 into ATMEL studio 7. Cannot understand how to manage the .c and .h files. Please help me with some instructions on this so i can activitate the bno055. I was not successful with the driver already within ATMEL Studio 7.

    • Rafael Roman Otero October 14, 2016 at 6:53 pm - Reply

      The same happened to me. In my case I started from the SAME70 port available in the ASF (when you create a new SAME70 BNO055 example project ). That port, if you go and look at the source code, you’ll see it’s a port of the original Bochs drivers. You could start from that example (the ASF one), or even the example in this post. Because they both use the ASF, they may give you hints on what exactly you need to modify to make it work for the ATSAMV71Q21. (I don’t recall exactly, but there aren’t that many changes to make. Good luck)


  2. Mattse October 21, 2016 at 8:38 am - Reply

    Hello Rafael,

    first of all thanks for your working programm. I wrote a program for the BNO055 xplained and it worked well in the beginning. But then, i dont know why, it stoped with faulty values.
    Now i know that my both boards are OK.

    Is it right that the heading always shows zero when you reset the board? Can it be that euler shows only the heading relativ to the moment you start the chip?

    • Rafael Roman Otero October 22, 2016 at 9:12 am - Reply

      I’m not entirely sure (I’d need to check the documentation), but my understanding was that position was absolute. If that’s true, then it shouldn’t start with zero. Did you added any code between the time it worked and the time it stopped working? If so, it’s most likely a bug. Verify step by step your program. Make use of Atmel Studio’s debugger—it is pretty neat. If you still can’t solve your problem, give me more specific details and maybe I can offer some hints. Rafael.

      • mattse October 26, 2016 at 10:54 am - Reply

        So, i tried it yesterday evening. It starts always with 360 degree. But it moves to the nearly correct position a little bit later. May be the internal calibration makes his job. But when you move it fast in all directions, it looses his zero position. Between 2 and 9 degree +/-
        But it comes back to his normal.
        I choosed this chip, because it has all build inside, what i need. Now i have a basis to work.

        • Rafael Roman Otero October 28, 2016 at 6:42 am - Reply

          Good. It’s a pretty nice chip indeed. I’ve been looking to do something with it for some time already, but haven’t have the time. Hopefully you can do something interesting with it. Good luck.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.