BeagleBone AI and real time applications (SMPS and motor control)

Greetings All!

Is there/will there be tutorials, on how to run Linux on the Beaglebone AI, but run real time code on its two DSP processors?

For instance, I am looking to do a motor control application (100kHz sampling with external ADCs connected via SPI). Is this possible to run on the DSP cores?

Richard, I have been working with the BeagleBoard X15 the past four months off and on and have made some good progress in using the DSP cores running SYS/BIOS applications while the A15 cores are running Debian Linux. I develop my DSP programs in CCS and generate Hex files that I can copy to Linux. Then from Linux I have created a DSP_Load application that loads and runs the DSP core with the hex file. To date my DSP program uses Timer 4 as the SYS/BIOS timer and timer 5 as a HWI timer, an external GPIO interrupt (which would be helpful for your external ADCs) and communicates with UART 8, 9 and 10. I teach a Mechatronics class at the University of Illinois where currently I instruct the class using the OMAPL138 processor where I use a very similar Linux program to load the DSP core of the OMAPL138. I am hoping to switch my Mechatronics class to the BB x15 this Spring 2020. Currently I have a student working on developing a DSP program that uses the MCSPI3 and MCSPI4 serial ports of the AM572x. Once I have the McSPIs working and a communication scheme, I hope to use IPC, between Linux and the DSPs I will switch my class to the BB x15. Once I switch my class I will be writing up instructions on how to program the DSPs and that may be useful to you when using the BeagleBoneAI. I can give you what I have done so far, but it is not documented super well.
The question I have with the BeagleBoneAI is does it bring out to its headers any of the McSPI pins? I have not looked at the schematics closely to know the answer. You may want to check that and if the pins do not come out you could switch to the BB x15 which has four headers that bring out many more of the pins. If you are interested in my OMAPL138 work you can see my course web site at

Hi DanInteresting I worked on high end commercial motor controller which used L138. the ARM ran Green Hills Integrity and the DSP Sysbios. This system intialized the DSP caches first before loading the DSP to RAM. the executable was stored on flash that could be NFS mounted for ARM and DSP executable update by PC. The IPC was done using shared Low and High priority Queues in the DSP shared RAM. Our application was extremely hard Real Time and proprietary and I’m retired but probably have a a TI L138 eval Board I purchased sitting around I might dig out .
If this load DSP code is available it might provide a refresher for me as a hobby. I’d like to ditch Linux on the ARM for my purposes maybe use TI RTOS. Are you emulating both cores simultaneously with JTAG or using serial debug on the DSP? How are you getting DSP hex file into Linux.

I am running Angstrom Linux on the ARM core. So once I have built my SYS/BIOS DSP application in windows, I use putty’s scp program “pscp” to copy the hex file to Linux. Then I run the DSP_Load program from Angstrom using a putty terminal. If you are going to get ride of Angstrom or another Linux from the ARM core you will not be able to use the DSP_Load program.
I have also written a DSP_Flash application that again from the embedded Linux writes the DSP program to the SPI flash of the LogicPD’s OMAPL138 SOM. Then on power up I change the UBL to load the DSP application and then launch Linux. This way the DSP program is running before Linux finishes booting. Sounds something like what you had setup on your OMAP system.

Thanks for replying.
It’s been 2 year’s we didn’t allow the DSP to start before the ARM device properly initialized safely. product was a safety critical device as well as a network safety device which was the ARM side had the network stack . The DSP was loaded by ARM after DSP cache was configured that program came from TI cache config. Besides your loading not being automated on boot ( our DSP hex file was in flash) our loader validated the DSP hex file thats essential in safety critical. It’s all irrelevant since my interest is skills refresher I spent my career using RTOS it’s not a hard requirement to not use Linux it’s more a comfort zone and desire to use baremetal or RTOS on ARM those are the jobs that’s get floated my way especially low level and you see Very little support or interest in this amongst the hobbyist arena.I prefer to focus on ARM boot and BSP as a EE and parsing hex files is not my interest that’s why I asked if this loader was in public domain. I’ve never seen a c Linux program I couldn’t port to C RTOS. I’m curious your an educator there’s a big demand in industry for hard real-time RTOS based systems. Free RTOS is FreeTI Sysbios is Free so is TI RTOS. Why Not give US Engineeers this skillset? I see Foreign student asking about this surely the realize the need here for the skills. Shouldn’t our students get skills that
Industry needs. I attended MSOE I’m not sure what they offer in classes now. When I graduated we used Altair 8080 and used switches to toggle in machine code.

