Can I dynamically switch between Clock Option A and Option F (A ↔ F) during runtime on S32K322

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

Can I dynamically switch between Clock Option A and Option F (A ↔ F) during runtime on S32K322

1,192 Views
KirillSchwez
Contributor I

Hello,

I am working with the S32K322 and using the predefined clocking options (Option A currently) described in the S32K3xx datasheet and reference manual.

I would like to confirm whether it is supported to dynamically switch during runtime between Option A (PLL @160 MHz) and Option F (PLL @80 MHz) — in both directions (A → F and F → A) — without performing a full device reset.

Specifically, could you please clarify:

  1. Can the MC_ME (Mode Entry Module) and MC_CGM (Clock Generation Module) safely handle this clock transition while the system is running?

  2. Are there any required steps for updating the AHB gasket / interconnect configuration or other bus domain isolation settings when switching between these options?

  3. What are the recommended sequences (e.g., via RUN mode transitions) to ensure the PLL, peripheral clocks, and flash wait states are correctly reconfigured during both A → F and F → A transitions?

  4. Are there any limitations or errata related to changing between these PLL configurations at runtime for S32K322?

Any guidance, application notes, or SDK configuration examples for safely performing runtime clock switching between Option A and Option F would be greatly appreciated.

Basically I want to change only CORE_CLK (160 to 80 and back) for power saving applications (Dynamical  Downclocking)

Thank you

0 Kudos
Reply
5 Replies

1,130 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

1) Yes, such switching can be done with using of ME module. It is needed run system for IRC during the transition.

2) Not really, but you have to check in every step clock configuration is valid. For instance to have se valid flash wait states.

3) Sequence is to switch ME mode from PLL clocked to IRC clocked, change PLL and dividers settings, and switch ME mode back to new configuration. This cannot be done when modules are active (for instance in the middle of transmission of certain communication module unless this is clocked by IRC).

4) I am not aware of any errata.

0 Kudos
Reply

1,124 Views
KirillSchwez
Contributor I

Hello davidtosenovjan,

Many thanks for your reply,

I have the following main point:

according to the RM (S32K322):

Table 170. Gasket configurations in various clocking modes (for S32K344, S32K324, S32K314, S32K342, S32K341, and
S32K322)

For clock option A:

Gasket configurations for HSE_B is : 1 : 2

For clock option F:

Gasket configurations for HSE_B is : Bypass

HSE Mode Selection and Bypass HSE IAHB gasket control (HSE_CLK_MODE_AND_GSKT_CTRL) register values:

00 - Applicable for Mode A Ratio 1 : 2

01 -  Applicable for Mode F Ratio 1 : 2 is bypassed

But HSE Mode Selection is OTP (One Time Programming) is my understanding correct?

In my Application CAN Subsystem is running and for reducing the current, I was thinking about down clocking of CORE_CLK.

All  clock setting and limitations are valid according to the  

Table 150. System clock frequency limitations (For S32K344, S32K324, S32K314, S32K342, S32K322, and S32K341)

 

My questions are:

1) Is clock switching from Option A to F and back (dynamically during system runtime, CAN is active, many times by low system load) on S32K322 still possible without any negative impact? (Gasket configurations for HSE_B is : 1 : 2)

2) Gasket configurations for HSE_B is OTP and cannot be changed during runtime many times (from 00 to 01 and back), is my understanding correct?

3) Depending on the answers, will you still recommend switching of CORE_CLOCK or should I search for other ideas, like lower CPU Load, or switch off peripherals for saving the current ?

 

Many thanks for your support

 

 

0 Kudos
Reply

1,120 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

1) I would not see any issue by the fact that CAN is active, unless there is not communication is progress.

2) Yes, it is.

3) You can apply all approaches. A frequency chance has basically main impact to power consumption (as dynamic current is the most important portion of overall consumption).

0 Kudos
Reply

1,109 Views
KirillSchwez
Contributor I

Hello davidtosenovjan,

Many thanks for your quick reply,

So I just to sum up everything what we discussed before:

