CAN Sleep Detection Flow for S32K118 with EB Tresos

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

CAN Sleep Detection Flow for S32K118 with EB Tresos

301 Views
krupan
Contributor II

Hi,

I'm working on CAN configuration using EB Tresos and targeting the S32K118 MCU. I’m trying to understand how CAN sleep detection is handled in this setup.

From what I’ve seen, EB Tresos allows to enable Sleep via Can_SetControllerMode() in the CAN Driver configuration, but it doesn’t expose a direct API to detect sleep mode.

Are there any hooks, callbacks, or debug points I can use to confirm the controller has entered sleep?

Tags (2)
0 Kudos
Reply
1 Reply

254 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @krupan ,

Follows ASR, you just can switch to sleep mode from stop/sleep mode:

Nhi_Nguyen_0-1756458323644.png

In the function Can_SetControllerMode(CAN_CS_SLEEP) just set the variable Can_eControllerState[Controller] = CAN_CS_SLEEP;

Nhi_Nguyen_1-1756458522115.png

So, you can use the function Can_43_FLEXCAN_GetControllerMode() to get mode, but it is in SW aspect only.

As far as I know, to set Can to sleep mode in HW, you need to set Mcu to stop mode. After that you can't debug until CAN wakeup by receiving a frame with Pretended Networking enabled before sleep.

Best regards,

Nhi

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2159318%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ECAN%20Sleep%20Detection%20Flow%20for%20S32K118%20with%20EB%20Tresos%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2159318%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EHi%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI'm%20working%20on%20CAN%20configuration%20using%26nbsp%3B%3CSTRONG%3EEB%20Tresos%3C%2FSTRONG%3E%20and%20targeting%20the%20%3CSTRONG%3ES32K118%3C%2FSTRONG%3E%20MCU.%20I%E2%80%99m%20trying%20to%20understand%20how%20%3CSTRONG%3ECAN%20sleep%20detection%3C%2FSTRONG%3E%20is%20handled%20in%20this%20setup.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EFrom%20what%20I%E2%80%99ve%20seen%2C%20EB%20Tresos%20allows%20to%20enable%20Sleep%20via%26nbsp%3BCan_SetControllerMode()%20in%20the%20CAN%20Driver%20configuration%2C%20but%20it%20doesn%E2%80%99t%20expose%20a%20direct%20API%20to%20%3CEM%3Edetect%3C%2FEM%3E%20sleep%20mode.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAre%20there%20any%20%3CSTRONG%3Ehooks%2C%20callbacks%2C%20or%20debug%20points%3C%2FSTRONG%3E%20I%20can%20use%20to%20confirm%20the%20controller%20has%20entered%20sleep%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2160577%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CAN%20Sleep%20Detection%20Flow%20for%20S32K118%20with%20EB%20Tresos%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2160577%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F251667%22%20target%3D%22_blank%22%3E%40krupan%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EFollows%20ASR%2C%20you%20just%20can%20switch%20to%20sleep%20mode%20from%20stop%2Fsleep%20mode%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Nhi_Nguyen_0-1756458323644.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Nhi_Nguyen_0-1756458323644.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F354778i11493161E740B0A5%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Nhi_Nguyen_0-1756458323644.png%22%20alt%3D%22Nhi_Nguyen_0-1756458323644.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIn%20the%20function%26nbsp%3BCan_SetControllerMode(CAN_CS_SLEEP)%20just%20set%20the%20variable%26nbsp%3BCan_eControllerState%5BController%5D%20%3D%20CAN_CS_SLEEP%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Nhi_Nguyen_1-1756458522115.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Nhi_Nguyen_1-1756458522115.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F354780i1B0A7547FBB8EF48%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Nhi_Nguyen_1-1756458522115.png%22%20alt%3D%22Nhi_Nguyen_1-1756458522115.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ESo%2C%20you%20can%20use%20the%20function%26nbsp%3BCan_43_FLEXCAN_GetControllerMode()%20to%20get%20mode%2C%20but%20it%20is%20in%20SW%20aspect%20only.%3C%2FP%3E%0A%3CP%3EAs%20far%20as%20I%20know%2C%20to%20set%20Can%20to%20sleep%20mode%20in%20HW%2C%20you%20need%20to%20set%20Mcu%20to%20stop%20mode.%20After%20that%20you%20can't%20debug%20until%20CAN%20wakeup%20by%20receiving%20a%20frame%20with%20Pretended%20Networking%20enabled%20before%20sleep.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3ENhi%3C%2FP%3E%3C%2FLINGO-BODY%3E