Skip to main content
Visitor II
December 9, 2024
Solved

Bricked stm32F746-disco with write to Flash?

  • December 9, 2024
  • 2 replies
  • 1027 views

After testing trying to write a byte to Flash I seemed to have bricked board.  I thought board just went out, so I bought another one, programmed it and now that board is broken too.  I commented code out, tried 3rd board and it works fine.

Here is the code I tried

 

 
uint32_t Flash_Address = 0x80FFF00; 

HAL_FLASH_Unlock();
 FLASH_Erase_Sector(11, FLASH_VOLTAGE_RANGE_2); // Use appropriate sector number and voltage range
 HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, Flash_Address, 0xAA);
 HAL_FLASH_Lock();

 

 

The error I get now is:

Target not halted after reset. Force halt

Failed to halt target

Target not halted

 

Error in initializing ST-LINK device.

Reason: Target not halted.

 

Error in final launch sequence:

 

Failed to execute MI command:

target remote localhost:61234

 

Error message from debugger back end:

localhost:61234: Connection timed out.

Failed to execute MI command:

target remote localhost:61234

 

Error message from debugger back end:

localhost:61234: Connection timed out.

localhost:61234: Connection timed out.

 

I tried using STLINK utility to erase. but they won't connect!

 

Did I use wrong voltage (FLASH_VOLTAGE_RANGE_2)? Not sure if the boards are truly damaged?

 

 

 

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    You're not using a part with 24 sectors

    The F746 has 8, describing 1MB

    The F767 (24), and F722 (8 for 512KB) might have different array sizes.

    As I recollect there are some F4 devices with 2MB, two banks of 1MB in a 16KB*4,64KB*1,128KB*7 pattern

    2 replies

    Graduate II
    December 9, 2024

    That doesn't make a lot of sense. Was there code in that location, or within 128KB? (0x080E0000)

    It shouldn't brick the board.

    Use STM32 Cube Programmer, or ST-LINK Utilities, try Connect Under Reset, try finding BOOT0 pin/pad and pulling to VDD (HIGH) and connecting that way. When connected, Mass Erase

     

    BOOT0 to 3V3, short pads for R42

     

     

    FJB2069Author
    Visitor II
    December 9, 2024

    Yes, that is what I did.  

     

    And I wrote to an address to section 7 address 0x0807FF00 without issue.

     

    Here is the issue with writing sector 11:  There are only 8 sectors defined in stm32f746xx.h  

    /******************************************************************************/
    /* */
    /* FLASH */
    /* */
    /******************************************************************************/
    /*
    * @brief FLASH Total Sectors Number
    */
    #define FLASH_SECTOR_TOTAL 8

    So how do you access other sectors 9-11?

     

    Graduate II
    December 9, 2024

    You're probably thinking of the STM32F4, which had a different mix of different sized sectors.

    "On STM32F756xx and STM32F74xx devices, a main memory block divided into 4
    sectors of 32 Kbytes, 1 sector of 128 Kbytes and 3 sectors of 256 Kbytes"

    Other options on banked devices would be side-to-side (double wide flash lines), or end-to-end

    FJB2069Author
    Visitor II
    December 9, 2024

    I was able to recover boards.  Unplug USB, Jumper R42, which is BOOT0 pull up to VCC.  Connect USB, Use st-link to erase.  Unplug USB and remove jumper.  Now you can program as normal.