CAN_DeInit API Error

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

CAN_DeInit API Error

Jump to solution
603 Views
Embedded_novice
Contributor III

HI.

I attempted to shut down the CAN controller before the BOOTLOADER jumped to the APP, but when I called CAN_DeInit, it actually wasn't re-initialized, resulting in incorrect frames being sent on the CAN bus after the jump. I would like to know if there are any problems with this logical judgment. I have set CtrlState to TRUE, but the reverse initialization requires it to be FALSE in order to execute.CAN_DeInit.png

0 Kudos
Reply
1 Solution
523 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice

1. The controller modes are defined in the AUTOSAR specification, thus described in the FlexCAN MCAL driver user manual found under the following path: "C:\NXP\S32DS.3.X.X\S32DS\software\PlatformSDK_S32K3\RTD\Can_43_FLEXCAN\doc\RTD_CAN_43_FLEXCAN_UM.pdf"

Snag_a0158d5.png

2. By AUTOSAR standards, yes, it is mandatory. The processing logic depends on the driver implementation. For example, in the FlexCAN driver, functions called are FlexCAN_Ip_SetStartMode() and FlexCAN_Ip_SetStopMode(), both of which enable and disable the module, respectively.

AUTOSAR specification also provides a transition diagram in their CAN specification document:

Snag_a0e08b2.png

Best regards,
Julián

View solution in original post

0 Kudos
Reply
3 Replies
567 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice,

Before calling CAN_DeInit, set all controllers to STOPPED to allow it to de-init properly:

/* Stop Can controller */
Can_43_FLEXCAN_SetControllerMode(Can_43_FLEXCANConf_CanController_CanController_0, CAN_CS_STOPPED);

/* De-Initialize Can driver */
Can_43_FLEXCAN_DeInit();

Best regards,
Julián

0 Kudos
Reply
543 Views
Embedded_novice
Contributor III

Hi.

I understand your train of thought now. I would like to know if this state transition diagram is correct. Additionally, I have two more questions:
1. Where can I find this state transition in the manual of the MCU? I didn't see any similar state description in the RM.
2. Is this state transition mandatory? Is the same processing logic applied in other MCU architectures?
Thank you very much for your help!ModeSwitch.png

0 Kudos
Reply
524 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice

1. The controller modes are defined in the AUTOSAR specification, thus described in the FlexCAN MCAL driver user manual found under the following path: "C:\NXP\S32DS.3.X.X\S32DS\software\PlatformSDK_S32K3\RTD\Can_43_FLEXCAN\doc\RTD_CAN_43_FLEXCAN_UM.pdf"

Snag_a0158d5.png

2. By AUTOSAR standards, yes, it is mandatory. The processing logic depends on the driver implementation. For example, in the FlexCAN driver, functions called are FlexCAN_Ip_SetStartMode() and FlexCAN_Ip_SetStopMode(), both of which enable and disable the module, respectively.

AUTOSAR specification also provides a transition diagram in their CAN specification document:

Snag_a0e08b2.png

Best regards,
Julián

0 Kudos
Reply