필터 지우기
필터 지우기

Properly reading (mid)stream data

조회 수: 1 (최근 30일)
Jason Gauthier
Jason Gauthier 2018년 5월 22일
편집: Jason Gauthier 2018년 5월 22일
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기

제품


릴리스

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by