I recently bought a TrendNet TU-S9 USB to RS232 converter. I need to talk to microcontrollers that use RS232 at 9600 baud. The code I have for a Linux box works fine. I installed the drivers according to the instructions on my laptop and a Mac Mini both running OS X 10.6.7. I changed the device to /dev/cu.usbserial.
Here's what happens. It sure does look like communication will work the first time I try it. But if I exit the process I can't write to the serial device anymore. If I unplug the USB connection and plug it in again, then I can go one more time. I.e. it looks like plugging in the USB connector is what is necessary to get things reset to a usable state.
When I get the error the second time I try to start the process, I can open the device, but the error happens the first time I try to send a byte over the serial interface. The error from perror is "Serial: No such file or directory".
I can get around this problem by writing a second program that merely opens the cu.usbserial device and then loops forever. This doesn't seem like the best way to fix it, though.
Has any one seen this behavior? Can anyone replicate it? Does anyone know how to fix it?
Note: this might be related to a previous post Programmatically talking to a Serial Port in OS X or Linux, or it might not.
Eric