Skip to main content
AZyma.1
Associate II
January 12, 2023
Question

STM32CubeProgrammer External Loader issue

  • January 12, 2023
  • 1 reply
  • 1656 views

Hi!

I need to have the ability to program an external SPI flash (W25Q32) via External Loader.

I've implemented the loader as described here and it worked successfully for smaller binary file, yet I've got some issues uploading a bigger binary.

Once I decided to upgrade CubeProgrammer to the newer version (from v2.4.0 I used) External Loader stopped working and don't even start.

The behaviour I see now is same as the one described here.

The MCU is STM32WL55.

Please specify what might be wrong, because CubeProgrammer is some kind of "black box" here.

BTW, debugging with CubeIDE works and Init method works as well.

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
January 12, 2023

You can use other resources on your design to facilitate debug / diagnostics.

For example LEDs, GPIO, UART, etc

Set verbose levels to 3, watch the interactions, identify what specifically isn't working. ie read or write side issue, timeouts, etc.

The other thing is to test all aspects from an application view. Make an application / harness that drives all functionality, especially erase and write.

Erase should work with 4 KB blocks, memory total of 4 MB (32 Mbit).

Writes should be decomposed into aligned 256 byte blocks.

I'd review source on GitHub..

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
AZyma.1
AZyma.1Author
Associate II
January 13, 2023

Thank you for the response.

As said, all methods used to interact with memory have already been checked. Moreover, the main project for this MCU uses the same drivers (for GPIO, SPI and W25Q32) without any issues.

Debugging the code with Exteral Loader (in CudeIDE) works fine and all operations (Read, Write, SectorErase, MassErase) are working properly as well.

CubeProgrammer 2.0.4 could work with it successfully, but newer versions have the log output like this:

14:55:13:125 : UPLOADING ...
 14:55:13:126 : Size : 1024 Bytes
 14:55:13:126 : Address : 0x0
 14:55:13:126 : Read progress:
 14:55:13:127 : Reading data...
 14:55:13:127 : halt ap 0 
 14:55:13:127 : w ap 0 reg 15 PC (0x20000000) 
 14:55:13:128 : w ap 0 reg 17 MSP (0x20000500) 
 14:55:13:128 : w ap 0 reg 16 xPSR (0x01000000) 
 14:55:13:128 : Loader read...
 14:55:13:128 : Init flashloader...
 14:55:13:128 : halt ap 0 
 14:55:13:129 : w ap 0 reg 0 R0 0x00000000
 14:55:13:129 : w ap 0 reg 1 R1 0x00000000
 14:55:13:129 : w ap 0 reg 2 R2 0x00000000
 14:55:13:129 : w ap 0 reg 3 R3 0x00000000
 14:55:13:130 : w ap 0 reg 4 R4 0x00000000
 14:55:13:130 : w ap 0 reg 5 R5 0x00000000
 14:55:13:130 : w ap 0 reg 6 R6 0x00000000
 14:55:13:131 : w ap 0 reg 7 R7 0x00000000
 14:55:13:131 : w ap 0 reg 8 R8 0x00000000
 14:55:13:131 : w ap 0 reg 9 R9 0x00000000
 14:55:13:131 : w ap 0 reg 10 R10 0x00000000
 14:55:13:131 : w ap 0 reg 11 R11 0x00000000
 14:55:13:132 : w ap 0 reg 12 R12 0x00000000
 14:55:13:132 : w ap 0 reg 13 SP 0x00000000
 14:55:13:132 : w ap 0 reg 14 LR 0x00000000
 14:55:13:132 : w ap 0 reg 15 PC 0x20005E35
 14:55:13:132 : w ap 0 reg 16 xPSR 0x01000000
 14:55:13:133 : w ap 0 reg 17 MSP 0x00000000
 14:55:13:133 : w ap 0 reg 18 PSP 0x00000000
 14:55:13:133 : run ap 0 
 14:55:18:000 : halt ap 0 
 14:55:18:000 : Init function fail with timeout
 14:55:18:002 : r ap 0 reg 16 xPSR 0x01000003
 14:55:18:006 : halt ap 0 
 14:55:18:006 : w ap 0 reg 15 PC (0x20000000) 
 14:55:18:007 : w ap 0 reg 17 MSP (0x20000500) 
 14:55:18:007 : w ap 0 reg 16 xPSR (0x01000000) 
 14:55:18:007 : Error: Data read failed

Looks like it reaches the Init function, but fails to execute it. Same thing happens even if this function just configures clocks and returns "1" informing for successful execution.

0693W00000Y8BlLQAV.png