@@ -93,26 +93,38 @@ Interrupt related functions
9393Power related functions
9494-----------------------
9595
96- .. function :: freq([sys_freq ])
96+ .. function :: freq([sysclk[, hclk[, pclk1[, pclk2]]] ])
9797
9898 If given no arguments, returns a tuple of clock frequencies:
99- (SYSCLK, HCLK, PCLK1, PCLK2).
100-
101- If given an argument, sets the system frequency to that value in Hz.
102- Eg freq(120000000) gives 120MHz. Note that not all values are
103- supported and the largest supported frequency not greater than
104- the given sys_freq will be selected.
105-
106- Supported frequencies are (in MHz): 8, 16, 24, 30, 32, 36, 40, 42, 48,
99+ (sysclk, hclk, pclk1, pclk2).
100+ These correspond to:
101+ - sysclk: frequency of the CPU
102+ - hclk: frequency of the AHB bus, core memory and DMA
103+ - pclk1: frequency of the APB1 bus
104+ - pclk2: frequency of the APB2 bus
105+
106+ If given any arguments then the function sets the frequency of the CPU,
107+ and the busses if additional arguments are given. Frequencies are given in
108+ Hz. Eg freq(120000000) sets sysclk (the CPU frequency) to 120MHz. Note that
109+ not all values are supported and the largest supported frequency not greater
110+ than the given value will be selected.
111+
112+ Supported sysclk frequencies are (in MHz): 8, 16, 24, 30, 32, 36, 40, 42, 48,
107113 54, 56, 60, 64, 72, 84, 96, 108, 120, 144, 168.
108114
115+ The hclk, pclk1 and pclk2 frequencies are derived from the sysclk frequency
116+ using a prescaler (divider). Supported prescalers for hclk are: 1, 2, 4, 8,
117+ 16, 64, 128, 256, 512. Supported prescalers for pclk1 and pclk2 are: 1, 2,
118+ 4, 8. A prescaler will be chosen to best match the requested frequency.
119+
120+ A sysclk frequency of
109121 8MHz uses the HSE (external crystal) directly and 16MHz uses the HSI
110122 (internal oscillator) directly. The higher frequencies use the HSE to
111123 drive the PLL (phase locked loop), and then use the output of the PLL.
112124
113125 Note that if you change the frequency while the USB is enabled then
114126 the USB may become unreliable. It is best to change the frequency
115- in boot.py, before the USB peripheral is started. Also note that
127+ in boot.py, before the USB peripheral is started. Also note that sysclk
116128 frequencies below 36MHz do not allow the USB to function correctly.
117129
118130.. function :: wfi()
0 commit comments