[En-Nut-Discussion] Any way to get an interupt (NutEventWait) when a UART RX buffer has something in it?

zonedar sholder at summitsemi.com
Fri Nov 8 20:44:31 CET 2013


Hi  all

I've got a UART (ARM7) that may get unexpected asynchronous input.  I have
multiple threads running and if the UART gets something, I like to switch
that thread and service the UART (read the buffer).

  Is there a something like an internal interrupt that I can use or some how
use NutEventWait?

  Right now I'm polling and checking the buffer.  It works but I don't like
it and I'm afraid it's slow and I might be missing something.

THREAD( AppCommandServer, arg)
{
[...]

    for(;;)
    {
        int j;
        NutSleep(250);

        parm = 1;  //textmode
        _ioctl(_fileno(cons), UART_SETCOOKEDMODE, &parm);
        _ioctl(_fileno(cons), UART_GETSTATUS, &parm);
        if  (parm & UART_RXBUFFEREMPTY)  //if empty
        {
           // printf("RX: Buffer Empty\n");
        }
        else
        {
         [...]
        }

     }  //end of for(;;)
}


Thanks!

 -Steve



--
View this message in context: http://microcontrollers.2385.n7.nabble.com/Any-way-to-get-an-interupt-NutEventWait-when-a-UART-RX-buffer-has-something-in-it-tp186013.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.


More information about the En-Nut-Discussion mailing list