The basis of MCU--clock system learning tutorial

The clock system is the basis of an MCU, an important evaluation indicator of the MCU. The PIC32MZ EF series features a MIPS32® M-class core and operates at up to 200MHz. The clock system is also more complicated, and there are more registers configured. The following is a brief introduction to the clock configuration in Harmony.

The PIC32MZEF oscillator system has the following modules and features:

• A total of 5 external and internal oscillators are available as clock sources

• On-chip PLL with user selectable input divider, multiplier, and output divider to boost the operating frequency of specific internal and external oscillator sources

• Specific oscillator source with on-chip user selectable postscaler

• Software control can be used to switch between clock sources

• Fail-Safe Clock Monitor (FSCM) that detects clock failures and allows for safe recovery or shutdown of applications via dedicated backup FRC (Back-up FRC, BFRC)

• On-chip PLL for USB peripherals

• Flexible reference clock output

• Multiple clock branches of peripherals for better performance flexibility

• Clock switching/swing control with output divider

Take a look at the clock tree in the manual. If you look closely, you can have a general understanding of the clock system. The specific parameters must be carefully studied.

1

List of registers for clocks, many registers

2

3

Harmony's clock configuration is very user-friendly, and the chart in the manual is the same form, so it is very convenient, here is a simple parameter selection. The following is an introduction to the clock system configuration.

4

1, MCU has 5 clock sources, external high frequency main oscillator, external low frequency oscillator, internal fast RC, internal standby fast RC, internal low speed RC

5

The clock frequency of the external high-frequency main oscillator can be set directly to 24 MHz according to the crystal on the development board.

Internal fast RC can use FRCDIV "2:0" to set the oscillator clock to divide by 1-256.

The external low frequency oscillator development board is not installed. The SOSCEN is used to set the auxiliary oscillator (SOSC) enable or disable. We choose to disable

2. Select which clock source is the system main clock SYSCLK, select by COSC "2:0": current oscillator selection bit, and NOSC "2:0": new oscillator selection bit to switch

6

3, the system PLL settings, first select the clock source for the external high frequency main oscillator or internal fast RC and then set the frequency division multiplier coefficient

7

PLLICLK is used to select the system PLL input clock source bit

1 = FRC is selected as the input to the system PLL

0 = POSC is selected as the input to the system PLL

PLLIDIV "2:0" is used to set the system PLL input clock division ratio 1-8, we choose 2 division here, 24M 3 division after programming 8M

PLLMULT "6:0" is used to set the system PLL multiplier ratio 1-128, we choose 50 times frequency here, 8M50 multiplier after 400M

PLLODIV "2:0" is used to set the system PLL output clock division ratio 2-32, we choose 2 division, 400M 2 division is 200M

PLLRANGE "2:0" is used to select the frequency range selection bit of the input clock multiplier, because it is 8M, so we choose 5-10 MHz

The frequency obtained after the PLL setting is completed is 200 MHz.

4, MCU has 4 reference clock sources, configured by register REFOxCON, can choose whether to enable, select the clock source, then set the frequency division multiplier, and can be fine-tuned by the register REFOxTRIM is the clock, here we do not use Refer to the time clock to directly close the selection.

8

5, peripheral clock clock, because the MCU peripheral clock is more, so allocated 7 peripheral clock sources, different peripherals correspond to different clock sources PBCLK1-5,7,8. Peripheral clock is set separately by register PBxDIV

9

Cloth board connection board type switch

Electric Motor Centrifugal-Switches,Electric Motor Centrifugal -Pump,Electric-Boat Motor Electric Car Motor,Single Phase Start Stop Switch

Ningbo Zhenhai Rongda Electrical Appliance Co., Ltd. , https://www.centrifugalswitch.com

This entry was posted in on