Changing CPU clock speed on K22

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

Changing CPU clock speed on K22

Jump to solution
973 Views
davepfaltzgraff
Senior Contributor I

I have an application built on the K22 processor that uses FreeRTOS. On power-up it checks for power on the USB connector. If USB is connected, it runs in high speed mode to support USB transfers. But if there is no USB, it comes up at a lower speed to conserve power. The question is: If the program comes up in high speed and then later detects that the USB is disconnected, what is involved in moving to the lower speed?

The interfaces implemented are SPI, I2C, two UARTs and the timer. It's OK if the SPI and I2C run at a different rates as they are self clocked, but the timer and UARTs must maintain the same time relationship. For example, the UARTs must remain at 9600 baud and the timer used for the FreeRTOS tic timer must keep the same interrupt interval.

Is it as simple as finding the appropriate initialization routines and re-running them?

Note that although going through a power-up reset might work, that is not acceptable from the user's viewpoint. Also, transients during the change can be tolerated. (Finally, this is only in going from high to low speed. Once in low speed mode, reconnecting the USB has no effect.)

0 Kudos
Reply
1 Solution
795 Views
marek-trmac
NXP Employee
NXP Employee

Clocks tool contains "Module Clocks" view with list of peripherals and all available clock sources for each peripheral. This might help to predict impact.

Regards

Marek

Regards,
Marek

View solution in original post

0 Kudos
Reply
3 Replies
795 Views
marek-trmac
NXP Employee
NXP Employee

Hi David,

MCUXpresso Config Tools contains Clocks tool, that can help you configure clocks and display result in graphical form (clock diagram). The Clocks tool is available on the MCUXpresso web, as a standalone tool or also integrated in MCUxpresso IDE.

Regards

Marek

Regards,
Marek
0 Kudos
Reply
795 Views
davepfaltzgraff
Senior Contributor I

This might tell me how to set up the clock for a specific speed, but it is of no help in determining the peripheral impact of any speed change.

0 Kudos
Reply
796 Views
marek-trmac
NXP Employee
NXP Employee

Clocks tool contains "Module Clocks" view with list of peripherals and all available clock sources for each peripheral. This might help to predict impact.

Regards

Marek

Regards,
Marek
0 Kudos
Reply