필터 지우기
필터 지우기

Serial Port not writing

조회 수: 10 (최근 30일)
John
John 2014년 8월 7일
답변: John 2014년 8월 7일
In Matlab 2014a (on ubuntu 12.04, 64-bit), a serial port that I'm writing to doesn't actually output anything from the FTDI-RS232 cable. As seen by a scope, no bits are being sent, the line remains high. There is no matlab error, and "ValuesSent" increments as it should every time i "transmit". However, TransferStatus remains idle all the time.
I can read data IN to matlab over another serial port just fine, but i'm not trying to write to that one. Thoughts on why a port wouldn't be writing? I have given the appropriate read-write privileges to the port, and if i didn't I'd get a port-open error. No flow control is needed.
s = serial('/dev/ttyUSB2','BaudRate',115200,'DataBits',8, 'StopBits', 1);
fopen(s);
s.FlowControl = 'none';
fprintf(s, '%s', 'asbc');
---------------------
get(s) gives:
ByteOrder = littleEndian
BytesAvailable = 0
BytesAvailableFcn =
BytesAvailableFcnCount = 48
BytesAvailableFcnMode = terminator
BytesToOutput = 0
ErrorFcn =
InputBufferSize = 512
Name = Serial-/dev/ttyUSB2
ObjectVisibility = on
OutputBufferSize = 512
OutputEmptyFcn =
RecordDetail = compact
RecordMode = overwrite
RecordName = record.txt
RecordStatus = off
Status = open
Tag =
Timeout = 1
TimerFcn =
TimerPeriod = 1
TransferStatus = idle
Type = serial
UserData = []
ValuesReceived = 0
ValuesSent = 260
SERIAL specific properties:
BaudRate = 115200
BreakInterruptFcn =
DataBits = 8
DataTerminalReady = on
FlowControl = none
Parity = none
PinStatus = [1x1 struct]
PinStatusFcn =
Port = /dev/ttyUSB2
ReadAsyncMode = continuous
RequestToSend = on
StopBits = 1
Terminator = CR/LF

답변 (2개)

John
John 2014년 8월 7일
Huh, turns out it was a bad usb to serial cable. Lost hours on this, but it does work now.

alican kara
alican kara 2020년 7월 14일

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by