2023-04-17 05:16 AM
"I want to make a QSPI flash loader and I'm watching ST's video series (it's a bit old). I'm using an STM32F446RE. Are the function prototypes shown in the video sufficient for the flash loader to work? Do you have any advice you can give me?"
2023-04-17 10:25 AM
>>Do you have any advice you can give me?"
Thoroughly test your own BSP code from an application first.
Integrate into a loader, and use a wrapper/framework to test that.
Use instrumentation to test/debug your loader as you won't be able to "live" debug it directly.
All the functionality of your board is available, use LEDs, USARTs, etc
>>Are the function prototypes shown in the video sufficient for the flash loader to work?
The code has the structure/files you need, but how it comes together is more complicated.
2023-04-18 05:39 AM
The code I wrote here is working, but I have to disconnect and reconnect with CubeProgrammer before every operation. For example:
CubeProgrammer -> Connect
FlashErase -> OK
ReadData -> FAIL
CubeProgrammer -> Disconnect
CubeProgrammer -> Connect
ReadData -> OK
WriteData-> FAIL
I don't understand why it's working this way right now. I've included the Loader_Src.c file below.
2023-04-19 07:42 AM
I would suggest, again, fully testing the interactions with the memory from application space, where you can use a debugger, before porting into the loader which is significantly more difficult to debug.
With Erasing and Writing, you must wait for the memory device to complete the last operation. Review what's coming back from the Status Register(s) of the device.
Writing, typically you're limited to writing aligned 256-byte pages.