cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to change clock frequency when detecting connection to USB device?

JimFouch
Associate III

I have project that I'm designing around an STM32F411 that 99%+ of the time will not have a USB device attached. I'd like to run at the top clock frequency of 100MHz. I see that I can not do that and use the USB device as it needs to run at 48MHz. I'd need to drive the main clock at 72MHz to achieve the desired 48MHz USB clock.

I'm wondering if I can reconfigure to the main clock to run @ 72Mhz when detection of the USB connection and revert back to 100MHz after removal.

3 REPLIES 3
TDK
Guru

You, you can reconfigure the clock at will.

If you use internal timers, you will need to be cognizant of this and just durations accordingly.

If you feel a post has answered your question, please click "Accept as Solution".
Nikita91
Lead II

You can configure sysclk at 96 MHz, and USB at 48 MHz. You only lose 4%.

Only change the AHB prescaler to change sysclk only: don't touch the PLL which generate the USB 48 MHz.

Thank you!!

When I was letting CubeMX try to figure it out, it always forced the main clock to 72. Entering 96 into the Mian Clock works just as you stated.

Thanks again.