Hi,
I am using an IMXRT1021 with flexCAN on a 1mbit CAN bus (existing product that has had CAN added in a recent edition).
This mostly works well, and CAN is sending and receiving without issue.
However if there is a physical event on the CAN bus (such as a large noise spike, or the CAN bus lines being shorted) the CAN module seems to get stuck, not being able to send or receive. If this happens it is mostly in CAN_STATE_ERROR_PASSIVE, but sometimes can be CAN_STATE_ERROR_BUS_OFF.
When this happens, the scoping the CAN bus shows it is idle, and the registers are as follows:
the CAN status to our CAN callback is 0x14be (kStatus_FLEXCAN_ErrorStatus)
FLEXCAN_GetStatusFlags() gives 0x40118 (ERROR_PASSIVE | RX_WRN | SYNCH)
CAN_PERIPHERAL->IFLAG1 = 0
CAN_PERIPHERAL->ESR2 0x6000 (same as before it goes into this state)
CAN_PERIPHERAL->DBG1 = 0x2000032 (counting through 0x1000032, 0x2000032, 0x4000032 etc)
CAN_PERIPHERAL->DBG2 = 0x3e (same as before the issue)
a DeInit and ReInit of the CAN peripheral doesn't fix this, and most concerningly nor does a soft reset of the processor. Only a power cycle recovers things.
After a soft reset, the state is :
the CAN status to our CAN callback is 0x0
FLEXCAN_GetStatusFlags() gives 0x0
CAN_PERIPHERAL->IFLAG1 = 0
CAN_PERIPHERAL->ESR2 0x6000
CAN_PERIPHERAL->DBG1 = 1000001
CAN_PERIPHERAL->DBG2 cycles through 0, 0xb700, 0xa000, 0x9000
This is using a MAX33015EATB CAN transceiver, and the bus is terminated with split-y termination 120 ohms at both physical ends of the bus.
Please ask if any more details are needed.
I would very much appreciate some help with this.
Thank you
解決済! 解決策の投稿を見る。
Hi @PeteA ,
Thanks for the information! You may put the CAN PHY reset code in the ISR to handle the event of CAN_STATE_ERROR_PASSIVE or CAN_STATE_ERROR_BUS_OFF, and you may change the pin mux of CAN tx line to set up a toggling on it.
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
It doesn't unfortunately.
However I have established that the CAN transceiver (MAX33015EATB ) has fault management, and can go into an error state if it detects an error condition.
This is very likely to be the cause (unfortunately the fault pin is not broken out so it is difficult to scope to check, but in my attempts at testing it appeared to be asserted).
This can be reset by toggling the CAN tx line, but I've just got to work out how to do this
Thank you for the help
Hi @PeteA ,
Thanks for the information! You may put the CAN PHY reset code in the ISR to handle the event of CAN_STATE_ERROR_PASSIVE or CAN_STATE_ERROR_BUS_OFF, and you may change the pin mux of CAN tx line to set up a toggling on it.
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi @PeteA ,
Will the device go back to error active state after some time?
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------