I am using openwrt (an embedded linux that runs on routers). I am using a USB-to-serial converter that shows up as /dev/ttyACM0
.
[ 2430.460000] usb 1-1: new full-speed USB device number 4 using ehci-platform
[ 2430.630000] cdc_acm 1-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 2430.630000] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
I wrote a small code for openwrt which opens the given serial port, /dev/ttyACMO
, waits on a select()
system call for read/write events on the serial port fd
.
Whenever a read event occurs the message is dumped to stdout
.
I have not enabled the hardware flow control on the serial port.
I made the connected peripheral send some predefined message every 2 second on the serial link.
Now when I run my code in openwrt to print the serial message, I am able to see the message coming from the peripheral.
The problem is after few minutes the serial link drops dead. There are no more read events on the serial interface.
Resetting the peripheral also does not help. The only way to make it work again is to completely remove the peripheral from the USB and start again.
The same setup works perfectly fine on my Ubuntu box. I use the same driver interface, i.e. usb-acm (in /dev/ttyACM0
). Here the system keeps running forever without the serial hangup.
Any idea or suggestion on what's happening?