STM32F103G: Runtime clock changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-10 5:30 AM
Currently I'm developing a battery powered application with lcd and stm32f103 (1MB).
Because a full screen update is ugly-slow on 32 MHz I'm looking for ways speed up to 72 MHz. But since this doubles the current consumption, it is not desirable to stay at 72 Mhz.What is the best way to dynamically change the clocks?Changing the PLL or changing the AHB dividers?Or is is not recommended at all?I've never used dynamic clocks before. Usually they are set & forget because it is a rather complicated habit.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-10 6:22 AM
Changing the APB/AHB dividers is the easiest, you'd need to adjust peripheral baud rates to compensate. You can't change the PLL on the fly, you have to switch the processor to a different source, turn off the PLL, change it's settings, turn it back on, wait for it to lock, and switch back to it.
Your idle loop could also use WFI, rather than grinding the processor at 72 MHz. Review other low power modes. Current consumption is something you'll have to evaluate in your specific system, as how and what it interacts with externally are a big factor.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-10 7:39 AM
I was considering reducing the APB scalers and decreasing the AHB scaler.
Are there any caveats on runtime changing the prescalers?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-10 8:32 AM
Are there any caveats on runtime changing the prescalers?
Well they are designed not to glitch, but all peripheral clocking from them will need to have their own dividers adjusted to maintain the same rates, obviously.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-26 8:14 AM
Clive,
I am working on a CAN project that will be able to detect the CAN bit rate by reconfig the CAN settings (Prescaler, BS1, BS2 and SJW..). My problem is: I cannot achieve 33.3K bit rate with the current PLL setting... is it possible to achieve 33.3K at 36Mhz peripheral clock. thanks, TB- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-26 8:23 AM
actually i got it working with:
CAN_InitStructure.CAN_SJW = CAN_SJW_1tq; CAN_InitStructure.CAN_BS1 = CAN_BS1_7tq; CAN_InitStructure.CAN_BS2 = CAN_BS2_3tq; CAN_InitStructure.CAN_Prescaler = 40;- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-26 8:33 AM
The numbers don't really seem to jive with the clock/rates you've specified.
What part are you using? What are the clocks, HSE,AHB,APB1,APB2, etc?Up vote any posts that you find helpful, it shows what's working..
