STM32 minimum system (take F103 as an example)

Overview

The minimum system of single-chip microcomputer generally hasCrystal oscillator circuit, power supply circuit, reset circuit, download circuit (debugging circuit)

Crystal oscillator circuit

Function: used to provide the start clock signal to the chip.


Although STM32 already has an internal clock at the time of design, why use an external clock?

The most important thing is the effect of accuracy. The accuracy of the internal clock is not high, and it cannot meet the requirements of all project clocks.

The second is that the internal clock is not a crystal oscillator, but an RC oscillator, which has low precision and can only provide a basic frequency.

The internal crystal oscillator is mainly suitable for chip startup and testing.


Schematic diagram of the crystal oscillator circuit:

LSE (External Low Speed ​​Clock)

[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-hMu6blvq-1632673573187) (C:\Users\13274\AppData\Roaming\Typora\typora-user-images\ image-20210926234334460.png)]

HSE (external high-speed clock)

[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-lswzCQdK-1632673573189) (C:\Users\13274\AppData\Roaming\Typora\typora-user-images\ image-20210926234612997.png)]

There is a certain difference between the above two. The two grounding pins in the high-speed clock single circuit are connected to the metal surgical shield to prevent electromagnetic interference.

The two capacitors around it can eliminate the inductance generated when the crystal is working.

power circuit

As the name implies, it provides a stable power supply for the whole system, so that each functional module can run normally.

The general idea is basically the same, converting the external power supply to a stable voltage of 3.3V.

But there are several types of capacitors used:

  • The function of the input filter capacitor:
    When the input voltage is connected to the power supply, its amplitude starts from zero, and the fluctuation is very large. After adding a capacitor with sufficient capacity for filtering, the pulsating DC becomes ripple due to the charging and discharging effect of the capacitor. Direct current with little wave, this is the function of input filtering.
  • The role of the output filter capacitor:
    The working process of the voltage regulator circuit needs to sample from the output, and then adjust the output according to its feedback value to achieve the purpose of voltage regulation. If there is no output filter capacitor at this time, as long as the voltage fluctuation frequency caused by the load change is exactly the same as the adjustment rate of the voltage stabilizer circuit, an oscillation effect will occur, resulting in the output being out of control, so the voltage stabilizer output must also be added with filter capacitors, and filter Capacitors can also further increase the stability of the regulated output.
  • The effect of the large capacitor and the small capacitor in parallel:
    As for the small capacitor connected in parallel with the large-capacity electrolytic capacitor, its function is to bypass the fluctuating voltage with a higher frequency, because the manufacturing process of the aluminum electrolytic capacitor causes it to have a large ESL (equivalent inductance). ), cannot filter out high-frequency components, so a small capacitor needs to be added.

reset circuit

Reset the system (PC pointer points to 0).

insert image description here

The NRST pin is pulled low to generate a reset pulse to reset the system.

Download circuit

Serial download, debugging and other practical. The download method needs to be set according to the chip. Most of them are USB download, JTAF debugging, SWD debugging, etc.

[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-bth4ijw0-1632673573194) (C:\Users\13274\AppData\Roaming\Typora\typora-user-images\ image-20210927001259377.png)]

[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-mM1DBrVn-1632673573196) (C:\Users\13274\AppData\Roaming\Typora\typora-user-images\ image-20210927001121786.png)]

[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-LuqK58AB-1632673573197) (C:\Users\13274\AppData\Roaming\Typora\typora-user-images\ image-20210927001127636.png)]

The above is just a common way of downloading (it is the communication protocol used by the hardware layer in the programming process). But still need to burn through ISP.


ISP: In System Programming; use the writer to burn the code code into the chip, however, the chip can be on the target board without taking it out, the interface is designed on it when designing the target board, so it is called "" In-system programming", i.e. without leaving the system.

[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-n7INTmyF-1632673573198) (C:\Users\13274\AppData\Roaming\Typora\typora-user-images\ image-20210927001354510.png)]

BOOT in the lower right corner of the above figure is the setting startup mode.

insert image description here

Learn about IAP here. See the link at the bottom for details.


Reference study articles

Detailed explanation of STM32 minimum system

The difference between serial debugging tools and serial downloading tools: ST-LINK, J-LINK, U-LINK; SWD, JTAG, SWIM

Guess you like

Origin blog.csdn.net/qq_45628620/article/details/120499957