Serial Port not writing

7 次查看(过去 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 中查找有关 Visualization and Data Export 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by