I use ADC to detect 12V power supply drops to 8V,then close the CAN TX
If the interrupt buffer have data,the MCU still to complete CAN transmit
At this moment the voltage drop,the MCU can not working
It might cause the CAN ERROR FRAME
How to solve this problem?
Let me think about your issue.
There are 3 Tx buffers. There is a possibility to abort any message while it is not in physical Tx buffer.
So, the easiest way is to
Abort Request — The CPU sets the ABTRQx bit to request that a scheduled message buffer (TXEx = 0) be
transmission is not successful (lost arbitration or error). When a message is aborted, the associated TXE (see
Section 16.3.2.7, “MSCAN Transmitter Flag Register (CANTFLG)”) and abort acknowledge flags (ABTAK, see
Section 16.3.2.10, “MSCAN Transmitter Message Abort Acknowledge Register (CANTAAK)”) are set and a
transmit interrupt occurs if enabled. The CPU cannot reset ABTRQx. ABTRQx is reset whenever the associated
TXE flag is set.
Initialization Mode Request — When this bit is set by the CPU, the MSCAN skips to initialization mode (see
Section 16.4.4.5, “MSCAN Initialization Mode”). Any ongoing transmission or reception is aborted and
synchronization to the CAN bus is lost. The module indicates entry to initialization mode by setting INITAK = 1
(Section 16.3.2.2, “MSCAN Control Register 1 (CANCTL1)”).
Best regards,
Ladislav
So when I detect 12V drops to 8V,then close the CAN TX and set ABTRQ=7(Abort all messages which are in remaining 3 Tx buffers)
Is it right?