The flash memory module of STM32f1xxx consists of three parts: main memory, information block and flash memory interface register.
The sizes of the various parts vary from model to model, as can be seen in the data sheet.
The main memory block of small capacity products is 1-32KB, 1KB per page, and the system memory is 2KB.
The main memory block of medium-capacity products is 64-128KB, with 1KB per page and 2KB system memory.
The main storage block of large-capacity products is more than 256KB, with 2KB per page. The system memory is 2KB.
Main memory: This part is used to store code and data constants (such as const type data). For large capacity products, it is divided into 256 pages, each page is 2K bytes. Note that small and medium capacity products have only 1K bytes per page. From the above figure, it can be seen that the starting address of the main memory is 0X08000000. When B0 and B1 are connected to GND, the code starts running from 0X08000000.
Information block: This part is divided into 2 small parts. The startup program code is used to store ST's own startup program for serial port download code. When B0 is connected to V3.3 and B1 is connected to GND, this part of the code is running. User selection bytes are generally used to configure write protection, read protection and other functions.
Flash memory interface register: This part is used to control flash memory reading and writing, etc., and is the control mechanism of the entire flash memory module.
When the internal flash simulates the eeprom, you can operate the main memory space, the program code occupies a part, and leave a part for storing the information you want to store. However, the read and write operations of the simulated eeprom still need to follow the operation method of the flash. In addition, you also need to pay attention to the process precautions of the stm32 flash memory operation
FLASH_Unlock(); //Unlock
FLASH_ClearFlag(FLASH_FLAG_EOP|FLASH_FLAG_PGERR|FLASH_FLAG_WRPRTERR);//Clear flag
FLASH_ErasePage(0x8002000);//Erase
while(count < 5)
{
FLASH_ProgramHalfWord((0x8002000 +count*2),data[count]); //flash is stored as one byte, 16-bit data must be added to the address by 2
count++;
}
FLASH_Lock(); //Lock
Previous article:STM32 memory address map
Next article:Difference between bootloader in stm32 system memory and bootloader in flash
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Why is the output filter capacitor of the WM8918 audio decoding DAC so large?
- DLP projection face changing mask
- Become a Xilinx FPGA Design Expert (Basics)
- A brief history of channel coding
- Connected cars, where is the future?
- What PCB design practice materials are there?
- EEWORLD University ---- Live playback: The most important component of the analog world - Signal chain and power supply: USB Type-C? PD special session
- Problems connecting Bluetooth module with CC2541
- microchip zero-drift operational amplifier
- Matter Development Guide (VI): Network Configuration and Lighting-App Examples