Skip to main content
Visitor II
June 7, 2024
Question

STM32H735IGK6U st-flash erase problem

  • June 7, 2024
  • 1 reply
  • 817 views

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. 

    This topic has been closed for replies.

    1 reply

    Graduate II
    June 7, 2024

    Would check the minimum write size and alignment

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

    Graduate II
    June 7, 2024

    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 */
     }