fopen() error with serial device

Hi,
under Linux we'd like to send a text string to a serial device:
% --- code ---> >> s = serial('/dev/ttyS0');
% a serial object s is returned
>> set(s,'BaudRate',19200); % adjust the baudrate
>> fopen(s)
Error using serial/fopen (line 72) Open failed: Port: /dev/ttyS0 is not available. No ports are available. Use INSTRFIND to determine if other instrument objects are connected to the requested device.
% the serial device is still there
>> instrfind
Serial Port Object : Serial-/dev/ttyS0
Communication Settings
Port: /dev/ttyS0
BaudRate: 19200
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
% --- code ---<
Are there special toolboxes neccessary to connect to a serial device?
Regards, Roger

1 Commento

2000rogers
2000rogers il 20 Giu 2013
It occurs to be a group-rights related problem since the device is root/dialout
sudo usermod -a -G dialout myuser
cures the problem.
Regards, Roger

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Data Acquisition Toolbox in Centro assistenza e File Exchange

Prodotti

Richiesto:

il 20 Giu 2013

Community Treasure Hunt

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

Start Hunting!

Translated by