Realtime BBB Programming, < 1us resolution

Summary of the project I am working on. TDLR at the bottom

I have a wire that I will plug into an expansion header, with a system at the other end driving the current. The line stays high at 3.3V, and then drops when data is being sent; In order to read that data I need a 1us resolution to poll the line accurately in order to determine what the bits being sent are. After a message, I need to take a byte array that I have stored in a file and send its bits back over the wire using a 1us resolution. That byte array represents keyboard and/or joystick states.

I had completed this project previously with an arduino. I used an interrupt that occurred when the line dropped that called a routine that would do nop’s to sleep between the 1us poll rate to get the data, then would send out a stored byte array that was received previously over Ethernet, with bit resolution of 1us. The keyboard states were sent from a .NET application. My problem was that the .NET managed code that grabbed state data from DirectInput plus the sending of data over Ethernet introduced an unacceptable delay.

I bought a couple Beaglebone Black’s because I think having the user input and pin i/o on the same platform will solve my problem. My plan is to use SDL to grab user input, then have some other library interact with the header pins, and they share some common memory containing the data that needs to be sent. From the research I have done, it looks like one option is to write kernel modules. I flashed Ubuntu Raring to the EEPROM, and I couldn’t download a kernel tree due to memory constraints, so I think writing the pin interaction as a driver is unfeasible. I have come across descriptions of PRUSS, but nothing related to BBB or in-depth enough to get me started code wise.

TD;LR: What I am looking for is the best approach I can take in order to do realtime programming on the BBB (Read and write pins at 1us intervals), for someone who is new to linux and C programming. I am using Ubuntu Raring 13.04.

Going to try this out:

Tip dont use linux use starterware

Sent from Yahoo! Mail on Android


I need an OS to use SDL and as a frontend to the program I intend to write, so that’s why I am using linux.

Take a look at Xenomai. Should give you predictability of an RT system and required time resolution, while you will be able to write your app in Linux.