cancel
Showing results for 
Search instead for 
Did you mean: 

how I can design external flasher for any QSPI single flash connected to STM32H750VB in memory mapped mode?

EMZ
Associate II

I'm interested ​in STM32H750VB which have great performance, all peripherals with very competitive price, but I want to extended the flash memory by connecting QSPI W25Q64FV external flash, firstly I created project using CubeMX to test the functionality of this flash with this MCU & all operations (read device ID, read/write memory contents, erase) all works perfectly up to 120MHZ clock speed, I went to the second stage, as I want the external flash to work in memory mapped mode, as I need to create external flash loader to use it to flash my application code to the external flash, I red too much all documents related to this topic, looked into all examples & I tried all of them made all necessary modification but I failed in this,

so any one can help me in this issue with detailed example or detailed application note how to create it from scratch, I'm using Keil UV 5, I want to create flasher works with Keil UV5,

My Hardware:

I created my own simple demo board which have MCU connected all pins to a normal pin headers, MCU clocked by HSE 8MHZ, & connected to single W25Q64FV quad spi flash chip as bank2.

any help will be appreciated, thanks.

13 REPLIES 13
Mon2
Senior III

Hi. Same question was raised in the past for the XMOS XHRA-2HPA Audio CPUs which also use the QSPI interface.

Some pointers:

1) QSPI is backwards compatible with standard SPI interface.

2) A suggestion is to apply reset to the STM32 CPU so that the STM32 interface lines to the QSPI device are held in tri-state (HI-Z) mode.

Then using your pogo pins or whatever method, assert the logic levels over SPI interface to communicate to READ the IDs from the flash device. Then after this verification, proceed to R/W to the flash and finally enable the QSPI bit inside the flash device.

After this process, the STM32 should be able to access the QSPI flash.

EMZ
Associate II

​Dear Mon2,

Many thanks for your reply, but you missed my question, I'm not looking for how I can deal with the QSPI, as I mentioned I already succeed in this,

my question is how I can develop my own QSPI flash loader which I can use to flash my code of my application into the QSPI using Keil UV5.

Mon2
Senior III

Hi. Let me rephrase my understanding to be sure we are on the same page (pun intended 🙂 - you wish to use your CPU to upload your compiled code onto the QSPI flash device which is currently blank?

If yes, then the above comments still apply. You can use standard SPI commands and even a 0.20 USD STM8 CPU to program your QSPI flash device. The QSPI flash is able to understand SPI and QSPI commands. Suggest that you review the SPI commands which will be slower to run but will work fine. Using the SPI interface, the target flash device can be erased, read or written to and also QSPI enabled which is often a non-volatile flash register bit. Many flash suppliers ship in standard SPI mode and you must manually enabled the QSPI bit to operate the device in QSPI mode. That is what an external flash programmer will do.

So you can allow for your Keil compiler to generate a full HEX file -> then use the STM32 or any other CPU to read this HEX file -> parse the address from the data and proceed to send out SPI commands to ERASE the FLASH or SECTOR or PAGE (review the flash documents) -> then WRITE A PAGE, etc. to flash load your device.

EMZ
Associate II

​No the story is not like this, you are far away from the point I'm talking about.

thanks again.

https://arm-software.github.io/CMSIS_5/Pack/html/flashAlgorithm.html

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

The OP is talking about the "External Loader" or "Flash Algorithm" functionality, where the tools can download whatever flash devices you have on the board.

http://www.keil.com/support/docs/3656.htm

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

​Many thanks for your reply, I already red these articles & follow the mentioned instruction & I tried to apply it, but I faced a lot of problems, such as because I'm using H7xx series I have to use & make own mixture of using HAL library & direct register calling, I mean there is no clear example or template specific for H7xx to a clear guidance for this,

also when you make your own functions you have to debug it probably to test its behavior, how I can debug the created firmware during the running in the programming as it will only execute by Keil UV during downloading & programming.

now I'm trying to create all required functions & test it in normal mode of operation & almost created after this I will put it in the template but how I can debug & catch the bugs during programming mode,

if you any additional thoughts, ideas, or info, will appreciate to share with me, many thanks again.  

Many thanks for your reply, I already red these articles & follow the mentioned instruction & I tried to apply it, but I faced a lot of problems, such as because I'm using H7xx series I have to use & make own mixture of using HAL library & direct register calling, I mean there is no clear example or template specific for H7xx to a clear guidance for this,

also when you make your own functions you have to debug it probably to test its behavior, how I can debug the created firmware during the running in the programming as it will only execute by Keil UV during downloading & programming.

now I'm trying to create all required functions & test it in normal mode of operation & almost created after this I will put it in the template but how I can debug & catch the bugs during programming mode,

if you any additional thoughts, ideas, or info, will appreciate to share with me, many thanks again.  

Keil used to have a test framework, basically a wrapper that goes around and calls the function. You can build similar things into a regular app, and here you'd do whatever single-step testing you need to do. In this, and the real loader, you can also use other features of your board, like the USART or screens, etc, to report functionality and progress.

I'm not sure I'd map the memory, ST does this for read/verify phases in their loader methods, but it ends up requiring a lot of back-n-forth into and out of mapped mode.

Do you have a USART for output, which USART/PINS?

Which pins is the QSPI using?

PE7,PE8,PE9,PE10

BK2_NCS = PC11

CLK = PF10 or PB2

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..