stm32 startup mode + pull-up (pull-down) resistor two-in-one

Publisher:SecretWhisperLatest update time:2018-05-13 Source: eefocusKeywords:stm32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I have been working on a stm32 project recently and have been struggling with its startup method. 
I saw a good article and reposted it. The format of the original article is not very good, and there are many strange things in the content (especially the second article, I just think the original article is original, but I don’t understand the author’s ideas), and I deleted and modified them one by one. Friends who want to read the original article, the link is as follows: 
http://www.ithao123.cn/content-3065243.html  Duanxx’s STM32 learning: Boot mode, BOOT0 and BOOT1 detailed explanation 
http://bluefish.blog.51cto.com/214870/1239098  The role of pull-up resistors and pull-down resistors

The so-called boot, generally speaking, means that after we download the program and restart the chip, the value of the BOOT pin will be latched at the fourth rising edge of SYSCLK. Users can select the boot mode after reset by setting the state of the BOOT1 and BOOT0 pins.

Startup method

Startup method (Chinese)

Main Flash memory is the built-in Flash of STM32. Generally, when we download programs using JTAG or SWD mode, they are downloaded to this memory. After restarting, the program is started directly from this memory.

System memory is started from system memory. The program function started in this mode is set by the manufacturer. Generally speaking, this startup mode is rarely used. System memory is a specific area inside the chip. When STM32 leaves the factory, ST presets a BootLoader in this area, which is what we often call the ISP program. This is a ROM and cannot be modified after leaving the factory. 
Generally speaking, when we choose this startup mode, it is to download the program from the serial port, because the firmware of the serial port download program is provided in the BootLoader provided by the manufacturer, and the program can be downloaded to the system's Flash through this BootLoader. However, this download method requires the following steps:

  1. Step 1: Set BOOT0 to 1, BOOT1 to 0, and then press the reset button to start the BootLoader from the system memory.

  2. Step 2: Finally, with the help of BootLoader, download the program to Flash through the serial port

  3. Step 3: After the program is downloaded, it is necessary to set BOOT0 to GND and reset it manually. In this way, STM32 can be started from Flash. 
    It can be seen that it is quite troublesome to download the program via the serial port. It requires jumping back and forth, and does not pay much attention to the user experience.

Embedded SRAM has built-in SRAM. Since it is SRAM, it naturally has no program storage capability. This mode is generally used for program debugging. 
If I only modify a small part of the code, then I need to erase the entire Flash again, which is time-consuming. I can consider starting the code from this mode (that is, in the memory of STM32) for fast program debugging. After the program debugging is completed, download the program to SRAM.

Therefore, the more common choice is to ground BOOT0. Of course, if you draw the stm32 system board yourself, it is best to keep the other two boot methods. It is still necessary to use SRAM for debugging large programs.

Let's talk about the difference between pull-up resistors and pull-down resistors: 
pull-up resistors clamp uncertain signals at a high level through a resistor, and this resistor also plays a role in current limiting. Similarly, pull-down resistors clamp uncertain signals at a low level. Pull-up resistors refer to the input current of the device, while pull-down refers to the output current. 
So when do you use pull-up and pull-down resistors? 
1. When a TTL circuit drives a CMOS circuit, if the high level output by the TTL circuit is lower than the lowest high level of the CMOS circuit (generally 3.5V), then it is necessary to connect a pull-up resistor to the output of the TTL to increase the value of the output high level. 
2. OC gate circuits must be added with pull-up resistors to increase the output high level value. 
3. In order to increase the driving ability of the output pins, some microcontroller pins often use pull-up resistors. 
4. On CMOS chips, in order to prevent damage caused by static electricity, unused pins cannot be left floating. Generally, pull-up resistors are connected to reduce input impedance and provide a discharge path. 
5. Pull-up resistors are added to the pins of the chip to increase the output level, thereby increasing the noise tolerance of the chip input signal and enhancing anti-interference ability. 
6. Improve the anti-electromagnetic interference capability of the bus. When the pin is left floating, it is more susceptible to external electromagnetic interference. 
7. Resistance mismatch in long-line transmission can easily cause reflected wave interference. Pull-down resistors are resistor matching, which effectively suppresses reflected wave interference. 
In addition, the principles for selecting the resistance value of the pull-up resistor include: 
1. It should be large enough to save power and the current injection capacity of the chip; the larger the resistance, the smaller the current. 
2. It should be small enough to ensure sufficient drive current; the smaller the resistance, the larger the current. 
3. For high-speed circuits, a pull-up resistor that is too large may flatten the edge. 
Taking the above three points into consideration, it is usually selected between 1k and 10k. The same is true for the pull-down resistor.

Regarding the pull-up resistor, see the picture.

As input, VCC equals 1, and GND = 0. 
Write the picture description here 
If the key is short-circuited (pressed), the resistance is zero, the key is pressed, Out = 0, when the key is disconnected, Out =? Obviously, when Out is floating, VCC is output, which can be measured with an instrument. This VCC is generated by R1 "pull-up". As the name suggests, R1 is the pull-up resistor. The size of the pull-up resistor depends on the need to connect the output to the load. Usually, the logic circuit has a large impedance for high-level output and requires a small output current. The voltage drop on the pull-up resistor can be ignored. Of course, the pull-up resistor cannot be too large, otherwise it cannot be ignored.

The actual circuit also has this structure 
Write the picture description here 
, where R1 is also a pull-up resistor.

The output structure of the microcontroller P0 port is similar to the following figure. In fact, a field effect tube may be used. 
Write the picture description here 
When Q1 and Q2 are turned on, they can output 0 and 1. What if Q1 and Q2 are not turned on? If you want to output 1, what should you do? Connect an external pull-up resistor!

Why use a pull-up resistor: 
Generally, when used for single-key triggering, if the IC itself does not have an internal resistor, in order to keep the single key in an untriggered state or return to the original state after being triggered, a resistor must be connected outside the IC.

Regarding pull-down resistors, they are rarely used. The principle is the same as above, except that they are "pulled down" to GND through resistors.

No further details are given here

Digital circuits have three states: high level, low level, and high impedance state. In some applications, high impedance state is not desired. Pull-up resistors or pull-down resistors can be used to stabilize the circuit, depending on the design requirements! Generally speaking, I/O ports can be set, some cannot be set, some are built-in, and some need to be external. The output of the I/O port is similar to the C of a transistor. When C is connected to the power supply through a resistor, the resistor becomes a pull-up resistor. In other words, if the port is normally at a high level, when C is connected to the ground through a resistor, the resistor is called a pull-down resistor, making the port usually at a low level. 
Pull-up resistors are used to provide current when the bus driving capability is insufficient. Generally speaking, it is to pull current, and pull-down resistors are used to absorb current, that is, to sink current.


Keywords:stm32 Reference address:stm32 startup mode + pull-up (pull-down) resistor two-in-one

Previous article:The importance of parallel capacitors at the power supply end of STM32 microcontroller
Next article:STM32 controls 3 ultrasonic sensors

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号