43723 views|22 replies

1366

Posts

6

Resources
The OP
 

STM32H750 Part 2 (QSPI Memory Map) [Copy link]

 
Since the internal flash of STM32H750 is only 128K, it should be enough for ordinary applications. However, if some related middleware and various open source libraries are added, it is estimated that 128K flash is not enough. The external flash used by the host is W25Q64, with a capacity of 8M, which is enough for general applications. The QSPI of STM32H750 has two BANKs, and the memory mapping can be set to single flash mode and dual flash mode; no matter what mode, the starting address of the storage is 0x90000000, but when using dual flash mode, two Quad-SPI FLASH will be accessed at the same time, and the throughput and capacity can be doubled. This is a pitfall. I originally thought that BANK1 would be used as RAM and BANK2 would be used as ROM, but in fact these two BANKs cannot be used separately. The OP's board needs Ethernet eth, but if BANK1 is used, it conflicts with the ETH peripheral; if BANK2 is used, it conflicts with the SDMMC1 pin, but fortunately SDMMC2 can be used. In the end, the OP used BANK2. Most people on the Internet use BANK1. The OP also encountered many problems when porting to BANK2. This post records his experience of digging holes. This content is created by EEWORLD forum user RCSN. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source


This post is from stm32/stm8

Latest reply

  Details Published on 2020-12-15 17:25
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 

1366

Posts

6

Resources
2
 
For memory mapping, in simple terms, the external SPIFlash device is mapped as internal memory, and the bus allocates a mapping start address for it; for the Imxrt1052 series, there is no internal flash, so the XIP file is needed to provide additional relevant information for the BootROM to initialize and optimize the flash. The BootROM uses the first 8KB area of the image file to obtain relevant information. The STM32H750 has 128K flash inside, which is enough for us to make a rich Bootloader function. The bootloader here only does a few things at present, enabling and configuring the QSPI peripheral, then initializing the external flash, and then configuring the external flash for memory mapping, and then initializing the stack pointer of the user application and jumping to the user application. This application part runs in the external flash, and the address is the storage start address of QSPI 0x90000000. This post mainly explains the FLM algorithm production of the MDK platform of the external flash W25Q64, the idea of QSPIBootloader, and the relevant configuration of the APP application under MDK.
This post is from stm32/stm8
 
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 

1366

Posts

6

Resources
3
 
There are many professional opinions about MDK's FLM algorithm on the Internet. If you want to learn more, you should search it yourself. For the author, a simple summary is that MDK in this FLM repeatedly calls the API to read and write related memory during the download process. The corresponding FLASH algorithm can be found on the ARM FLASH corresponding to the MDK installation directory, and the corresponding MDK project is also attached. Users can modify it and then generate the corresponding FLM algorithm. By this, we can know that the API of MDK's FLM algorithm is nothing more than these, which are initialization, burning, verification, erasure, etc. Actually, it corresponds to some check options in the magic wand, Then we can customize some of our own related functions, and then include them in these specified API interfaces, and then compile to generate our own FLM algorithm. Init related initialization is to initialize the clock configuration of STM32, as well as related configurations such as W25Q64 and QSPI. These drivers can refer to the configuration of the register version of the punctual atom, which are w25qxx, qspi and sys files. HAL is not used here because HAL is too bloated, and register operation is relatively convenient. The rest does not need to be changed much, mainly in the configuration of QSPI, here we need to change to BANK2. The relevant configuration is as follows Download and compile to generate FLM, put it in the FLASH folder of the MDK installation directory, and you can find the corresponding algorithm in MDK



This post is from stm32/stm8
 
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 

1366

Posts

6

Resources
4
 
Bootloader The author uses cubemx to generate the project, mainly initializing the clock configuration, QSPI related configuration and enabling memory mapping. Then initialize the stack pointer of the user application and jump to the user application. The user application code is executed in the external flash. The BOOT space occupies less than 15K. There are still many things that can be used.

This post is from stm32/stm8
 
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 
 

1366

Posts

6

