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.

PROCESSOR-SDK-AM437X: Linux-RT, serial open function hangs

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: AM4377

Hi,
I am using 4.19 rt-linux with am4377
I have basic a serial read task as given below: 

void uartRead(){

    osal_usleep(1'000'000);
    Vector axesVal;
    bool snyc_ = false;

    int uart_filestream = -1;
    uart_filestream = open("/dev/ttyS1", O_RDWR | O_NOCTTY);
    //Open in blocking read/write mode
    if (uart_filestream == -1)
    {
            printf("Unable to open UART\n");
            return ;
    }



My main calls the task as follows and waits for join

osal_thread_create_rt( &uart_t  , stack64k*4, (void *) &uart_task,  (void*) nullptr, 20);

When i send a SIGINT,  the program closes however next time i run it, my program waits for open() to return a valid file descriptor, and in some cases although  it returns a valid file descriptor(sometimes takes a few seconds) it halts my program, and cannot accept a SIGINT, kernel goes into some uninterruptable process and become unresponsive, it immedately freezes and requires a reboot.
I though i should close the port before exiting the problem, put a signal handler for SIGINT, in order to close the port before exiting however it did not solve it.

I made a search on net, found a similar issue: 
https://stackoverflow.com/questions/4064832/open2-function-hangs-when-trying-to-open-serial-port-in-macos

It's the same problem that occurs in macos, i am not sure the cause is the same.

Thanks!