Common mistakes
Informative
Pitfalls when using the UART driver, and how to avoid them. Each maps to a rule in Uart — Requirements or an error in Errors.
Passing a real pointer to
Uart_Init.configPtrMUST beNULL_PTR— a non-null pointer raisesUART_DEVERR_PARAM_POINTER(CHI-UART-MUST-06). The configuration is selected at build time.Expecting reception right after
Uart_Init. No frames are received untilUart_StartRxTransactionis called (CHI-UART-MUST-06).Freeing the buffer too early.
txDataPtr/rxDataPtrmust stay valid until the matching callout fires (Uart_Callout_OnTransmission/Uart_Callout_OnStreamingDataRequest/Uart_Callout_OnReception) (CHI-UART-MUST-08, CHI-UART-MUST-12).Mixing the two TX callback styles. A channel is either
HwCompletion(Uart_Callout_OnTransmission) orStreaming(Uart_Callout_OnStreamingDataRequest) — never both. Implement the one your channel is configured for (CHI-UART-MUST-11).Treating
Uart_Callout_OnStreamingDataRequestas “sent”. It fires when the software buffer empties; the hardware FIFO/shift register may still be draining. UseHwCompletionif you need a true on-the-bus confirmation (CHI-UART-MUST-10, CHI-UART-MUST-11).Losing bytes on buffer switch. To keep receiving without gaps, call
Uart_StartRxTransactionfrom insideUart_Callout_OnReception; if you don’t, the driver stops reception after the callout returns (CHI-UART-MUST-14).Calling
Uart_SetAdditionalRxLenTrgoutside the callout. It may be called only from withinUart_Callout_OnReception(CHI-UART-MUST-15).Starting a TX while
BUSY.Uart_StartTxTransactionis accepted only inIDLEor (streaming)READY; otherwise it raisesUART_DEVERR_INVALID_CH_STATE(CHI-UART-MUST-20).Forgetting to service polled channels. A
Pollingchannel needsUart_PollFunctioncalled cyclically, or no transfer progresses and no callout fires (CHI-UART-MUST-18).