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.

AM263P4: UART HLD – UART_read() function in RxCallback

Part Number: AM263P4

Tool/software:

Hi, 

When I call UART_read() again from inside the Rx callback, the callback is invoked only once (no subsequent callbacks).
When I call UART_read() from a task/background context, the callback is invoked repeatedly as expected. Why? I want to handle this situation in rxcallback function.

static UART_Transaction newTrans;
static volatile uint8_t rxBuf[8];

void UART_RX_Callback(UART_Handle handle, UART_Transaction *trans)
{

UART_read(handle, &newTrans);
}

void UART_TX_Callback(UART_Handle handle, UART_Transaction *trans)
{

}

void empty_main(void *args)
{
/* Open drivers to open the UART driver for console */
Drivers_open();
Board_driversOpen();

UART_Transaction_init(&newTrans);
newTrans.buf = (void *) rxBuf;
newTrans.count = 8;

UART_read(gUartHandle[CONFIG_UART0], &newTrans);

while(1);
Board_driversClose();
Drivers_close();
}

  • Hi Burak,

    From application architecture perspective, it is better to have all the UART_read and UART_write related transactions happening through the main task. The sample codes in the SDK handle the flow through semaphores to keep the operations blocked. 

    In this case, you can pend the semaphore when UART_read() is called from main task, then post the semaphore in the callback function, then pend again while calling another transaction.

    Can you please help me understand why you wish to call another uart API in the read callback? The UART callback functions should be brief to not disrupt timing.

    Regards,
    Shaunak