Reputation: 2846
I've been working on an Arduino project that needs to communicate with a (Debian) Linux NAS via USB.
It communicates perfectly reliably with a Windows terminal.
The communication with Linux is quite bad.
Here's my test application for this communication:
void setup(void) {
Serial.begin(9600, SERIAL_8N1);
}
void loop(void) {
do {
Serial.println("1234567890");
delay(1000);
} while (true);
}
OSEPP Nano Arduino to Windows: With the OSEPP Nano Arduino, the communication looks like this with Windows:
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
(forever, ok)
OSEPP Nano Arduino to Linux on QNAP NAS: With the OSEPP Nano Arduino, the communication looks like this with Linux on an QNAP NAS:
[~] # busybox stty -F /dev/ttyUSB0 cs8 9600 opost -ixon -ixoff -cstopb -parenb
[~] # screen /dev/ttyUSB0 –fn
/var/run/utmp: No such file or directory
15
59
1351159113
51115353579779
9
79111137311371
11131131359
11579
11711359
7139
357
35
3130577917931359
39
913717117
31
1313315791113579
133
373
The fact that even numbers almost never appear should be a clue to this problem. I selected different serial parameters in both the Arduino program and also the Linux command but was only able to make it much, much worse (by "worse", I mean no characters being received correctly).
OSEPP ATMega2560 Arduino to Linux on QNAP NAS: This looked useful at first but it didn't work for long.
[~] # busybox stty -F /dev/ttyUSB0 cs8 9600 opost -ixon -ixoff -cstopb -parenb
[~] # screen /dev/ttyUSB0 –fn
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
1234567890
CC�������CC�����C�������CC����CC�
I tried it a few times with surprisingly similar (not identical) results.
Arduino Duemilanove:
[~] # busybox stty -F /dev/ttyUSB0 cs8 9600 opost -ixon -ixoff -cstopb -parenb
[~] # screen /dev/ttyUSB0 –fn
/var/run/utmp: No such file or directory
1713
371
3579
137557
5379
359599
371591311533609
597
3579
1391913
15359
16813579
15
715715379
11375
551135
7
135513311993
51791357
15959
1111919
113
Arduino Lilypad Similar results to Nano & Duemilanove.
Question: Does anyone know why this would be happening? I'd prefer to use the "Nano" Arduino since this project only needs a few I/O lines anything larger would be an over-kill.
Is the Arduino USB implementation incompatible with Linux in some way?
Thank you for any insights you can give!
Upvotes: 0
Views: 940
Reputation: 798794
Linux does not prevent multiple processes from opening a serial port, and if more than one of them reads from the port then the other processes will miss any such data read. Verify that no other processes have the serial port open.
Upvotes: 0