Clock precision on a STM32L476
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-22 5:02 AM
Hi all,
I need to drive the ADC with TIM1 at 4MHz, drive by an external event.
I want to know the clock precision on this timer.
For the moment I use HSI16 and the PLL to have 80MHz on APB.
I also have a LSE for the RTC.
but what is the precision. I need less than 1KHz on the 4MHz
can you help me to found this?
- Labels:
-
ADC
-
RCC
-
STM32L4 Series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-22 5:05 AM - edited ‎2023-11-20 4:55 AM
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-22 9:42 AM
Thank you, but for me, this is about HSI only.
what about the PLL? In my understand, a PLL can modify the accurate no?
and the Timer to .?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-22 9:55 AM
> PLL can modify the accurate no?
No. PLL can add jitter, but the long-term relative accuracy (i.e. how many % is it different from the required frequency) is the same as of the primary clock source (i.e. here HSI16). Same for timer, which is derived from PLL.
By multiplying (as in PLL) or dividing (as in prescalers and dividers) you can't change relative precision of frequency. You can increase precision by introducing some external, more precise source - either by calibration of the HSI (but don't hold your breath, it won't be too precise even after calibration, see trimming step in the above screenshot) or simply by deriving the frequency from a more precise source, i.e. crystal or crystal oscillator.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-22 12:32 PM
ok, if I understand, if the HSI have 100KHz drift (16.1MHz for example),
then with pll x20 / 4 to have 80MHz, I will have 500KHz drift, and finally, with a timer at 4MHz, I will have 25KHz drift, of course it's an exemple without temperature and voltage etc. It look huge for me, around 6% drift for an oscillator, where we generally have some ppm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-22 12:53 PM
I also have a LSE for the RTC.
Then use it. The MSI feeding the PLL is specifed to be better than 0.25% if autocorrected by the LSE.
Set the RCC->CR MSIPLLMode bit to one using:
HAL_RCCEx_EnableMSIPLLEN();
Without an HSE, that is probably the best you will get.
