Serial data cannot be read properly
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Install Products en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!