cancel
Showing results for 
Search instead for 
Did you mean: 

Help with STM32WB External Flash Loader using Quad SPI memory

SThon.1
Associate II

Hi,

I am writing an external flash loader for the STM32WB55RGVx using a Macronix 64Mbit QSPI NOR Flash (MX25R6435F).

I have had some success following the "MOOC - External QSPI loader how to" youtube video series by ST and the example code for memory mapped QSPI available in the "STM32Cube MCU Package" downloaded from ST website.

Using the example code modified to my custom board I am able to erase, write, and read memory-mapped from the FLASH.

However, when I use the created External loader (based on the example code and video series) I am able to read the FLASH using the STM32 CubeProgrammer, but the first 2 bytes are always 0 even when the flash has been erased only.

I also found that the Errata sheet for STM32WB (ES0394) rev. 7 lists some issues with the Quad SPI and I am wondering if there are some additional issues with the QSPI and certain FLASH memories.

Has anyone had success writing an external FLASH loader for the STM32WB or experiences with QSPI FLASH that may help me?

Any help will be much appreciated =)

Kind regards,

Steinar

1 ACCEPTED SOLUTION

Accepted Solutions

When doing this please ZIP to a single file rather than attach a half dozen individual files.

Issues with external loaders are usually things which can be remedied in a few minutes, and often hard to debug, especially without hardware.

Testing code outside the loader is recommended. If your IDE permits, you could have common files, and have a test harness which could be built as a sub-project.

I will note that your code can also bring up and use a UART to output diagnostics/telemetry to a terminal. Need to use polled modes as interrupts are not available.

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

View solution in original post

6 REPLIES 6

>> I am able to read the FLASH using the STM32 CubeProgrammer, but the first 2 bytes are always 0 even when the flash has been erased only.

Address size, or dummy cycles not correct for command/configuration

Test code and function outside of the loader.

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

Hi clive1,

I have attached to the original post the test code (main.c) and driver (quadspi.*) for running outside of the loader.

I also attached the loader files (Loader_Src.c and Dev_Inf.h) for reference.

Cheers,

Steinar

SThon.1
Associate II

Update...

I am now able to read the first 2 bytes correctly using the STM32CubeProgrammer.

However, after connection with the ST-Link and reading the external FLASH (0x90000000) any subsequent commands will fail.

I have attached the STM32CubeProgrammer log file (with verbosity level 3) where I try a second read command, which fails with the response: "Error: Data read failed"

Unfortunately, I don't know how STM32CubeProgrammer use the external loader interface, but maybe I have some issue with resetting the memory between commands.

Is there any documentation available describing how the STM32CubeProgrammer use the external loader?

Cheers,

Steinar

STM32 Cube Programmer with "Verbosity Level" of 3 will log information ST could use to diagnose.

The STLDR are small .ELF objects that get loaded and run in Internal SRAM to facilitate access to board/design unique parts and connectivity.

ST's model was derived from Keil's, basically a DLL with initialization and access functions.

https://www.keil.com/support/man/docs/ulink2/ulink2_su_newalgorithms.htm

They have some example source under ST-LINK Utilities and STM32 Cube Programmer.

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

When doing this please ZIP to a single file rather than attach a half dozen individual files.

Issues with external loaders are usually things which can be remedied in a few minutes, and often hard to debug, especially without hardware.

Testing code outside the loader is recommended. If your IDE permits, you could have common files, and have a test harness which could be built as a sub-project.

I will note that your code can also bring up and use a UART to output diagnostics/telemetry to a terminal. Need to use polled modes as interrupts are not available.

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

Hi clive1,

thank you for your input!

I did actually find the examples you mentioned which look very similar to the "MOOC - External QSPI loader how to" video series done by ST referenced from original post. Also, I have attached a log-file from STM32 Cube Programmer with "Verbosity Level 3" to the original post.

I will compare the example source code under ST-Link Utilities and STM32 Cube Programmer with the code from the video series and hopefully I will find the missing piece...

Cheers,

Steinar