API Support for Beaglebone Blue (Final Report)

Hi Everyone!!

So, finally we have come to the end of Google Summer of Code 2016 and the following is the final report for my project:

Description:

The aim of the project is to create easy-to-use APIs for the hardware on the BB Blue. This would consist of developing/improving kernel drivers for the on-board devices and then reimplementing the Strawson APIs to use these kernel drivers. These APIs will then be used by real-time applications which can be run on BB Blue. This project would widely help the Robotic industry as currently there is no low-cost open-source board which offers the amount of flexibility and performance as the beaglebone black/blue. 4 most important parts of this project are:

a. Enabling and Developing Kernel drivers: In this part, I developed and checked the kernel drives such that they work perfectly for the target kernel version. i.e: 4.4.12
i. Mostly from: https://github.com/kiran4399/beagleboard_kernel
ii. MPU-9250 Kernel driver: https://github.com/kiran4399/inv_mpu

b. Implementing Servo Kernel driver and PRU firmware: https://github.com/kiran4399/bbb_pru_firmware

c. Creating device tree base and overlay files for Beaglebone Blue: https://github.com/kiran4399/bb_blue_api/tree/master/install_files/2016-05-01

d. Developing Beaglebone Blue APIs: https://github.com/kiran4399/bb_blue_api

The APIs act as an abstraction layer for the C programs to access hardware present on the beaglebone black. The only thing which you should do is that you need to install the APIs on your beaglebone board and include the bb_blue_api.h file i.e. #include<bb_blue_api.h> in your source code and use the APIs as mentioned here. When you are done with writing the code, you can compile by including the bb_blue_api.so shared library or create a makefile like the one mentioned here.

A short note about the links mentioned below, I’ll be releasing a new version once in 1 month even after the project. Developers are free to fork the project (source code link mentioned below) and submit any pull request. I’d be happy to merge in the mainline. The Blog would consist of the recent developments pertaining to the APIs and details on how to get started. The Wiki page would consist of the details in relation to each of the individual hardware on which the APIs are build. If someone finds any bugs, please feel free to create an issue in the Issue tracker as mentioned below. Finally, all the intricate details on how to use a specific API are mentioned in the Documentation.

Links!!

Source Code: https://github.com/kiran4399/bb_blue_api
Wiki: https://github.com/kiran4399/bb_blue_api/wiki
Blog: http://linuxcreatures.com/api-support-bbb
Documentation: https://github.com/kiran4399/bb_blue_api#library-functions
Issue Tracker: https://github.com/kiran4399/bb_blue_api/issues
Commit History: https://github.com/kiran4399/bb_blue_api/commits/master

What I accomplished:

I finished the coding, testing and documentation of v1.0 Beaglebone APIs which deal with the following hardware:

  1. LED and Button
  2. MPU-9250
  3. BMP-280
  4. Analog voltage signals
  5. DC motor control using PWM
  6. Servo and ESC
  7. Quadrature Encoders
  8. UART, SPI and I2C
  9. DSM2

I am yet to document the v2.0 APIs which are:

  1. CPU frequency control
  2. Vector and Quaternion Math library
  3. Discrete SISO filters

Future Improvements:

This project has lot of scope in adding new functionalities.Some of them which I couldn’t incorporate in this project due to lack of time are as follows:

  1. Adding ROS support for the APIs.
  2. Porting Beaglebone Blue APIs as HAL to Ardupilot
  3. Adding DMP support to the MPU-9250 kernel driver for Linux 4.4.x
  4. Writing PRU firmware for PRU-1 which allows it act as the 4th Encoder. (Beaglebone Black/Blue has only 3 encoders)
  5. Adding these APIs to Cloud9 for Beaglebone Blue which enables the node.js to run Hardware specific JS code in the web-browser.
  6. Writing python of javascript wrappers for the C APIs.
  7. Testing and Documentation for v2.0 APIs
  8. Creating documentation for the APIs in Deoxygen.

My Experience:

It was truly a great experience in doing a GSoC-2016 project for Beagleboard.org. Frankly speaking, when I look at some of my archived material which I submitted as proposals for GSoC-2015 and GSoC-2016, I am clearly able to see how much I’ve advanced in terms of Programming and understanding subtle aspects of open-source development. From using git clone or git pull to git commit or git push, I learnt everything during this time. Some of my project related stuff which I learnt were:

  1. Kernel Module Development (Spent 50% of my time on this, had a difficult time, but learnt a lo!!t)
  2. Writing a proper Makefile for a project.
  3. Creating char sysfs devices in linux kernel
  4. Better understand of all the hardware modules in Beaglebone black
  5. Better usage of linux kernel in terms of patching, generating pull requests and other git stuff.
  6. Last, but not the least, I learnt a lot even in terms of reading and understanding other developer’s code.

It might be my luck, but truly, my project helped me even in my Undergraduate Hons. project in my school. I am currently doing my project on “Visual Navigation for Flying Robots” and made a quadrocopter model which is used as a hardware platform to test my programs. What is more to it, I am using the APIs on Beaglebone Blue (Currently Beagleboone Black + Strawson Cape) as the Flight Computer for my drone. I proudly present my drone: Blue-copter!!! :stuck_out_tongue:

Acknowledgments:
Finally, I’d like to say something which might seem to be little informal in a Final report, but I feel this is very important. Seriously, I wouldn’t be, at all, able to finish this project without the support of my Mentors, especially Alexander Hiam and Micheal Welling who took a lot of time from their daily routine and patiently answered all my doubts and questions, though some of them were silly and trivial. I also thank all the other Beagleboard.org mentors and my friends who participated in GSoC 2016 for Beagleboard.org for guiding and supporting me. I really owe this org one and will look forward to participating again in GSoC 2017.

Kiran,

Working on the Blue Rev A1 prototypes…

Do you have your version of the .dts file? I never did finish mine, but am hacking on one now and want to do comparisons.

Regards,
Jason

Hi Jason,

I just made a cape overlay for the beaglebone blue by mimicking the robotics cape, I did not make the base overlay file though…

Here is the link for the cape overlay for beaglebone black…
https://github.com/kiran4399/bb_blue_api/blob/master/install_files/2016-05-01/BBB_BASE-00A0.dts