AXM0F343 uart interrupt - read single char (AXM0F343-64-1-TX40)

Hello
we are new to AXM0F343-64-1-TX40

  1. Can you please show us a simple Single char read by uart interrupt .
  2. How Do we define the call back ?
  3. What example code best to implement the code .

thanks in advanced
Yaniv

Hey Yaniv,

Let me know if you ever figure out how to define a call back function. But if you still need to do a quick uart interrupt, I found that you can use the GPIO_Exception_Handler() in the app.c file. Just declare your uart pins and initialize the RX pin as an interrupt as well.

UART_Init(eUsart0,TX_Pin,RX_Pin,115200UL,NULL);
GPIO_IntEnable(RX_Pin);

if(GPIO_ReadIntStatus(RX_Pin))
{
UART_Receive(eUsart0,myData,sizeof(myData),BLOCK);
printf( “Change \n”);
GPIO_ClearIntStatus(RX_Pin);
}

1 Like

Hi Yaniv,
the UART example from the AXM0F343 CMSIS pack showcases exactly this functionality.

.
As you can see in the app.c code of the example, the UART and callback get all initialized by the function status = UART_Init(eUsart1, UART1_TX, UART1_RX, UART1_BAUD_RATE,UART1Event) , where UART1Event is the callback function declared in the same file.
The example sends up to 5 chars from the uart_rxbuf (with UART_Send(eUsart1, uart_rxbuf, DATA_LENGTH, BLOCK)) and waits to receive 5 chars ( UART_Receive(eUsart1, uart_rxbuf,DATA_LENGTH,NON_BLOCK).
You can change the number of chars by modifying DATA_LENGTH.