Hi,
I make the two CAN wires (CAN_High and CAN_Low) short curcuit without sending any frame to MCU. Call the lib function FLEXCAN_DRV_Init(INST_CAN0COM, ...) and read the CAN_ESR1, the value of CAN_ESR1 is 0x280036 at the first time . and then, I call the FLEXCAN_DRV_Deinit(INST_CAN0COM) ,FLEXCAN_DRV_Init(INST_CAN0COM, ...) and read the CAN_ESR1 again, the value of CAN_ESR1 become 0x40080. It keep this value all the time, even though separete the two CAN wires.
So, could the CAN_ESR1 report the real CAN status in time?
Here is my gold: detect the CAN status whether normal or bus-off. send the standard frame if normal status, otherwise call the FLEXCAN_DRV_Init to initialize the CAN and detect the status again till entering normal status , record the number of entering bus-off status.
But the CAN_ESR1 could not report the real status in time, How to achieve this target?
BR,
shingo