Preface
Today we will summarize "STM32F103 FSMC read and write external SRAM", mainly using FSMC to control external SRAM and perform read and write operations on SRAM. The project provided in this article performs read and write operations on SRAM similar to read and write operations on FLASH.
The content about STM32's FSMC (Flexible Static Memory Controller) is quite practical and also quite important in practical applications (for those who need to use FSMC). Using FSMC to control external devices is much more efficient than using software simulation to control, and the operation is simpler.
Maybe beginners don't know about FSMC or are not interested in it. Because FSMC is mainly used to expand RAM and ROM in actual development, beginners don't have high demand for RAM and ROM, and basically the internal resources are enough. People who like to use LCD screens should know about FSMC, because FSMC is also a good way to control LCD. Many LCD screens on development boards on the market are compatible with FSMC.
https://yunpan.cn/cSrN5SYtDcyBA Access password: 47fb
The information of STM32F10x can be downloaded from my 360 cloud disk:
https://yunpan.cn/crBUdUGdYKam2Access password ca90
Content explanation
Project Summary: The project provided is to read and write external SRAM, which can be used as a cache (such as a BUF), but it is not the RAM (running memory) of the chip, it only performs read and write operations on SRAM.
Program operation flow: Power on and write external SRAM data "0 - 262143" (just 1M space, 4 bytes of space per data), then read the data through the read function and print it out through the serial port. Here, the serial port prints data once each time it is read, and the LED changes once. (Please observe the phenomenon)
The projects provided are based on the principle of simplicity, with detailed Chinese annotations to facilitate yourself and everyone.
Regarding "STM32F103 on-chip FLASH programming", I will describe the important points below:
1. Clock
This function is located under the bsp.c file;
Turn on the FSMC and the clock pins you need to use.
2. FSMC pin configuration
This function is located under the fsmc.c file;
All pins using FSMC must be configured as "GPIO_Mode_AF_PP", otherwise they cannot be used (those interested can try it). For NE3, it is: NOR/PSRAM3. The project I tested uses NOR/PSRAM3 of FSCM storage block 1 (see the figure below). So the address in my test project is "0x68000000". In fact, this address is very particular. Please see the last point.
3. FSMC configuration
This function is located under the fsmc.c file;
The configuration here is somewhat related to your SRAM (speed, data width, etc.).
3. External SRAM write data
This function is located under the fsmc.c file;
Write data to 1M SRAM (for testing) to facilitate the following read operation.
4. External SRAM read data
This function is located under the fsmc.c file;
Read data from 1M SRAM and print the written data through the serial port. There is a delay between each reading and printing, so the whole reading process takes a long time.
This address can be modified, or a section can be selected for reading and testing. I hope that everyone who sees this will modify the program and test it themselves to facilitate memory and consolidation.
5. Today’s Focus
A. Regarding the address, the external SRAM address of the project provided today is "0x68000000" (macro definition in fsmc.h). People who are good at finding problems and doing things will find a problem. I changed this address to "0x68100000" or "0x68200000" and the test results are the same. I will tell you the answer. The effect is indeed the same. The reason is that the external SRAM capacity "SRAM_EXT_SIZE" is 1M, and "0x00100000" is exactly 1M. The address overflow part here just offsets it, so why the address is changed. The effect is the same. But the address must be in the NOR/PSRAM3 area of storage block 1.
B. Today I configured the FSMC by myself through the standard library. In fact, there is a source code in the "system_stm32f10x.c" file that uses registers to directly configure the FSMC. Interested friends can take a look. Today, I use the standard library configuration to actually hope that everyone can understand the functions of each parameter. In fact, I hope that everyone will still use the configuration in "system_stm32f10x.c" after becoming familiar with the configuration. After all, it is officially provided, and its configuration efficiency is relatively high.
illustrate
The software project provided today is based on the STM32F103 large-capacity chip. Medium- and small-capacity chips do not have the FSMC function and naturally cannot be used. In fact, as long as some configurations of the project are appropriately modified, all STM32F1 chips with FSCM function are applicable.
Previous article:STM32F1_On-chip FLASH programming
Next article:STM32F1_External SRAM as running memory
Recommended ReadingLatest update time:2024-11-15 13:39
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
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
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- In your spare time, we can exercise together and supervise each other.
- Application of resettable fuse
- Summary: Advanced IO Operation Software SPI Performance
- Detailed explanation of MSP430F149 serial port receiving and sending program
- 【Evaluation of SGP40】-SGP40 temperature and humidity test
- When choosing crystal oscillators, should we choose imported or domestic ones?
- Does anyone know how to write a DLL for a card reader/writer? Is there any relevant information?
- Still using the burning method to test fabric composition? Now there is a new method.
- How to pair MCU with FPGA to improve system efficiency?
- [National Technology N32G457 Review] 1. Brief review of the first power-on