Resources
5
 
   The author still uses lighting and helloworld output to verify the execution of the code in the external flash. When compiling your own APP code in MDK, you need to pay attention to the following points: Burn it to the external flash and run it in the external flash. The configuration steps of MDK are as follows: 1. MDK magic wand: IROM1 in the Target column, select 0x90000000, size 0x90000 2. Select STM32H750_W25Q64 for the Flash Download algorithm; change the RAM for Algorith Size to 0x8000; uncheck Verify in Download Function. 3. In the gpio.c in the code generated by CUBEMX, unused GPIO will be set to simulation mode to save power consumption, but the problem is that QSPI IO is also set, which makes QSPI unable to access external flash. There are two ways to do this. One is to manually change the QSPI pin in gpio.c. The other is to enable QSPI in CUBEMX and then comment out MX_QUADSPI_Init() in main.c. This will avoid setting it to simulation mode. 4. The interrupt vector address is offset to 0x90000000, otherwise all interrupts will be unusable. In the SystemInit() function in system_stm32h7xx.c, SCB->VTOR = FLASH_BANK1_BASE | VECT_TAB_OFFSET, change it to SCB->VTOR = QSPI_BASE | VECT_TAB_OFFSET; and the offset will be 0x90000000.

3.png (13.83 KB, downloads: 0)

3.png

4.gif (1.14 MB, downloads: 1)

4.gif
This post is from stm32/stm8
 
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 
 

1w

Posts

25

Resources
6
 
I'm still posting during the holidays. Thank you for your hard work.
This post is from stm32/stm8
 
 
 

6040

Posts

204

Resources
7
 
Well written, keep up the good work RC
This post is from stm32/stm8
 
 
 

7422

Posts

2

Resources
8
 
If I don't understand it, I will envy the experts who are good at using STM32.
This post is from stm32/stm8
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

3414

Posts

0

Resources
9
 
Good cow beep good cow beep
This post is from stm32/stm8
 
Personal signature

So TM what......?

 

 

14

Posts

0

Resources
10
 
Thanks for sharing, I learned a lot
This post is from stm32/stm8
 
 
 

1366

Posts

6

Resources
11
 
When the OP used the QSPI initialization code generated by cubemx, the QSPI clock could only reach 33M to avoid a crash. Later, someone on the Internet said that the IO flip rate generated by cubemx was the lowest and needed to be changed to the highest. After the change, QSPI could reach 100M. Perfect
This post is from stm32/stm8
 
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 
 

3

Posts

0

Resources
12
 
Support
This post is from stm32/stm8
 
 
 

14

Posts

0

Resources
13
 
Can you share the QSPI Flash download algorithm? I wrote my own download algorithm, but it can't download the program to QSPI, and it prompts Flash timeout...
This post is from stm32/stm8
 
 
 

1

Posts

0

Resources
14
 

OP, thank you for your hard work. Please see the information on the site.

This post is from stm32/stm8
 
 
 

1310

Posts

3

Resources
15
 

niu

This post is from stm32/stm8
 
Personal signature

RTEMS

 
 

2

Posts

0

Resources
16
 
Can the host provide the source code? I have been trying for several days without success.
This post is from stm32/stm8
 
 
 

2

Posts

0

Resources
17
 

Thank you for your hard work, I have a few questions:

1) Can single-step debugging be performed normally using MDK using external FLASH?

2) Following question 1), if debugging is not possible, is it possible to write the generated binary file directly to the external flash through the boot program through other means such as serial port/network port, and then jump directly?

3) When the program is run from an external FLASH, how is the execution efficiency? Have you ever made a comparison? If so, please share it.

This post is from stm32/stm8
 
 
 

1

Posts

0

Resources
18
 

Does the memory mapping mode of QSPI have to be initialized when the clock is initialized? My setting is to store the Bootloader program in the on-chip flash. In the boot, I first set QSPI to indirect mode and then set it to memory mapping mode after updating the code. However, this setting does not seem to be able to access the off-chip flash. Only when it is set to memory mapping mode when the clock is initialized can it jump. I used the process of the punctual atom. Does anyone know what is going on?

This post is from stm32/stm8
 
 
 

1

Posts

0

Resources
19
 
yaodididi posted on 2020-7-6 15:07 Does the memory mapping mode of QSPI have to be initialized when the clock is initialized? My setting is to store the Bootloader program in the on-chip flash, and the boot...

Is the jump issue resolved?

This post is from stm32/stm8
 
 
 

1

Posts

0

Resources
20
 

May I ask the original poster, can the ordinary SPI connected to external flash realize the function of running external flash code?

This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list