MATLAB: BeagleBoard I/O Pins code generation

beagleboardEmbedded Coder

Hi,
Is there any way, using BeageBoard as hardware Target, one can create a simulink model that uses I/O pins on the BeagleBoard? I know there is an Embedded Coder BeagleBoard example but it doe not use any I/O pins (Analog and Digital.)
Thanks,
Ahmad.

Best Answer

I just posted an example to File Exchnge (search for BeagleBoard GPIO) that illustrates how to access GPIO pins on the BeagleBoard. I took the liberty of using the code above for GPIO output. However, reading the GPIO pin was more involved. I used "popen" call instead of "system" as "system" call does not return any output aside from a success code.
By the way, using the example posted by Murat here, one can do a lot of things. Making Linux calls from a Simulink model opens a lot of doors. By using the same logic, one can control built-in LEDs on the board or read the USER push button status.
Note however that the method outlined here is not very fast. I was able to implement a blinking LED using a 50 ms sample time. Just don't expect very fast response. Also be careful with the GPIO pins as they are 1.8V. Most sensors out there use +5V logic lvels. Use a voltage divider circuit to interface these sensor to a GPIO pin configured as input. You can also use a logic level shifter. Sparkfun sells one for $3.
Related Question