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.

TI-RTOS UART INTERRUPT /CALLBACKS

Hi everyone, I would like to start using UART on my device which has  a TIVA C and TI-RTOS.

I have already used many features of TIVA and RTOS so I am quite familiar  with RTOS , drivers...ad so on.

As usual I started looking documentations and examples but there is something I don't understand and I would like to have some directions or links to a clarifying  example.

I want to use callbacks , so every time I receive or send something through UART  I  use the callbacks to process data. I saw that I can set the callbacks in the params like this:

uartParams.readCallback = UART_Callbk_read;
uartParams.writeCallback = UART_Callbk_write;

I see that I can use an interrupt (#define INT_UART1_TM4C123       22          // UART1)  and define a interrupt callback in the *cfg of the RTOS (as I did for other features).

How this callback is related to the uartParams.readCallback  and uartParams.writeCallback ?

I did not find an example that show this configuration?

if I define UART_Callbk_read and UART_Callbk_write inside the parameter where should I implement them?

Thanks

G.

  • Hi Gianluca,

    The parameters readCallback and writeCallback point to user functions that are called when the UART driver is set in mode UART_MODE_CALLBACK (non-blocking mode), to notify of the completion of a UART_read or UART_write call. So as the application writer you are expected to provide implementation for these functions (to do whatever you wish to do after the completion of the transfer). When you use the UART driver, the driver internally sets up the Hwi instance to handle the interrupts when the driver is opened. See the code for UARTTiva_open() in <TIRTOS_INSTALL_DIR>/pacakges/ti/drivers/uart/UARTTiva.c for details if you are interested. There is also documentation for the UART driver in <TIRTOS_INSTALL_DIR>/docs/doxygen/html/index.html under the UART driver interface.

    Best regards,
    Vincent