Serial data cannot be read properly

9 ビュー (過去 30 日間)
Daniel Ramos
Daniel Ramos 2018 年 5 月 29 日
I am trying to get USB-to-serial communication from a Linux laptop (running Centos 6) to an RS422 device. The device passes about 1500 bytes of data in the form of three 512 byte packets every few seconds, but I have not been able to read this through Matlab.
I've used cutecom to verify that the data is in fact coming through. I have Matlab set up so that it does recognize the device when I run seriallist, and I am able to open it with:
s = serial('/dev/ttyUSB0','BaudRate',400000,'Timeout',5,'InputBufferSize',1024);
fopen(s);
This is code that has been confirmed to work on another computer, and the baudrate has been confirmed to be 400k. When I try using:
temp = fread(s,s.InputBufferSize,'uint8');
I get randomly sized data with seemingly random values. Does anyone have any recommendations on how I should proceed from here?

回答 (0 件)

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by