Part Number: AM2434
Hi Team,
Posting on behalf of our customer.
We're developing an industrial protocol module. Before that, we're testing its performance using an LP board.
I have a question while implementing the uart layer of our product.
Both tx and rx of UART use callback functions as interrupts.
An issue has occurred in the RX function.
The initialization is as follows:
UART_Transaction_init(&rx_trans);
------------------------------------------------------------------
static UART_Transaction rx_trans; /* global veriable */
------------------------------------------------------------------
int32_t status;
tErr t_ret = ER_OK;
UART_Transaction_init(&rx_trans);
pfUART1RxCallback = pf_callback;
rx_trans.buf = &u8Ch1Buf;
rx_trans.count = sizeof(u8Ch1Buf);
status = UART_read(gUartHandle[CONFIG_UART_CONSOLE], &rx_trans);
if (status != UART_STATUS_SUCCESS) {
DebugP_log("UART_read failed2: %d\n", status);
}
return t_ret;
------------------------------------------------------------------
When using the UART_read API function in initialization, the status value is returned as UART_STATUS_SUCCESS, indicating normal operation.
------------------------------------------------------------------
int32_t status;
uint32_t gNumBytesRead = 0U;
if (NULL != pfUART1RxCallback)
{
pfUART1RxCallback(&u8Ch1Buf, sizeof(u8Ch1Buf));
}
trans.buf = &u8Ch1Buf;
trans.count = sizeof(u8Ch1Buf);
status = UART_read(gUartHandle[CONFIG_UART_CONSOLE], &trans);
if (status != UART_STATUS_SUCCESS) {
DebugP_log("UART_read failed1: %d\n", status);
}
if (gUartHandle[CONFIG_UART_CONSOLE] == NULL)
{
DebugP_log("UART handle NULL!\n");
}
return;
------------------------------------------------------------------
In the callback function, an interrupt occurs only once, the return value of the UART_read function is '-1', and no more interrupts occur.
Why is this happening? Please suggest a reason and a solution.
Regards,
Danilo