客户使用的SDK 版本为 SDK 3.0.0
根据数据手册,S32K14X CAN进入freeze mode需要按照以下顺序
1. Set both CAN_MCR[FRZ] (Freeze Enable) and CAN_MCR[HALT] (Halt) to 1.
2. Check whether CAN_MCR[MDIS] (Module Disable) is set to 1. If it is, clear it to 0.
3. Poll the MCR register until CAN_MCR[FRZACK] (Freeze Mode Acknowledge) is
set to 1 or the timeout is reached.
The minimum timeout duration must be equivalent to:
a. 730 CAN Nominal bits if CAN_MCR[FDEN] (CAN
FD Operation Enable) is set to 1 (CAN bits calculated
at arbitration bit rate),
b. 180 CAN bits if CAN_MCR[FDEN] is cleared to 0.
4. If CAN_MCR[FRZACK] is set to 1, no further action is required. Skip steps 5 to 8.
5. If the timeout is reached because CAN_MCR[FRZACK] remains cleared to 0, then
set CAN_MCR[SOFTRST] (Soft Reset) to 1.
6. Poll MCR until CAN_MCR[SOFTRST] is cleared to 0.
7. Reconfigure the Module Control register (CAN_MCR).
8. Reconfigure all the Interrupt Mask registers (CAN_IMASKn).
由于客户使用的SDK版本较早,CAN的驱动代码中,没有进行超时判断,导致卡死在Freezemode的进入判断
最新版本中,加入了Freezemode的timeout处理和CAN模块的软件复位,程序在LVD之后则不会卡死,且能正常初始化