Serial port, USB, USB to serial port, serial port driver, emulator download program

Serial port, USB, USB to serial port, serial port driver, emulator download program

When learning stm32 for the first time, the first step is to download the program.
Method 1: Use the emulator to download the program. Method
2: Use the serial port to download the program.
This article briefly introduces two download methods and briefly explores the download principle. Because of beginners, errors and needs Criticisms and corrections are welcome for improvements, thank you very much.

Emulator downloader

Microcontroller emulator

Definition: Refers to a set of dedicated hardware devices specially designed and produced for the purpose of debugging microcontroller software.

The architecture of a microcontroller is exactly the same as that of a PC, including a central processing unit, input and output interfaces, memory, and other basic units. Therefore, the software structure of a microcontroller is similar to that of a PC and other devices.

Because the microcontroller needs to debug the software during the software development process, observe its intermediate results, and eliminate problems in the software. However, due to the application scenarios of the microcontroller, it does not have standard input and output devices. Due to storage space limitations, it is difficult to accommodate special software for debugging programs. Therefore, to debug the microcontroller software, a microcontroller emulator must be used.

Hardware connection

Insert image description hereLet’s talk about the CMSIS-DAP emulator here. It is an open source emulator officially made by ARM. It has no copyright and can be produced freely. The official source code is made using NXP's microcontroller LPC4320. This source code can be found as long as you install KEIL5.
Some simulators follow the CMSIS-DAP standard. Select this at Debug, as shown in the figure below:

![Insert image description here](https://img-blog.csdnimg.cn/20200818213238113.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0NzcyLearn Insert image description hereaccording to your own After the step configuration is completed, the download is Yes, the specific configuration is not mentioned here.

Download program using serial port

First introduce a few concepts: serial port, USB, serial port driver
USB to TTL

Serial port (foreign name Serial Interface)

Serial interface, referred to as serial port, is also called serial communication interface or serial communication interface (usually referred to as COM interface). It is an expansion interface that uses serial communication. Serial Interface refers to the sequential transmission of data bit by bit. Its characteristic is that the communication line is simple, and only a pair of transmission lines can achieve two-way communication (telephone lines can be directly used as transmission lines), thereby greatly reducing costs, and is especially suitable for long-distance communication, but the transmission speed is slow.

Origin :
The serial port appeared around 1980, with a data transmission rate of 115kbps to 230kbps. The initial appearance of serial ports was for the purpose of connecting computer peripherals. In the early days, serial ports were generally used to connect devices such as mice and external modems, as well as old-fashioned cameras and writing pads. Serial ports can also be used for interconnection and data transmission between two computers (or devices). Since the serial port (COM) does not support hot swapping and has a low transmission rate, some new motherboards and most portable computers have begun to cancel this interface. Serial ports are mostly used in industrial control and measurement equipment and some communication equipment.

Interface classification standards
Serial interfaces are classified according to electrical standards and protocols, including RS-232-C, RS-422, RS485, etc.

The picture is as follows:
Serial port diagram

USB:

USB, the abbreviation of Universal Serial Bus in English, is an external bus standard used to standardize the connection and communication between computers and external devices. It is an interface technology applied in the PC field.

Universal Serial Bus (USB) is an emerging data communication method that is gradually replacing other interface standards. It was introduced in 1995 by computer companies and communications companies such as Intel, Compaq, Digital, IBM, Microsoft, NEC and Northern Telecom. It was jointly formulated in 2006 and gradually formed an industry standard. As a high-speed serial bus, the USB bus has extremely high transmission speed that can meet the application environment requirements of high-speed data transmission. The bus also has simple power supply (can be bus powered), convenient installation and configuration (supports plug-and-play and Hot-swappable), simple expansion ports (up to 127 peripherals can be expanded through a hub), diversified transmission methods (4 transmission modes), and good compatibility (downward compatibility after product upgrades).
Since its launch, the universal serial bus (USB) has successfully replaced serial ports and parallel ports and has become one of the standard expansion interfaces and essential interfaces for a large number of computers and smart devices in the 21st century. It has now developed to USB 4.0 version. USB has the advantages of fast transmission speed, easy use, hot-swappable support, flexible connection, and independent power supply. It can be connected to a variety of peripherals such as keyboards, mice, and large-capacity storage devices. This interface is also widely used in smartphones. The interaction between smart devices such as computers and external data is mainly through network and USB interfaces.

The picture is as follows:
Insert image description here

Serial port driver
We know that nowadays computers generally do not have serial ports, they are all USB ports, so:

The function of the USB to serial port driver is to enable the USB to serial port hardware to be recognized as a serial port device when connected to the computer USB interface, and allocate the corresponding available serial port number for use.

For example, the USB-to-serial driver chip used by Wildfire's STM32 development board is CH340.

In this way, the computer will recognize it as a serial port, otherwise the computer will only recognize it as a USB and not a serial port, making serial port debugging impossible.

USB to TTL

Why do you need to convert USB to ttl? First of all, according to the different level standards
used in communication , serial communication can be divided into TTL standard and RS-232 standard.

Insert image description here

TTL level standards are often used in common electronic circuits. Under ideal conditions, 5V is used to represent binary logic 1, and 0V is used to represent logic 0. In order to increase the long-distance transmission and anti-interference capabilities of serial communication, it uses -15V to represent logic 1. , +15V means logic 0.

Therefore: the function of the USB to TTL module is to convert the level to a level that both parties can recognize for communication.

The level logic of the microcontroller communication interface is different from that of the PC communication interface. The communication interface on the PC has a USB interface, and the corresponding level logic follows USB principles; there is also a DB9 interface (nine-pin port), and the corresponding level logic follows RS-232 principles.

The serial communication on the microcontroller passes through the four pins of RXD, TXD, VCC, and GND of the microcontroller, and the corresponding level logic follows the TTL principle.

Insert image description here

After the configuration is completed, open the mcuisp software and download it.

Guess you like

Origin blog.csdn.net/qq_44772972/article/details/108090198
Recommended