Serial Port not writing

7 views (last 30 days)
John
John on 7 Aug 2014
Answered: John on 7 Aug 2014
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

Answers (2)

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

alican kara
alican kara on 14 Jul 2020

Categories

Find more on Visualization and Data Export in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!