@@ -373,6 +373,11 @@ impl CFGR {
373
373
}
374
374
375
375
/// Sets a frequency for the `APB1` bus
376
+ ///
377
+ /// - Maximal supported frequency: 36 Mhz
378
+ ///
379
+ /// If not manually set, it will be set to [`CFGR::sysclk`] frequency
380
+ /// or [`CFGR::sysclk`] frequency / 2, if [`CFGR::sysclk`] > 36 Mhz
376
381
pub fn pclk1 < F > ( mut self , freq : F ) -> Self
377
382
where
378
383
F : Into < Hertz > ,
@@ -382,6 +387,16 @@ impl CFGR {
382
387
}
383
388
384
389
/// Sets a frequency for the `APB2` bus
390
+ ///
391
+ /// # Resolution and Limits
392
+ ///
393
+ /// Following is true for devices **except**, as these allow finer resolutions
394
+ /// even when using the internal oscillator:
395
+ ///
396
+ /// [stm32f302xd,stm32f302xe,stm32f303xd,stm32f303xe,stm32f398]
397
+ ///
398
+ /// - Maximal supported frequency with HSE: 72 Mhz
399
+ /// - Maximal supported frequency without HSE: 64 Mhz
385
400
pub fn pclk2 < F > ( mut self , freq : F ) -> Self
386
401
where
387
402
F : Into < Hertz > ,
@@ -391,6 +406,19 @@ impl CFGR {
391
406
}
392
407
393
408
/// Sets the system (core) frequency
409
+ ///
410
+ /// # Resolution and Limits
411
+ ///
412
+ /// Following is true for devices **except**, as these allow finer resolutions
413
+ /// even when using the internal oscillator:
414
+ ///
415
+ /// [stm32f302xd,stm32f302xe,stm32f303xd,stm32f303xe,stm32f398]
416
+ ///
417
+ /// - Maximal supported frequency with `HSE`: 72 Mhz
418
+ /// - Maximal supported frequency without `HSE`: 64 Mhz
419
+ ///
420
+ /// If [`CFGR::hse`] is not used, therefor `HSI / 2` is used.
421
+ /// Only multiples of (HSI / 2) (4 Mhz) are allowed.
394
422
pub fn sysclk < F > ( mut self , freq : F ) -> Self
395
423
where
396
424
F : Into < Hertz > ,
@@ -772,6 +800,14 @@ impl Clocks {
772
800
}
773
801
774
802
/// Returns whether the USBCLK clock frequency is valid for the USB peripheral
803
+ ///
804
+ /// If the micrcontroller does support USB, 48 Mhz or 72 Mhz have to be used
805
+ /// and the [`CFGR::hse`] must be used.
806
+ ///
807
+ /// The APB1 / [`CFGR::pclk1`] clock must have a minimum frequency of 10 MHz to avoid data
808
+ /// overrun/underrun problems. [RM0316 32.5.2][RM0316]
809
+ ///
810
+ /// [RM0316]: https://www.st.com/resource/en/reference_manual/dm00043574.pdf
775
811
pub fn usbclk_valid ( & self ) -> bool {
776
812
self . usbclk_valid
777
813
}
0 commit comments