cancel
Showing results for 
Search instead for 
Did you mean: 

Program loading is failed

APate.18
Associate III

Hey Team, I am working on STM32H745 for display project.

I have faced following issue. 

Some time when I was program my device it was completed in 1.38 minutes usually it takes around 4 minutes because of external flash erase and program loading. 

1) Issue was on device that took ~1.31 minutes to program it went to hard fault.

2) On device that took ~3.51 minutes to program no issues were found.

Controller:  STM32H745.

External Memory using QSPI: W25Q512JV.

configuration of memory 

/*W25Q512JV memory parameters*/
#define MEMORY_FLASH_SIZE 0x4000000 /* 64Mbit =>8Mbyte */
#define MEMORY_BLOCK_SIZE 0x10000 /* 64KBytes */
#define MEMORY_SECTOR_SIZE 0x10000 /* 4kBytes *///0x1000
#define MEMORY_PAGE_SIZE 0x100 /* 256 bytes */
#define TOTAL_PAGES 262144 /* Total number of pages */

 

 

 

5 REPLIES 5
TDK
Guru

Step through the code, debug the hard fault, determine where and why it's happening and correct those issues. There's unlikely to be a magic solution here.

If you think loading is failing, perhaps do a CRC check at program startup to verify memory content.

If you feel a post has answered your question, please click "Accept as Solution".

It appears that even though I selected the memory erase option during programming, it did not erase properly after a failed attempt. Here's a revised version with rephrased sentences and spell-checked:

  1. Initially, I began programming the hardware using Cube Programmer with the flash memory erase option selected.
  2. However, due to intermittent connection issues, the programming process was interrupted, leading to a failure to download the code.
  3. Subsequently, I restarted the programming process, again opting for the flash memory erase option.
  4. Unfortunately, the process encountered an error and halted at around 50% completion.
  5. To address this issue, I manually performed a full chip erase on the external flash memory.
  6. After waiting for approximately four minutes, I restarted the programming process, which then completed successfully, loading the code onto the device.

You shouldn't be having connection issues as a general rule. If you are, something is likely wrong. Maybe recheck your hardware setup. Use a genuine programmer. Lower connection clock speed if you must.

Flash can be verified after writing which will provide assurance that it programmed successfully.

If you feel a post has answered your question, please click "Accept as Solution".

I've verified that the connection isn't the issue. My main concern is this:

When programming with the STM Cube Programmer, if we leave the "skip erase memory" option unchecked, do we need to manually erase the memory every time after a failed programming attempt?

Here's the sequence of events:

  1. Begin programming with the "skip erase memory" option unchecked.
  2. Programming fails at some point (seemingly randomly).
  3. Despite multiple attempts to re-establish connection and program again, it fails to load.
  4. Manually erase internal and external files.
  5. Restart programming with the "skip erase memory" option unchecked, and it successfully loads.

Is this manual erasure step necessary every time after a failed attempt, or is there a more efficient approach?

 

Related post  https://community.st.com/t5/stm32-mcus-embedded-software/issue-with-qspi-external-flash-loader-verification-functionality/td-p/637813

Generally one would CRC / HASH firmware images so they can be validated in-situ and you'd know what you have on the PC side is what you've got on the STM32 side, and you'd be able to pin down WHERE the problem lies, and WHAT you need to fix.

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