AX5043 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

Hello Yaniv,
please download the latest CMSIS pack from Software: AXM0F343 (onsemi.com) and check out the “UART” example.
Navigating through the code you can analyze how the function UART_Receive(eUsart1, uart_rxbuf, DATA_LENGTH, NON_BLOCK) is implemented in drv_uart.c, with a blocking (polling) or non-blocking (interrupt), method:

uint32_t DRV_UART_Receive( void* uart, void *data, uint32_t num, bool bBlock )
{
    uint32_t i;
    uint8_t *pData = (uint8_t *)data;
    usart_device_pt pUart = (usart_device_pt)uart;
    uint16_t regData;

    VERIFY_UART_IS_NULL(uart);

    VERIFY_UART_BASE_VALID(pUart->p_base_reg);

    VERIFY_UNINIT(pUart->b_initialized);

    hw_uart_write_rx_en(pUart->p_base_reg, ENABLE);

    pUart->b_block_rx = bBlock;
    if ( !bBlock )
    {
        pUart->p_rx_data = pData;
        pUart->rx_expected = num;
        pUart->rx_bytes = 0;

        /* enable interrupt */
        hw_uart_write_rx_int_en(pUart->p_base_reg, ENABLE);
    }
    else
    {
        for ( i = 0; i < num; i++ )
        {
            /* wait till RxFull */
            while (!pUart->p_base_reg->STS_b.RX_FULL);
            regData = pUart->p_base_reg->DATA;
            if (checkParity(pUart, regData))
            {
                *pData++ = (uint8_t)regData;
            }
            else
            {
                pUart->cb_event(UART_EVT_RX_ERROR);
            }
        }
        hw_uart_write_rx_en(pUart->p_base_reg, DISABLE);
    }

    return (DRV_OK);
}

thanks

but when changing the DATA_LENGTH to 1 or DATA_LENGTH 10 , then the example is not working well … if sending from terminal 1 chars or 10 chars …causing to returns false chars …
please advice …

for example changing DATALENGHT to 10 and send from terminal to mcu uart

“1234567890-3792179” more then 10 chars
is echo me back
12531
??@
23

and not “1234567890” as expected
generally i would like rxbuf to be 80 chars and when user ENTER or rxbuf is 80 chars it will flush back as an echo
or in future used to send the rxbuf to the radio tx …so please you help