Serial Port not writing
8 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!