I've configured UART in callback mode and it appears to be working correctly when I call UART_read from my task function. I'd like to know more about the buffer used in UART_read() and the buffer used by the callback function, typedef void(* UART_Callback) (UART_Handle handle, void *buf, size_t count). From my testing, it appears that the UART_read(buffer) is receiving the message correctly, but the callback buffer is pointing to a different memory address.
I would like to be able to post to a Mailbox from within the read callback function, and then use a mailbox pend from the task function.
static int wait_for_msg_thread(void)
{
FOREVER
{
//READ
UART_read(s_uart_id, s_msg, S_MESSAGE_LENGTH);
/* Get the next message from the queue */
Mailbox_pend(isr_queue, s_msg, BIOS_WAIT_FOREVER)
}
}
void receive_msg_callback(UART_Handle handle, void *msg_in_DPRAM,
size_t msg_length)
{
if (msg_length != S_MESSAGE_LENGTH)
{
return;
}
/* Put the message in a message queue */
Mailbox_post(isr_queue, (char *) msg_in_DPRAM, BIOS_NO_WAIT);
}
The msg_in_DPRAM is not correct and is putting bad messages into the Mailbox. However, UART_read() buffer is getting the correct messages.
