STM32F030R8 PWM using LSE as source for Timer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 12:43 PM - edited ‎2023-11-28 12:56 PM
Hi all,
I was wondering if there is a way to set up the LSE as the source for a Timer on the STM32F030R8 to generate a PWM output signal. Currently doing a deep dive on clock configurations, timers, etc. and I have been able to use the HSE for PWM, but can I use the LSE for PWM? Maybe with RTC?
Thank you in advance for answers!
- Labels:
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 12:54 PM
why dont you look at the clock tree, CubeMx shows you , what you can do/connect or not ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 12:54 PM - edited ‎2023-11-28 12:55 PM
Hello @tolgaust and welcome to the ST COMMUNITY :smiling_face_with_smiling_eyes:.
According to the clock tree of the STM32F030R8 (DS9773 page 15) you Can find that the timer Can use only 4 clock sources (HSE, HSI, HSE_PLL and HSI_PLL). So you can't use LSE as clock source for a timer.
Best Regards
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 12:59 PM
Reading the clock tree, I don't think LSE can be directly fed into a timer, so I was just curious if I was forgetting about something / unaware of some special thing to do to be able to use LSE as the source!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-28 2:00 PM
Hello @tolgaust,
According to RM0360 STM32F030R8, the timer clock frequencies are automatically fixed by hardware. There are two cases:
– if the APB prescaler is 1, the timer clock frequencies are set to the same frequency as that of the APB domain;
– otherwise, they are set to twice (x2) the frequency of the APB domain.
In particular, TIM14 channel 1 input capture, can be used for the calibration HSI, LSI or HSI14 or to measure the frequency of all on-board clock sources (see RM0360, section 7.2.12).
Here HSE/32 can be connected to TIM14 channel1, but I can't understand how you were able to use the HSE for PWM ? Can you give more details ?
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-29 11:32 AM
I followed a guide online on configuring a timer to generate a PWM, and set TIM16 for the following settings:
Then I selected HSE as the source on the System Clock Mux for the APB1 peripheral clocks.
Lastly, from my understanding, setting HSE source to BYPASS uses the High Speed crystal on the ST-Link debugger part of the nucleo board as its HSE crystal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-29 1:21 PM
In this case the HSE is the clock source of the System Clock, the rest of the clocks in the tree derived from this clock source, mainly the AHB clock HCLK and the APB clock PCLK. The timers clock source is the PCLK.
For the HSE Bypass : In this mode, an external clock source must be provided (from a GBF for example ...). It can have a frequency of up to 32 MHz.
According to the Nucleo board schematic (MB1136), there is no way to use the STLINK HSE crystal (fig1 the HSE feeding the STM32F0 and fig2 the HSE that feeds STLINK)