1) It means that dynamically switching from Clock Option A to Option F (A ↔ F) an back is not possible dynamically, because in this HSE Mode Selection Gasket cannot be changed during runtime
2) If Mode A Ratio 1 : 2 is set, then by scaling down the CORE_CLK, I need to scale down also HSE_CLK, AIPS_PLAT_CLK and AIPS_SLOW_CLK to keep the ratio 1 : 2.

Mode A: CORE_CLK == 160 Mhz, HSE_CLK = 80 Mhz (Ratio 1 : 2)

If I scale down CORE_CLK == 80 Mhz, HSE_CLK needs to be also down scaled to 40 Mhz to keep the ratio (1 : 2)

Scaling down only CORE_CLK to 80 Mhz, without adapting HSE_CLK and other Clocks (HSE Mode Selection: 00 - Applicable for Mode A Ratio 1 : 2), in Clock Mode A is not allowed/not recommended.

All Modules clocked by above clock should be not in communication Mode.

3) If CAN communication is active (Sending and Receiving is ongoing) clock down scaling is not recommended, as this can break the receive/transmission process.
Ideally it should be checked if CAN is idle (SW Side) and make a transition in a critical section.

You helped me a already a lot, please confirm if I got all the points correctly.

Many thanks for your patience and support

0 Kudos
Reply

1,072 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

1) Yes, actually you are right. This hasn’t crossed my mind. You can only change setting which are not DCF configured.

2)  You will change overall system frequency and yes, all ratios must be kept i.e. you are not changing clocking option

