S32 SDK error handling on CAN and UART communication

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32 SDK error handling on CAN and UART communication

1,568 Views
TomLightning
Contributor III

Hi,

I'm using the software development kit in my project and I'm also using the FLEXCAN and LPUART module to communicate.

I installed the following callbacks:

LPUART_DRV_InstallRxCallback(...);
FLEXCAN_DRV_InstallEventCallback(...);
FLEXCAN_DRV_InstallErrorCallback(...);

1. At which uart_even_t will the UART rx callback function be triggered?

2. At which flexcan_event_type_t will the event callback function be triggered?

3. At which flexcan_event_type_t will the error Callback function be triggered?

4. What is the right method to handle rx/tx errors? Abort the non-block transmission/reception and restart it after a callback function was called?

Best regards

Tom

0 Kudos
Reply
1 Reply

1,544 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I can recommend to look over drivers interrupt routines for better insight.

1) events for LPUART Rx Event callback are

UART_EVENT_RX_FULL = 0x00U, /*!< Rx buffer is full */
UART_EVENT_END_TRANSFER = 0x02U, /*!< The current transfer is ending */
UART_EVENT_ERROR = 0x03U, /*!< An error occured during transfer */

2) events for FlexCAN Event callback are

FLEXCAN_EVENT_RX_COMPLETE, /*!< A frame was received in the configured Rx MB. */
FLEXCAN_EVENT_RXFIFO_COMPLETE, /*!< A frame was received in the Rx FIFO. */
FLEXCAN_EVENT_RXFIFO_WARNING, /*!< Rx FIFO is almost full (5 frames). */
FLEXCAN_EVENT_RXFIFO_OVERFLOW, /*!< Rx FIFO is full (incoming message was lost). */
FLEXCAN_EVENT_TX_COMPLETE, /*!< A frame was sent from the configured Tx MB. */
FLEXCAN_EVENT_DMA_COMPLETE, /*!< A complete transfer occurred on DMA */
FLEXCAN_EVENT_DMA_ERROR, /*!< A DMA transfer fail, because of a DMA channel error */

3) events for FlexCAN Error callback is just

FLEXCAN_EVENT_ERROR

4) yes, you can abort message. Some example for CAN callbacks can be found on 

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-FlexCAN-TX-RX-Error-ISR-test-S32DS2...

BR, Petr

0 Kudos
Reply