cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H735IGK6U st-flash erase problem

btank
Associate II

I am trying to flash a STM32H735IGK6U using st-flash:

 

st-flash --debug --reset write $(RSLT).bin 0x8000000

I get below error here and there, What causes this? If I do st-flash reset and then st-flash erase it works fine again.

  •  Programmer/board type: Stlink-V3
  •  Operating system: Ubuntu 22.04
  •  stlink version: v1.8.0
  •  stlink commandline tool name: st-flash
2024-06-06T13:19:02 DEBUG common.c: *** stlink_write_debug32 0x00000031 to 0x5200200c
2024-06-06T13:19:02 DEBUG common.c: *** stlink_read_debug32 0x00050000 at 0x52002010
2024-06-06T13:19:02 ERROR common.c: Flash programming error: 0x00040000
2024-06-06T13:19:02 ERROR common.c: Failed to erase_flash_page(0x8000000) == -1
2024-06-06T13:19:02 DEBUG common.c: *** stlink_read_debug32 0xffffffff at 0x08000000
2024-06-06T13:19:02 DEBUG common.c: *** stlink_write_reg
2024-06-06T13:19:02 DEBUG common.c: data_len = 2 0x2
0d 00
2024-06-06T13:19:02 DEBUG common.c: *** stlink_read_debug32 0xffffffff at 0x08000004
2024-06-06T13:19:02 DEBUG common.c: *** stlink_write_reg
2024-06-06T13:19:02 DEBUG common.c: data_len = 2 0x2
80 00
2024-06-06T13:19:02 DEBUG common.c: *** stlink_run ***
2024-06-06T13:19:02 DEBUG common.c: *** stlink_read_reg
2024-06-06T13:19:02 DEBUG common.c: (16) ***
2024-06-06T13:19:02 DEBUG common.c: data_len = 8 0x8
80 00 00 00 03 00 00 21
2024-06-06T13:19:02 DEBUG usb.c: r_idx (16) = 0x21000003
stlink_fwrite_flash() == -1
2024-06-06T13:19:02 DEBUG common.c: *** stlink_exit_debug_mode ***
2024-06-06T13:19:02 DEBUG common.c: *** stlink_write_debug32 0xa05f0000 to 0xe000edf0
2024-06-06T13:19:02 DEBUG common.c: *** stlink_close ***

 

Going through st-link GitHub issues, but want to check things for the board as well. 

2 REPLIES 2

Would check the minimum write size and alignment

One Flash Word 256-bit (32-byte), 266-bit w/ECC

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

https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Projects/STM32H735G-DK/Examples/FLASH/FLASH_EraseProgram/Src/main.c#L136

uint64_t FlashWord[4] = { 0x0102030405060708,
                          0x1112131415161718,
                          0x2122232425262728,    
                          0x3132333435363738
                        };
...
    if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, Address, ((uint32_t)FlashWord)) == HAL_OK)
    {
      Address = Address + 32; /* increment the address for the next Flash word */
    }
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..