I recently bought a TrendNet TU-S9 USB to RS232 converter. I need to talk with microcontrollers that use RS232 at 9600 baud. The code I have for Linux works fine. I installed the drivers according to the instructions on my laptop and Mac Mini running OS X 10.6.7. I changed the device to /dev/cu.usbserial.
This is what happens. Of course, it looks like communication will work the first time I try. But if I exit the process, I can no longer write to the serial device. If I disconnect the USB connection and reconnect it, I can go again. That is, it looks like plugging in a USB connector is what is needed so that things reset can be used.
When I get an error, the second time I try to start the process, I can open this device, but the error occurs the first time when I try to send a byte via the serial interface. The error from perror is "Serial: there is no such file or directory."
I can work around this problem by writing a second program that simply opens the cu.usbserial device, and then cyclically forever. This does not seem to be the best way to fix this.
Has anyone seen this behavior? Can anyone repeat it? Does anyone know how to fix this?
Note: this may be due to a previous message programmatically talking to the serial port in OS X or Linux , or it may not be so.
Eric
source share