I understand Linux is open and fits some products needs but yet all the companies that use this TI Chip in large quantities and required very hard real-time I’ve encountered in industry don’t use Linux. Aircraft require a safety certificate of RTOS they won’t pay to certify linux. Not trying to be controversial I’m thinking this barebones)RTOS skillset is still relavent and if no one else sees this I might need to unretire just for fun and some part time work. I find it alarming other countries see the need to learn this skillset and have made effort to sell themselves as better Engineeers and replace US Engineeers as superior educated (I don’t believe this) and Industry claims they can’t find enough US Engineeers. Looks like robots and are your Target’s for classwork.
Surely your school teaches control theory, guidance Navigation and control used in spacecraft control yet last time I checked Lockheed Martin uses Vxworks on spacecraft and missle GNC not Linux. Thanks for inspiring me by sharing your project it brought back memories of when work was still inspiring and enjoyable for 4 hours of 8 every day until I encountered a foreign Engineeer at work on Visa who reminded me he was better trained and I should retire and leave Engineeering Linux and Android to non US Engineeers. Funny my Verizon 4G hotspot designed by these very same visa Engineeers at Verizon in Dallas continually goes through reset our 737 planes are grounded and our products are worse than ever wherever offshore or visa labor is used.
I am encouraged our universities continue to attract the brightest student from around the world.
Since I’m obviously missing my old profession and have way too much time on my hands maybe it’s time I revisit my Alma Matter and see what Johnson Controls and Nividia have donated to MSOE a school that’s selling point was we talk to Industry to understand what industry needs.

Sadly I’m afraid their going to be teaching Linux on NVDA ARM Chip’s :sob: as part of any embedded curriculum.

Greetings All!

Is there/will there be tutorials, on how to run Linux on the Beaglebone AI, but run real time code on its two DSP processors?

Yes. You use OpenCL to program the DSPs. The repo will eventually host some DSP examples, bit just TIDL.

Some off-load can be done for real-time.

For instance, I am looking to do a motor control application (100kHz sampling with external ADCs connected via SPI). Is this possible to run on the DSP cores?

I don’t know that is a clear requirement. The DSPs are certainly good at filters and control.

Our application imported Matlab model’s designed by PhD exported to c++ running on L238 DSP. I’m aware of another company that used OMAP DSPs for military SDR they used QNX on ARM but I believe they migrated to Android which was TI Linux based probably tactical tablets.

Greetings All!

Is there/will there be tutorials, on how to run Linux on the Beaglebone AI, but run real time code on its two DSP processors?

Yes. You use OpenCL to program the DSPs. The repo will eventually host some DSP examples, bit just TIDL.

I meant “besides” just TIDL. Also, I’ve started the at

It seems the images have the /usr/share/ti/examples/opencl directory already. Unfortunately, it is owned by root, so you’ll need to go into there and run ‘sudo make’.

It looks like some of the examples use SDL, so you’ll want to run ‘sudo apt update; sudo apt install libsdl2-dev’ first.

For the examples that require XDC, I don’t have an easy answer today.

Here’s some quick output:
debian@beaglebone:/usr/share/ti/examples/opencl$ cd simple/
debian@beaglebone:/usr/share/ti/examples/opencl/simple$ ls Makefile Makefile.rtos simple simple.cpp simple.o
debian@beaglebone:/usr/share/ti/examples/opencl/simple$ cd …/vecadd/
debian@beaglebone:/usr/share/ti/examples/opencl/vecadd$ sudo ./vecadd
DEVICE: TI Multicore C66 DSP

Offloading vector addition of 8192K elements…

Kernel Exec : Queue to Submit: 15 us
Kernel Exec : Submit to Start : 404 us
Kernel Exec : Start to End : 52876 us


Mark, you are preaching to the choir and I love hearing what you said from industry experts. I teach and help teach both control systems and robotics courses. In each of these classes I stress the real-time capability of the system they are programming. I do feel it is important to teach the use of embedded Linux but when I do I always have another processor in the system that can run real-time code. For example the TMS320F28379D floating point processors are great for motor control and have 2 full cores and 2 partial cores TI calls Control Law Accelerators. You may also be interested in the new TMS320F28388D chips which add an ARM core.

The system I mentioned also had the 28335 for encoders and other stuff. Another heart pump project used the Picolo for motor control I’m familiar. the Omap DSP used Matlab and the code was exported all done by PhD in control theory.
Probably the most complex system I’ve worked on
I’m glad someone is carrying the torch for me Dan🤩

Mark, also if you would like the DSP_Load source code I can email it to you. It may not be the best to put it on this thread as it is not code for the BB x15 and BBAI.

Yes I’m interested I’ll dig out my L138 I think I bought the JTAG too we can correspond. I Took early retirement 2 years ago my mom has Dementia it’s become obvious I’m gonna need to get back to work I’m 60 and bored silly

OK send me an email at and I will send you the code.

Thank you for your responses! The current RCP (rapid control prototyping) system that I use is the E2000 from Microdaq. It does, in fact, use an OMAP L137 (the older version of the L138). The user programs the E2000 with Scilab and Xcos (the open source versions of Matlab and Simulink).

When you buy an E2000, it comes pre-programmed with Linux already running on the ARM core, TI RTOS running on the DSP, and a simple web server so that you can upload your Scilab model with the click of a button. My goal would be to emulate this setup with the Beaglebone AI, as the DSPs on board are much faster.

I also sincerely hope there will be additional tutorials for all of the BBAI integrated CPUs.

I did some SPI connected A/D performance testing a few weeks ago with both a BBB and another AI type ARM eval board .

Even with the faster 4 core CPU type board, Linux could not accomplish a very fast sampling rate and would be restricted to the lower voice bandwidth range.