Hi, Drew,
I see your question now, but I am not sure if it is a bug or not. In the interrupt service routine function void UART_DRV_IRQHandler(uint32_t instance), there is the line:
if((UART_HAL_GetRxDataRegFullIntCmd(baseAddr))
&& (UART_HAL_IsRxDataRegFull(baseAddr)))
{
UART_HAL_Getchar(baseAddr, uartState->rxBuff);
}
it gives the information, after the Kinetis UART receive a char, the function UART_HAL_Getchar() will be executed, the uartState->rxBuff pointer should have been initializerd, but in some case, it is not. Of course, the uartState structure pointer has been initialized in the UART_DRV_Init(), but the uartState->rxBuff is not initialized if you do not call the two function:
static uart_status_t UART_DRV_StartReceiveData(uint32_t instance,
uint8_t * rxBuff,
uint32_t rxSize)
or
uart_rx_callback_t UART_DRV_InstallRxCallback(uint32_t instance,
uart_rx_callback_t function,
uint8_t * rxBuff,
void * callbackParam,
bool alwaysEnableRxIrq)
Pls call the UART_DRV_StartReceiveData() function after the UART_DRV_Init() so that the rxBuff pointer can be initialized if your UART want to receive data.
Pls have a try.
BR
XiangJun Rong
typedef struct UartState {
uint8_t txFifoEntryCount; /*!< Number of data word entries in TX FIFO. */
const uint8_t * txBuff; /*!< The buffer of data being sent.*/
uint8_t * rxBuff; /*!< The buffer of received data. */
volatile size_t txSize; /*!< The remaining number of bytes to be transmitted. */
volatile size_t rxSize; /*!< The remaining number of bytes to be received. */
volatile bool isTxBusy; /*!< True if there is an active transmit. */
volatile bool isRxBusy; /*!< True if there is an active receive. */
volatile bool isTxBlocking; /*!< True if transmit is blocking transaction. */
volatile bool isRxBlocking; /*!< True if receive is blocking transaction. */
semaphore_t txIrqSync; /*!< Used to wait for ISR to complete its TX business. */
semaphore_t rxIrqSync; /*!< Used to wait for ISR to complete its RX business. */
uart_rx_callback_t rxCallback; /*!< Callback to invoke after receiving byte.*/
void * rxCallbackParam; /*!< Receive callback parameter pointer.*/
} uart_state_t;