Borrar filtros
Borrar filtros

Properly reading (mid)stream data

1 visualización (últimos 30 días)
Jason Gauthier
Jason Gauthier el 22 de Mayo de 2018
Editada: Jason Gauthier el 22 de Mayo de 2018
Greetings,
I'm using Simulink to develop/manage a control system. The model uses the Simulink coder, and gets deployed to a Gumstix Duovero (linux) and runs locally. I've connected a Raspberry Pi to the serial port, and will be using this method to communicate data between the two devices.
I'm currently using some addons from Quarc, and one of these is a stream server. (It's interface agnostic and can be TCP, UDP, serial, etc).
The challenge I am facing is that I'm using doubles, which are 8 bytes each. If I start up the application on the Duovero it immediately starts sending data out the serial port (and that's okay).
However, then the Raspberry Pi application starts, and it also starts reading and writing on the serial port. Since doubles are 8 bytes, it's extremely difficult to start reading midstream on both sides because you can't tell where one double ends and the next begins.
On the Pi, I believe I have a solution (still coding the test - python), which will do some trickery with reading 8 bytes sequentially from the serial port looking for a specific "start byte", and then I hope to sync up the streams.
However, I have absolutely no idea how to accomplish this in Simulink, since block itself sends the data out of its output as a specific length of data. I thought I would crafty and just send the data as ASCII (well, integers) but there is no way to actually convert a double into a string and send it over the line.

Respuestas (0)

Categorías

Más información sobre Raspberry Pi Hardware en Help Center y File Exchange.

Productos


Versión

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by