First, we popularize the concept of microcontroller unit; MCU) What’s in it. The most important thing for a person is the brain. All parts of the body work under the command of the brain. MCU is very similar to the human body. In short, it is composed of the most important kernel and other peripherals. The kernel is equivalent to the human brain, and the peripherals are like the various functional organs of the human body. Next, we will briefly introduce the structure of 51 MCU and STM32 MCU.
1.51 system structure
51 system structure block diagram
We say 51 generally refers to 51 series of single-chip microcomputer, there are many models, common are STC89C51, AT89S51, of which the domestic use of the most is STC89C51 / 2, below we will take STC89C51 to explain, and 51 for short.
51 single chip microcomputer is composed of an IP core and on-chip peripherals. The IP core is the CPU in the figure above, and the on-chip peripherals are the clock circuit, SFR and ram, ROM, timer / counter, parallel I / O port, serial I / O port and interrupt system in the figure above. The IP core and peripherals are connected by system bus, and the speed is limited.
The 51 core was designed by Intel in the 1970s. The speed is only 12m. The peripherals are added by the IC manufacturers (STC) on the basis of the core. Different IC manufacturers will add different peripherals to the core, so as to design their own MCU. Here Intel belongs to IP core manufacturer, STC belongs to IC manufacturer. The STM32 that we will talk about later is the same. Arm belongs to the IP core manufacturer. Arm authorizes st, and St designs STM32 MCU based on Cortex-M3 kernel.
When we were learning 51, we had less contact with the kernel part, and the most used peripherals were on-chip peripherals, which were the peripherals we operated during programming.
When programming, the registers are located in SFR and ram. SFR (special function register) occupies 128 bytes (in fact, only 26 bytes, only 26 registers, all others belong to reserved area). Ram occupies 128 bytes. The variables defined in the program are placed in RAM. SFR and RAM are overlapped in the address range of 80 ~ FF, but they are separated in the physical range, so 51 ram has 256 bytes.
Write a good program is burned to ROM area. The rest of the peripherals are very familiar with IO port, serial port, timer, interrupt these peripherals.
2. STM32 system structure
STM32 system structure block diagram
In the system structure, STM32 and 51 belong to MCU, which are composed of kernel and peripherals. However, the Cortex-M3 kernel used by STM32 is much more complex and excellent than 51, and it supports more peripherals than 51. At the same time, the bus width has increased to 32bit, which is better than 51 in terms of speed, power consumption and peripherals.
From the structure block diagram, compared with 51 core, there is only one kind of bus, which is shared by fetching and fetching. There are several bus interfaces in Cortex-M3 to enable cm3 to access and access memory at the same time
Instruction memory area bus (two), system bus, private peripheral bus. There are two code storage area buses, i.e. i-code bus and d-code bus, which are responsible for accessing the code storage area (i.e. flash peripherals).
I-code is used to fetch the index, d-code is used to look up the table, and they are optimized according to the best execution speed.
System bus is used to access memory and peripherals, covering SRAM, peripherals on chip, off chip ram, off chip expansion devices, and part of the system level memory area.
Private peripheral bus is responsible for the access of some private peripherals, mainly the access to debug components. They are also in system level storage.
There is also a DMA bus. Literally, DMA means data memory access, which is a bridge connecting the kernel and peripherals. It can access peripherals and memory, and its transmission is not controlled by the CPU, and it is a two-way communication. In short, this guy is a very fast data porter who is not controlled by the boss. This one is not available in 51.
From the perspective of structure block diagram, STM32 has more peripherals than 51. 51 has serial port, timer, IO port and other peripherals STM32. STM32 also has many characteristic peripherals, such as FSMC, SDIO, SPI, I2C, etc. these peripherals are respectively mounted on AHB, apb2, apb1 buses according to different speeds.