MATLAB Answers

How to Flash .m file to Raspberry Pi (making it standalone system) using matlab support package for RPi

19 views (last 30 days)
Abhishek Roy
Abhishek Roy on 1 Oct 2015
Edited: Walter Roberson on 5 Oct 2015
I am developing a serial echo program on the Raspberry pi (RPi) hardware i.e RPi is connected to an external microcontroller over the serial line (RX TX crossed), The external controller sends a byte of data that is received by RPi and re-transmitted back (like an echo).
I am using the matlab support package for RPi to do the same. Currently, I have written a .m file script to use the built in serial functions read() and write() to implement the requirement.
mypi = raspi()
myserialdevice = serialdev(mypi,'/dev/ttyAMA0',9600,8,'none',1)
myserialdevice.Timeout = 1000
serialdata = read(myserialdevice,1);
The RPi is connected to MATLAB via an ethernet cable, I want to run the RPi as a standalone system not connected to the PC (MATLAB). How can I burn the .m file to the target device(RPi) ? Do i need to convert to a simulink model ?

Answers (1)

Madhu Govindarajan
Madhu Govindarajan on 5 Oct 2015
For standalone applications, the easiest way is to use Simulink support package and put your MATLAB function inside a MATLAB function block. Although I am not sure if the serialdev, read and write command is going to work there (just that I have never tried it).

Community Treasure Hunt

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

Start Hunting!