IMXRT1171 FlaxCAN Error Handling

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

IMXRT1171 FlaxCAN Error Handling

1,391 Views
Seunghyup
Contributor I

Hello,

I am currently working on a company project using a custom board based on the i.MXRT1171. Additionally, I have an EVB1176 B version kit available for reference.

During a test scenario where the CAN Bus line after the CAN transceiver experiences a short circuit, TX-related errors occur, leading to an increase in TXERRCNT and triggering the TXWRN interrupt.

I am attempting to notify users about CAN transmission issues and implement a handler to restore normal operation. However, while TXWRN is cleared upon retransmission, TXERRCNT remains persistently high, causing the TXWRN interrupt to repeatedly occur.

From my understanding, TXERRCNT can only be controlled in Freeze mode. In normal operation mode, is a soft reset the only solution to this issue? Alternatively, is there any sample code for handling CAN errors?

Thank you for your assistance.

0 Kudos
Reply
3 Replies

1,315 Views
mayliu1
NXP Employee
NXP Employee

Hi @Seunghyup ,

 

Thank you so much for your interest in our products and for using our community.

MIMXRT1170RM described Transmit Error Counter TXERRCNT  is read only except in Freeze mode, where it can be written by the CPU.

https://www.nxp.com/webapp/Download?colCode=IMXRT1170RM

mayliu1_0-1732848771443.png

For your other question, I suggest you can refer to Chapter 66.6.2.8 Error Counter (ECR) in MIMXRT1170RM.

mayliu1_1-1732848878410.png

mayliu1_2-1732848884301.png

Wish it helps you.
If you still have question about it, please kindly let me know.

Best Regards

mayliu

 

0 Kudos
Reply

1,378 Views
carolgrey98
Contributor I

To manage TX-related errors and the TXERRCNT issue on your custom i.MXRT1171 board, you can enter Freeze mode to reset the TXERRCNT. If the TXERRCNT remains high, a soft reset can clear it. Implementing error handling code to notify users and manage retransmissions can also help restore normal operation. Here's a brief example: Child Proxy Form
void CAN_ErrorHandler(void)
{
FLEXCAN_EnterFreezeMode(CAN_BASE);
FLEXCAN_ResetTransmitErrorCounter(CAN_BASE);
FLEXCAN_ExitFreezeMode(CAN_BASE);
NotifyUser();
}

Best regards,
Carol Grey

0 Kudos
Reply

1,367 Views
Seunghyup
Contributor I
Thank you for your suggestion. By using Freeze Mode to reset TXERRCNT and clear TWRNINT during CAN bus recovery after TX output, we successfully restored normal operation. Your guidance was very helpful, and we truly appreciate your support.

However, if the CAN bus (physical bus line) is not reconnected after TX output, TX transmission continues indefinitely.

Could you provide information or guidance on how to stop TX output in such cases? We are considering the following sequence:
CAN transmission -> Error -> TX halt -> Error interrupt handling and TX-related reset -> Normalization.

To clarify, the physical CAN bus refers to the CAN H/L bus line located after the transceiver. Currently, there is no termination resistor on the board itself; the termination resistor will be added to the external CAN bus line. Our goal is to ensure proper handling of errors and recovery when our board is either properly connected to the actual CAN bus or disconnected. Specifically, we are focused on handling errors during CAN transmission when the bus is not connected and achieving proper recovery.

Once again, thank you for your assistance.
0 Kudos
Reply