Uart Callback function only getting two bytes

Hello all,

Does anyone know why the callback function only gets the first two chars of a string? I thought it was suppose to trigger off each incoming byte.

Parents Reply Children
  • void uart1_callback(uart_callback_args_t *p_args)  //uart event callback function prototype
    {
       fsp_err_t err = FSP_SUCCESS;
        g_uart_event = p_args->event;
        /* Handle the UART event */
        switch (p_args->event)
        {
            /* Received a character */
            case UART_EVENT_RX_CHAR:
            {
    
                /* Only put the next character in the receive buffer if there is space for it */
                if (sizeof(g_out_of_band_received) > g_out_of_band_index)
                {
                    /* Write either the next one or two bytes depending on the receive data size */
                    if (UART_DATA_BITS_8 >= g_uart0_cfg.data_bits)
                    {
                        g_out_of_band_received[g_out_of_band_index++] = (uint8_t) p_args->data;
    
                    }
                    else
                    {
                        uint16_t *p_dest = (uint16_t*) &g_out_of_band_received[g_out_of_band_index];
                        *p_dest = (uint16_t) p_args->data;
                        g_out_of_band_index += 2;
                    }
                }
    
                break;
            }
                /* Receive complete */
            case UART_EVENT_RX_COMPLETE:
            {
                g_receive_complete = 1;
                break;
            }
                /* Transmit complete */
            case UART_EVENT_TX_COMPLETE:
            {
                g_transfer_complete = 1;
                break;
            }
            default:
            {
    
            }
        }

    How do I get this call_back function to read more than bytes? I am using RTOS and not sure if this has anything to do with my issue.