Why can't we choose at which frequency peripherals run in System Idle?

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't we choose at which frequency peripherals run in System Idle?

100 Views
Senior Contributor I

Hello,

according to AN12085 the system pll will be powered on in System Idle.

pastedImage_1.png

Looking at the power_mode_switch_bm example it looks like we have to set every clock divider and system pll setting manually in code. The same is true for the Low Power Idle mode - every PLL gets shut down by software and not by hardware.

void ClockSetToSystemIdle(void)
{
 // CORE CLK mux to 24M before reconfigure PLLs
 SwitchSystemClocks(LPM_PowerModeLowPowerRun);
 ClockSelectXtalOsc();

 /* Init SYS PLL */
 CLOCK_InitSysPll(&sysPllConfig_PowerMode);

 /* Deinit SYS PLL PFD 0 1 */
 CLOCK_DeinitSysPfd(kCLOCK_Pfd0);
 CLOCK_DeinitSysPfd(kCLOCK_Pfd1);
 /* Init System pfd2. */
 CLOCK_InitSysPfd(kCLOCK_Pfd2, 24);
 /* Init System pfd3. */
 CLOCK_InitSysPfd(kCLOCK_Pfd3, 24);

 /* Deinit USB1 PLL */
 CLOCK_DeinitUsb1Pll();

 /* Deinit USB1 PLL PFD 0 1 2 3 */
 CLOCK_DeinitUsb1Pfd(kCLOCK_Pfd0);
 CLOCK_DeinitUsb1Pfd(kCLOCK_Pfd1);
 CLOCK_DeinitUsb1Pfd(kCLOCK_Pfd2);
 CLOCK_DeinitUsb1Pfd(kCLOCK_Pfd3);

 /* Deinit AUDIO PLL */
 CLOCK_DeinitAudioPll();

 /* Deinit ENET PLL */
 CLOCK_DeinitEnetPll();

 SwitchSystemClocks(LPM_PowerModeSysIdle);
}
  1. Why can't we decide which clock will run at which frequency during system/low power idle if we have to turn off everything manually in code? (according to AN12085 AHB, IPG and PER clocks will be set to 33 MHz in System Idle)
  2. How can I turn off the CPU if it is not needed anymore (Idle Task is running) while our used peripherals (e.g. SPI, UART, FlexSPI, ADC, USB, eDMA) keep running in background (they still have work to do) and do their tasks. Some peripherals are running asynchronously to each other so waiting for all of them to finish before entering low power makes no sense.
    In other words how can I put the CPU in a Wait for Interrupt state while keeping all peripherals running and not changing their settings (which would only be possible if they are in an idle state)?

Kind regards,

Stefan

Tags (1)
0 Kudos
2 Replies

65 Views
NXP TechSupport
NXP TechSupport

Hello,

>>In other words how can I put the CPU in a Wait for Interrupt state while keeping all peripherals running and not changing their settings (which would only be possible if they are in an idle state)?

It is not possible. The reason is that "system idle" and "all peripherals running" are contradictory.

Have a nice day

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------

0 Kudos

65 Views
Senior Contributor I

Hello fangfang,

thank you for your answer.

What is going to happen if I do the following:

  1. In my main I initialize the LPM mode with "RUN"
    CLOCK_SetMode(kCLOCK_ModeRun);

  2. In my Idle Task I do the following:
    // Interrupts are already disabled at this point
    __DSB();
    __ISB();
    __WFI();
    __ISB();‍‍‍‍‍‍‍‍
    // Interrupts get enabled after leaving

The CPU will go to WFI while all peripherals keep running with their normal frequencies. Am I going to have any troubles with this code because I use WFI without setting LPM to WAIT or STOP and I do not change any clocks?

Kind regards,

Stefan

0 Kudos