This application note describes how to use the “STR71x_Calculation.xls” file which is intended
as a tool to assist in the configuration of the STR71x clocks and baud rates.
The STR71x microcontroller contains a variety of peripherals running at different frequencies.
Some peripherals have a prescaler to adjust their working frequency, but some others don't
and need a specific frequency to run correctly.
The file “STR71x_Calculation.xls“ calculates all the working frequencies and shows the related register values for each peripheral.
Note: This application note doesn’t substitute the fact that it is mandatory to read the reference manual before the use of this tool.
Rev. 2
AN2046/02051/19
1
STR71X CLOCK CONFIGURATIONS EASY SETUP
1 PRCCU
This peripheral allows the configuration of the clock Prescaler values to adjust the needed frequencies for the CPU, the APB1 and the APB2.
This peripheral contains two calculation sheets:
■ CCU: Clock Control Unit calculation
■ CDU: Clock Distribution Unit calculation
1.1 CCU
In this calculation sheet, it is necessary to enter the input clock frequency and the PLL configuration parameters (the Prescaler ratio, the PLL multiplier ratio, the PLL divider factor, the
input clock source and the running mode).
Figure 1. CCU calculation sheet
This sheet calculates all the frequencies which can be generated by the PLL.
As an example, as shown in Figure 1, the input frequency is set to 16MHz, the Prescaler ratio
(1/2) is activated, the multiplier ratio is set to 20, the divider factor is set to 4 and the PLL is
locked. This configuration allows the RCLK frequency to be set to 40MHz.
2/19
2
STR71X CLOCK CONFIGURATIONS EASY SETUP
1.2 CDU
This calculation sheet is used to configure the working clock frequency for the CPU, the APB1
and the APB2.
Figure 2. CDU calculation sheet
Just select the required Prescaler and obtain as a result the MCLK, the PCLK1 and the PCLK2
working frequency values.
As an example, as shown in Figure 2, the Prescaler for CPU & memory is set to 1, the Prescaler for the APB1 peripherals is set to 2 and the Prescaler for the APB2 peripherals is set to
4. This configuration allows the MCLK to be set to 40MHz, the PCLK1 to 20 MHz and the
PCLK2 to 10MHz.
3/19
STR71X CLOCK CONFIGURATIONS EASY SETUP
2 UART
In this calculation sheet we have two cases:
■ Enter the Prescaler and obtain as a result the correspondent baud rate,
■ Or, just enter the required baud rate and obtain as a result the corresponding Prescaler.
Figure 3. UART calculation sheet
In this sheet there are two tables, the first one gives the baud rate for all the PLL frequency for
a given Prescaler and the deviation for the actual PLL configuration. The second table calcu
lates the corresponding prescaler for a given baud rate.
Figure 3 shows how to configure the actual baud rate to 9600 BAUD by setting the Prescaler
to 130.
Note: For more details on the allowed value and standard baud rates, refer to the UART section in the reference manual.
4/19
-
3 I2C
The I2C has two functioning modes:
■ The Standard I2C mode,
■ The Fast I2C mode.
Figure 4. I2C calculation sheet
STR71X CLOCK CONFIGURATIONS EASY SETUP
In this calculation sheet, it is necessary to select the functioning mode (Standard or Fast) by
pushing the “Mode” button, and then to input the required Prescaler. We obtain as a result the
working frequency of the I2C bus.
Figure 4 illustrates how to configure the I2C mode to Standard mode and the working fre-
quency of the Bus to 50KHz.
Note: For more information about the calculation formulas, refer to the I2C section in the reference manual.
5/19
STR71X CLOCK CONFIGURATIONS EASY SETUP
4 BSPI
In this calculation sheet, it is necessary to enter the corresponding divider factor, to configure
the clock polarity, the clock phase and the BSPI mode. We obtain as a result the working fre
quency of the BSPI bus.
Figure 5. BSPI calculation sheet
-
This example, as shown in Figure 5, illustrates how to configure the Clock Divider to 20, to set
the BSPI working frequency to 1MHz, to set the polarity to “active low”, to set the phase to
“second edge” and to configure the BSPI as master.
6/19
Loading...
+ 13 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.