This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am335x UART problem

Dear all,

I'm using a beaglebone as a developement platform for a system based on am335x.

Kernell:  3.2.0

OS: Ubuntu 12.0.4 LTS

this is a grep on dmesg:

usb 1-1: cp210x converter now attached to ttyUSB0

This lead to my question.

I'm using a virtual tty device (ttyUSB0) for comunicate with a remote device. After about one hour of continuous comunication (cyclic open-transmit-receive-close) I get a strange behaviour of read(). If the UART is opened in blocking mode the read hangs forever (no matter what value I set on VMIN&VTIME). If I open it in non-blocking mode it return -1 for ever (after 1 hour). Now I'm using select() to check if there is data to be read. In case I receive a negative result from select, how can I handle the error? What is a good practice? I have to restart the service?

This code is a part of a service that start at boot time(with upstart). When it hangs, if I restart it, it works again. The restart do not have any effect on the device with which I'm communicating. It works properly.

This is a piece of code, just for completeness:

        FD_ZERO(&set); /* clear the set */
        FD_SET(tty_fileDescriptor, &set); /* add our file descriptor to the set */
        timeout.tv_sec = 10;
        timeout.tv_usec = 0;
        rv = select(tty_fileDescriptor + 1, &set, NULL, NULL, &timeout);
        if(rv>0){
            letti=read(tty_fileDescriptor,payLoadTMP,300);
        }if(rv<0){
                  perror("select")
                   //what to do here to re-stablish communication?
        }

The perror's output is:

select: Resource temporarily unavailable
any ideas? How to re-stablish connection?
I'm thinking that probably is a kernel problem.