Problem record: STM32F1XX uses FSMC to simulate 8080 problems

problem

1. The usage of FSMC to simulate 8080 hours

Regarding the STM32F1 simulation of 8080 hours, it is actually mentioned in many tutorials, such as the wildfire tutorial. So in essence, we first need to know why FSMC can simulate 8080 hours instead of FSMC directly generating 8080 hours.

About 8080 o'clock

The 8080 hour can be found in many places. It actually originated from intel. The reading and writing hours are as follows (this picture comes from the Internet):
Insert picture description here
So it can be clearly seen from the picture above that the 8080 actually uses 4 control lines and 8 It is composed of a data line. Of course, many people say, why are there eight? Obviously 16 pieces are used on the display. Of course, 8080 actually supports 8/16/24bit, so it can actually be classified as DATA line (8/16/24 bit). Because of this timing, it is very similar to the timing of SRAM and NOR. Therefore, you can directly use FSMC to configure it as NOR (closest) to simulate 8080 timing. Generally, B mode is used for driving. The main parameters are address establishment time, address retention time, and data establishment time. FSMC only needs to be configured. At this time, the 8080 can be driven very well. The FSMC of STM32 is hung on HCLK, so if STM32F1 is used, it is 72M, and F4 is 168M (determined by the chip itself and its own configuration). Therefore, the time of 1 HCLK is 1/72M = 13.8ns, and then according to the manual, see how many HCLKs are required by Address Setup, and so on, you can configure FSMC well and accurately.

2. After FSMC simulates 8080 and sees serious spikes in the oscilloscope clock

After configuring the FSMC, a white screen appears after the product has been running for a long time. The phenomenon is:

  • It can still run after a white screen.
  • Measure the power with an oscilloscope, and when the FSMC has data, a strong spike appears.

Generally speaking, ordinary buses such as SPI or UART will add TVS, etc., to prevent surges and spikes from causing unpredictable consequences. On high-speed buses, such as FSMC/FMC, or equal length processing in PCB Layout, and follow the 3W principle to process, measure the impedance matching, and add resistance protection if necessary.

3. Reasons for spikes and how to deal with them

Analyze the causes of spikes:

1. Check whether the power supply is unstable

It can be seen from the oscilloscope that the power supply is stable and normal, so the white screen caused by the unstable power supply can be excluded.

2. Check whether the impedance matches

It is also satisfactory to measure impedance by using instruments such as milliohmmeters. Therefore, the impedance mismatch can also be excluded. However, the PCB did not comply with the 3W principle, and only did the equal length processing. Therefore, crosstalk and ringing cannot be ruled out.

3. Check whether the signal is distorted

Check the signal on the oscilloscope, and there is no capacitive distortion.

Solution

In fact, the solution is very simple, that is, you can start from the second point. If the signal spikes are caused by crosstalk and other reasons, the root cause is that the GPIO flip speed is too fast. When multiple signals are flipped at the same time, the peaks are extremely high. obvious. Therefore, when configuring the GPIO, configure the pin speed to 2M speed, which is the low-speed mode on the HAL library. When initializing, the data pin must also be configured as a pull-down mode. This problem can be solved well. (Add pictures when you have time!)

Guess you like

Origin blog.csdn.net/qq_42312125/article/details/114242447