3) Yes, correct.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2184122%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ECan%20I%20dynamically%20switch%20between%20Clock%20Option%20A%20and%20Option%20F%20(A%20%E2%86%94%20F)%20during%20runtime%20on%20S32K322%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2184122%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20am%20working%20with%20the%20%3CSTRONG%3ES32K322%3C%2FSTRONG%3E%20and%20using%20the%20predefined%20%3CSTRONG%3Eclocking%20options%20(Option%20A%20currently)%3C%2FSTRONG%3E%20described%20in%20the%20S32K3xx%20datasheet%20and%20reference%20manual.%3C%2FP%3E%3CP%3EI%20would%20like%20to%20confirm%20whether%20it%20is%20%3CSTRONG%3Esupported%20to%20dynamically%20switch%20during%20runtime%20between%20Option%20A%20(PLL%20%40160%20MHz)%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EOption%20F%20(PLL%20%4080%20MHz)%3C%2FSTRONG%3E%20%E2%80%94%20in%20both%20directions%20(%3CSTRONG%3EA%20%E2%86%92%20F%20and%20F%20%E2%86%92%20A%3C%2FSTRONG%3E)%20%E2%80%94%20without%20performing%20a%20full%20device%20reset.%3C%2FP%3E%3CP%3ESpecifically%2C%20could%20you%20please%20clarify%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3ECan%20the%20%3CSTRONG%3EMC_ME%20(Mode%20Entry%20Module)%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EMC_CGM%20(Clock%20Generation%20Module)%3C%2FSTRONG%3E%20safely%20handle%20this%20clock%20transition%20while%20the%20system%20is%20running%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EAre%20there%20any%20required%20steps%20for%20updating%20the%20%3CSTRONG%3EAHB%20gasket%20%2F%20interconnect%20configuration%3C%2FSTRONG%3E%20or%20other%20bus%20domain%20isolation%20settings%20when%20switching%20between%20these%20options%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EWhat%20are%20the%20%3CSTRONG%3Erecommended%20sequences%3C%2FSTRONG%3E%20(e.g.%2C%20via%20RUN%20mode%20transitions)%20to%20ensure%20the%20PLL%2C%20peripheral%20clocks%2C%20and%20flash%20wait%20states%20are%20correctly%20reconfigured%20during%20both%20A%20%E2%86%92%20F%20and%20F%20%E2%86%92%20A%20transitions%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EAre%20there%20any%20%3CSTRONG%3Elimitations%20or%20errata%3C%2FSTRONG%3E%20related%20to%20changing%20between%20these%20PLL%20configurations%20at%20runtime%20for%20S32K322%3F%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EAny%20guidance%2C%20application%20notes%2C%20or%20SDK%20configuration%20examples%20for%20safely%20performing%20runtime%20clock%20switching%20between%20Option%20A%20and%20Option%20F%20would%20be%20greatly%20appreciated.%3C%2FP%3E%3CP%3EBasically%20I%20want%20to%20change%20only%20CORE_CLK%20(160%20to%2080%20and%20back)%20for%20power%20saving%20applications%20(Dynamical%26nbsp%3B%20Downclocking)%3C%2FP%3E%3CP%3EThank%20you%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2185716%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Can%20I%20dynamically%20switch%20between%20Clock%20Option%20A%20and%20Option%20F%20(A%20%E2%86%94%20F)%20during%20runtime%20on%20S32K322%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2185716%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E1)%20Yes%2C%20actually%20you%20are%20right.%20This%20hasn%E2%80%99t%20crossed%20my%20mind.%20You%20can%20only%20change%20setting%20which%20are%20not%20DCF%20configured.%3C%2FP%3E%0A%3CP%3E2)%20%26nbsp%3BYou%20will%20change%20overall%20system%20frequency%20and%20yes%2C%20all%20ratios%20must%20be%20kept%20i.e.%20you%20are%20not%20changing%20clocking%20option%3C%2FP%3E%0A%3CP%3E3)%20Yes%2C%20correct.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2185007%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Can%20I%20dynamically%20switch%20between%20Clock%20Option%20A%20and%20Option%20F%20(A%20%E2%86%94%20F)%20during%20runtime%20on%20S32K322%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2185007%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20davidtosenovjan%2C%3C%2FP%3E%3CP%3EMany%20thanks%20for%20your%20quick%20reply%2C%3C%2FP%3E%3CP%3ESo%20I%20just%20to%20sum%20up%20everything%20what%20we%20discussed%20before%3A%3C%2FP%3E%3CP%3E1)%20It%20means%20that%20dynamically%20switching%20from%20Clock%20Option%20A%20to%20Option%20F%20(A%20%E2%86%94%20F)%20an%20back%20%3CSTRONG%3Eis%20not%20possible%20dynamically%3C%2FSTRONG%3E%2C%20because%20in%20this%20HSE%20Mode%20Selection%20Gasket%20cannot%20be%20changed%20during%20runtime%3CBR%20%2F%3E2)%20If%20Mode%20A%20Ratio%201%20%3A%202%20is%20set%2C%20then%20by%20scaling%20down%20the%20%3CSTRONG%3ECORE_CLK%3C%2FSTRONG%3E%2C%20I%20need%20to%20scale%20down%20also%20%3CSTRONG%3EHSE_CLK%3C%2FSTRONG%3E%2C%20%3CSTRONG%3EAIPS_PLAT_CLK%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EAIPS_SLOW_CLK%3C%2FSTRONG%3E%20to%20keep%20the%20ratio%201%20%3A%202.%3C%2FP%3E%3CP%3EMode%20A%3A%20%3CSTRONG%3ECORE_CLK%20%3D%3D%20160%20Mhz%3C%2FSTRONG%3E%2C%20%3CSTRONG%3EHSE_CLK%20%3D%2080%20Mhz%3C%2FSTRONG%3E%20(Ratio%201%20%3A%202)%3C%2FP%3E%3CP%3EIf%20I%20scale%20down%20%3CSTRONG%3ECORE_CLK%20%3D%3D%2080%20Mhz%2C%3C%2FSTRONG%3E%20%3CSTRONG%3EHSE_CLK%3C%2FSTRONG%3E%20needs%20to%20be%20also%20down%20scaled%20to%20%3CSTRONG%3E40%20Mhz%3C%2FSTRONG%3E%20to%20keep%20the%20%3CSTRONG%3Eratio%20(1%20%3A%202)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3EScaling%20down%20only%20CORE_CLK%3C%2FSTRONG%3E%20to%2080%20Mhz%2C%20%3CSTRONG%3Ewithout%20adapting%20HSE_CLK%3C%2FSTRONG%3E%20and%20other%20Clocks%20(HSE%20Mode%20Selection%3A%2000%20-%20Applicable%20for%20Mode%20A%20Ratio%201%20%3A%202)%2C%20in%20Clock%20Mode%20A%20is%20%3CSTRONG%3Enot%20allowed%2Fnot%20recommended%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EAll%20Modules%20clocked%20by%20above%20clock%20should%20be%20not%20in%20communication%20Mode.%3C%2FP%3E%3CP%3E3)%20If%20%3CSTRONG%3ECAN%20communication%20is%20active%3C%2FSTRONG%3E%20%3CSTRONG%3E(Sending%20and%20Receiving%20is%20ongoing%3C%2FSTRONG%3E)%20clock%20%3CSTRONG%3Edown%20scaling%3C%2FSTRONG%3E%20is%20%3CSTRONG%3Enot%20recommended%3C%2FSTRONG%3E%2C%20as%20this%20c%3CSTRONG%3Ean%20break%20the%20receive%2Ftransmission%20process%3C%2FSTRONG%3E.%3CBR%20%2F%3EIdeally%20it%20should%20be%20checked%20if%20CAN%20is%20idle%20(SW%20Side)%20and%20make%20a%20transition%20in%20a%20critical%20section.%3C%2FP%3E%3CP%3EYou%20helped%20me%20a%20already%20a%20lot%2C%20please%20confirm%20if%20I%20got%20all%20the%20points%20correctly.%3C%2FP%3E%3CP%3EMany%20thanks%20for%20your%20patience%20and%20support%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2184935%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Can%20I%20dynamically%20switch%20between%20Clock%20Option%20A%20and%20Option%20F%20(A%20%E2%86%94%20F)%20during%20runtime%20on%20S32K322%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2184935%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E1)%20I%20would%20not%20see%20any%20issue%20by%20the%20fact%20that%20CAN%20is%20active%2C%20unless%20there%20is%20not%20communication%20is%20progress.%3C%2FP%3E%0A%3CP%3E2)%20Yes%2C%20it%20is.%3C%2FP%3E%0A%3CP%3E3)%20You%20can%20apply%20all%20approaches.%20A%20frequency%20chance%20has%20basically%20main%20impact%20to%20power%20consumption%20(as%20dynamic%20current%20is%20the%20most%20important%20portion%20of%20overall%20consumption).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2184847%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Can%20I%20dynamically%20switch%20between%20Clock%20Option%20A%20and%20Option%20F%20(A%20%E2%86%94%20F)%20during%20runtime%20on%20S32K322%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2184847%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CU%3E%3CSPAN%20class%3D%22%22%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F52613%22%20target%3D%22_self%22%3E%3CSPAN%20class%3D%22%22%3Edavidtosenovjan%2C%3C%2FSPAN%3E%3C%2FA%3E%20%3C%2FSPAN%3E%3C%2FU%3E%3C%2FP%3E%3CP%3EMany%20thanks%20for%20your%20reply%2C%3C%2FP%3E%3CP%3EI%20have%20the%20following%20main%20point%3A%3C%2FP%3E%3CP%3Eaccording%20to%20the%20RM%20(S32K322)%3A%3C%2FP%3E%3CP%3ETable%20170.%20%3CSTRONG%3EGasket%20configurations%3C%2FSTRONG%3E%20in%20various%20clocking%20modes%20(for%20S32K344%2C%20S32K324%2C%20S32K314%2C%20S32K342%2C%20S32K341%2C%20and%3CBR%20%2F%3E%3CSTRONG%3ES32K322%3C%2FSTRONG%3E)%3C%2FP%3E%3CP%3EFor%20clock%20option%20A%3A%3C%2FP%3E%3CP%3EGasket%20configurations%20for%20HSE_B%20is%20%3A%20%3CSTRONG%3E1%20%3A%202%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EFor%20clock%20option%20F%3A%3C%2FP%3E%3CP%3EGasket%20configurations%20for%20HSE_B%20is%20%3A%20%3CSTRONG%3EBypass%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3EHSE%20Mode%20Selection%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EBypass%20HSE%3C%2FSTRONG%3E%20IAHB%20gasket%20control%20(%3CSTRONG%3EHSE_CLK_MODE_AND_GSKT_CTRL%3C%2FSTRONG%3E)%20register%20values%3A%3C%2FP%3E%3CP%3E00%20-%20Applicable%20for%3CSTRONG%3E%20Mode%20A%3C%2FSTRONG%3E%20Ratio%201%20%3A%202%3C%2FP%3E%3CP%3E01%20-%26nbsp%3B%26nbsp%3BApplicable%20for%20%3CSTRONG%3EMode%20F%3C%2FSTRONG%3E%26nbsp%3BRatio%201%20%3A%202%20is%20%3CSTRONG%3Ebypassed%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3EBut%26nbsp%3BHSE%20Mode%20Selection%20is%20OTP%26nbsp%3B%3C%2FSTRONG%3E(One%20Time%20Programming)%20is%20my%20understanding%20correct%3F%3C%2FP%3E%3CP%3EIn%20my%20Application%20CAN%20Subsystem%20is%20running%20and%20for%20reducing%20the%20current%2C%20I%20was%20thinking%20about%20down%20clocking%20of%20CORE_CLK.%3C%2FP%3E%3CP%3EAll%26nbsp%3B%20clock%20setting%20and%20limitations%20are%20valid%20according%20to%20the%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ETable%20150%3C%2FSTRONG%3E.%20%3CSTRONG%3ESystem%20clock%20frequency%20limitations%3C%2FSTRONG%3E%20(For%20S32K344%2C%20S32K324%2C%20S32K314%2C%20S32K342%2C%20%3CSTRONG%3ES32K322%3C%2FSTRONG%3E%2C%20and%20S32K341)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EMy%20questions%20are%3A%3C%2FP%3E%3CP%3E1)%20Is%20clock%20switching%20from%20Option%20A%20to%20F%20and%20back%20(dynamically%20during%20system%20runtime%2C%20CAN%20is%20active%2C%20many%20times%20by%20low%20system%20load)%20on%26nbsp%3B%3CSTRONG%3ES32K322%20%3C%2FSTRONG%3Estill%20possible%20without%20any%20negative%20impact%3F%20(Gasket%20configurations%20for%20HSE_B%20is%20%3A%20%3CSTRONG%3E1%20%3A%202%3C%2FSTRONG%3E)%3C%2FP%3E%3CP%3E2)%26nbsp%3BGasket%20configurations%20for%20HSE_B%20is%20OTP%20and%20cannot%20be%20changed%20during%20runtime%20many%20times%20(from%2000%20to%2001%20and%20back)%2C%20is%20my%20understanding%20correct%3F%3C%2FP%3E%3CP%3E3)%20Depending%20on%20the%20answers%2C%20will%20you%20still%20recommend%20switching%20of%20CORE_CLOCK%20or%20should%20I%20search%20for%20other%20ideas%2C%20like%20lower%20CPU%20Load%2C%20or%20switch%20off%20peripherals%20for%20saving%20the%20current%20%3F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EMany%20thanks%20for%20your%20support%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2184832%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Can%20I%20dynamically%20switch%20between%20Clock%20Option%20A%20and%20Option%20F%20(A%20%E2%86%94%20F)%20during%20runtime%20on%20S32K322%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2184832%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E1)%20Yes%2C%20such%20switching%20can%20be%20done%20with%20using%20of%20ME%20module.%20It%20is%20needed%20run%20system%20for%20IRC%20during%20the%20transition.%3C%2FP%3E%0A%3CP%3E2)%20Not%20really%2C%20but%20you%20have%20to%20check%20in%20every%20step%20clock%20configuration%20is%20valid.%20For%20instance%20to%20have%20se%20valid%20flash%20wait%20states.%3C%2FP%3E%0A%3CP%3E3)%20Sequence%20is%20to%20switch%20ME%20mode%20from%20PLL%20clocked%20to%20IRC%20clocked%2C%20change%20PLL%20and%20dividers%20settings%2C%20and%20switch%20ME%20mode%20back%20to%20new%20configuration.%20This%20cannot%20be%20done%20when%20modules%20are%20active%20(for%20instance%20in%20the%20middle%20of%20transmission%20of%20certain%20communication%20module%20unless%20this%20is%20clocked%20by%20IRC).%3C%2FP%3E%0A%3CP%3E4)%20I%20am%20not%20aware%20of%20any%20errata.%3C%2FP%3E%3C%2FLINGO-BODY%3E