Skip to main content
lhwa .1
Associate II
March 19, 2022
Question

External Flash Loader don't work

  • March 19, 2022
  • 4 replies
  • 4842 views

Hello, I am developing an external flash loader using Spi (W25Q16DV) with Stm32G070.

Yes, the operation is going well without any problems.

However, the peculiar thing is that it doesn't work when you write the user program in the internal flash and run the external flash loader.

This means that you must erase the internal flash and run the external flash loader before it works.

I'm looking for help.

Thank you.

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
March 19, 2022

I'd imagine its interfering with the peripherals, pins or interrupts.

Couple of things you might try.

You could add a delay spin-loop in the Reset_Handler to give the debugger some time to take control.

You could redirect the vector table SCB->VTOR in to the ROM

Disable SysTick or other interrupt sources at the peripherals.

Check that your code properly resets the QSPI/OCTOSPI peripheral, and things are in weird/non-reset conditions.

You can use a UART to report internal state, and perhaps learn something about the state of things in the working vs non-working cases.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
lhwa .1
lhwa .1Author
Associate II
March 21, 2022

0693W00000KdKnLQAV.png 

Andreas Bolsch
Lead III
March 20, 2022

As Tesla DeLorean (Community Member) mentioned: When internal flash is empty, the CPU will run into hard fault and halt right after reset. As soon as you've programmed the internal flash, the CPU will start initialization of peripherals, RAM etc. which certainly will interfere with the external loader.

So, if you don't want to touch your application (delay after reset), the debugger must connect under reset and halt the CPU right out of reset. And, of course, beware of watchdogs: If automatic activation after reset is enabled ...