Skip to main content
MAlfo.1
Associate
Mar 17, 2021 3:29 PM UTC
Solved

External Loader works on STM32CubeProgrammer, but read operation returns incorrect data

Hi all.

I've created an external loader for a custom STM32H743 board with external W25Q64 FLASH (MCUDEV DevEBox H743).

The project works really well when I'm testing on CubeIDE.

When exported to .stldr inside CubeProgrammer I can upload a 1MB file to the external FLASH, but the returned data when reading is incorrect. It always shows 0x99999999 for all the data.

If I switched to another loader made by @Community member​ for the same board (view it here), data returned is as expected, so I'm pretty sure data has been written correctly.

What could be the problem? Read operation is managed directly by CubeProgrammer and dummy cycles are configured conform the datasheet. Any Idea?

Thanks in advance!

This topic has been closed for replies.
MAlfo.1
MAlfo.1Best answer
Associate
Mar 18, 2021 5:10 PM UTC

Problem solved.

I've refactor some functions and now it works very well in CubeProgrammer with no need to reconnect. I've also tested it in a CubeIDE project and the data is saved without problems during compilation.

Here is the source code repository. Hope it will be useful for someone.

7 replies

Tesla DeLorean
Guru
Mar 17, 2021 6:12 PM UTC

Reading all 9's guess you're using 4-bit mode instruction on a device that's not had the QE bit enabled. Or you're just using the wrong command.

Be easier to know with the read function that sends the QSPI commands.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
MAlfo.1
MAlfo.1Author
Associate
Mar 17, 2021 11:14 PM UTC

Sorry, I wrote a new answer instead replying yours.

Thanks for your reply.

The device have the QE bit enabled (command 0x35 returns a value of 0x32, being bit 1 the QE flag).

To enable the mapping mode I'm using Fast Read Quad Output command (0x6B) and also tried Fast Read Quad I/O (0xEB) with no luck, with all responses to 0x88888888 in that case.

Not sure to understand your last sentence... Reading data works fine from code once memory-mapped is enabled. The problem is with CubeProgrammer, that returns invalid data reading from 0x90000000 address with the external loader selected.

MAlfo.1
MAlfo.1Author
Associate
Mar 17, 2021 11:12 PM UTC

Thanks for your reply, @Community member​ .

The device have the QE bit enabled (command 0x35 returns a value of 0x32, being bit 1 the QE flag).

To enable the mapping mode I'm using Fast Read Quad Output command (0x6B) and also tried Fast Read Quad I/O (0xEB) with no luck, with all responses to 0x88888888 in that case.

Not sure to understand your last sentence... Reading data works fine from code once memory-mapped is enabled. The problem is with CubeProgrammer, that returns invalid data reading from 0x90000000 address with the external loader selected.

Tesla DeLorean
Guru
Mar 18, 2021 12:14 AM UTC

Rough translation is show codes, I'm not much for playing 'guess what's wrong'

ST has made the whole external loader process much more of goat rodeo than it needs to be. Bad examples, broken example and broken front end interface. You could do everything properly and still get bitten by some hack they added to fix some other bug they couldn't resolve elsewhere.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
MAlfo.1
MAlfo.1Author
Associate
Mar 18, 2021 9:44 AM UTC

Ok, I've uploaded code on this repository.

MAlfo.1
MAlfo.1AuthorBest answer
Associate
Mar 18, 2021 5:10 PM UTC

Problem solved.

I've refactor some functions and now it works very well in CubeProgrammer with no need to reconnect. I've also tested it in a CubeIDE project and the data is saved without problems during compilation.

Here is the source code repository. Hope it will be useful for someone.