File Exchange

image thumbnail

Device Drivers for the BeagleBone Black

version (10.7 MB) by R. Dustin
Development of Simulink Device Driver Blocks for the BeagleBone Black


Updated 17 Aug 2015

From GitHub

View Version History

View license on GitHub

This project provides a step by step guide for the development of device driver blocks specifically for the BeagleBone Black.
Several standard blocks are developed including blocks for:
- GPIO read/write
- I2C read/write
- Analog Input read
- USR LEDs control

Specific sensor drivers are also developed for the:
- ADXL330 accelerometer
- L3G4200D gyroscope
- HMC5883L magnetometer

The developed driver blocks are then combined in a Simulink model for attitude estimation via a descent gradient sensor fusion algorithm. Finally a UI is developed to display sensor data and estimated attitude via Simulink 3D VR animation. All code is included.

Note that this project may prove especially useful for those using Matlab versions prior to R2014B where the "Embedded Coder® Support Package for BeagleBone Black Hardware" is not supported.

Cite As

R. Dustin (2021). Device Drivers for the BeagleBone Black (, GitHub. Retrieved .

Comments and Ratings (13)


Kurt Stewart

Could you also include the non-truncated code for the s-function builder before it is wrapped

Kurt Stewart

I am wondering if you have made the SPI blocks yet


why i can not download BBB? it show me an error . i have try it on 2016a and 2017b.


I have tried to use the I2C block in Simulink, and I get the error below. Any ideas?? Thanks a lot!
P.S.: the LED block works fine.

The compilation with I2C goes well up to the generation of the stand-alone executable, then:
"### Creating standalone executable "../i2c_ext_test.elf" ..."
C:/PROGRA~3/MATLAB/SUPPOR~1/R2017a/3P778C~1.INS/LINARO~2.INS/bin/arm-linux-gnueabihf-gcc -lm -lrt -lpthread -ldl -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot="C:\ProgramData\MATLAB\SupportPackages\R2017a\toolbox\target\supportpackages\beaglebone\libc" -o ../i2c_ext_test.elf i2c_ext_test.c.o i2c_ext_test_data.c.o BBB_Driver_I2C_Read_wrapper.c.o BBB_Driver_USRLED_wrapper.c.o linuxinitialize.c.o MW_led.c.o ert_main.c.o -lm -lm
BBB_Driver_USRLED_wrapper.c.o: In function `iSet_Debug_Level':
BBB_Driver_USRLED_wrapper.c:(.text+0x8c): multiple definition of `iSet_Debug_Level'
BBB_Driver_I2C_Read_wrapper.c.o:BBB_Driver_I2C_Read_wrapper.c:(.text+0xa8): first defined here
collect2.exe: error: ld returned 1 exit status
gmake: *** [../i2c_ext_test.elf] Error 1
### Creating HTML report file i2c_ext_test_codegen_rpt.html
### Build procedure for model: 'i2c_ext_test' aborted due to an error.
Error(s) encountered while building "i2c_ext_test":
### Failed to generate all binary outputs.


Hello, thank you for this!

Now that embedded coder for beagle bone black exists, can these blocks be combined with the simulink supported ones for beagle bone black? This would be a very useful extension (e.g., embedded coder still has no I2C support block) !

Basically, I am trying to get I2C sensor reading happen on a beagle bone black, using embedded code (not just the Matlab command line interface). Can you give me a tip on how to get started best?

Thank you!

Mrityu Mathworker

Dustin, will it work for MPU 6050?
If yes how to do it?

Thanks and Regards.

liu lei

Sala Darenfed

Will the package work with ADXL335 3-Axis Analog Output Accelerometer? Thanks.

R. Dustin

Hi Oscar, sorry for the late reply. I've added the "BLACKlink_SimulinkLibrary" folder to the GitHub page with a zip file containing all required code to install the BLACKlink library on your computer. I've also added instructions on exactly how to do this in the BLACKlink Manual appendix (13.1) also available on the GitHub page. Hope the helps and let me know if you have any other questions. Cheers!

Oscar Mauricio

Oscar Mauricio

hi, your job is fantastic but I have a problem.
How do you install this in simulink? for use library, I don't know like install. please help me.

Albert Nubiola

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Device Drivers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!