cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32F746 Discovery] After changing Flash Bank Mode, it doesn't boot at all

jamesYSKim
Visitor

Hi Experts,

I'm almost a newbie at STM32F7xx even though I've been working with STM32F4 series.

I wanted to handle the flash memory as IAP.

I tried flash erase as same as what I do on STM32F4 but it failed.

So I checked and found that thera are two kind of bank modes in STM32F7.

I'm familiar with the address map of single bank mode and I tried to change Dual bank mode to Single bank mode in my code like below.

    FLASH_OBProgramInitTypeDef OBInit = {0};

    // 1. Unlock Flash and Option Bytes
    HAL_FLASH_Unlock();
    HAL_FLASH_OB_Unlock();

    // 2. Read current Option Bytes
    HAL_FLASHEx_OBGetConfig(&OBInit);

    // 3. Set DBANK to 0 (Single Bank)
    OBInit.OptionType = OPTIONBYTE_USER;
    OBInit.USERConfig = OB_NDBANK_SINGLE_BANK;

    if (HAL_FLASHEx_OBProgram(&OBInit) != HAL_OK)
    {
        // Error handling
        HAL_FLASH_OB_Lock();
        HAL_FLASH_Lock();
        return;
    }

    // 4. Launch Option Bytes loading (MCU will reset)
    HAL_FLASH_OB_Launch();

    // 5. Lock Option Bytes and Flash
    HAL_FLASH_OB_Lock();
    HAL_FLASH_Lock();

When I did it, system has halted and I can't make it reboot any more.

With STM32CureProgrammer, I can connect to the STM32F746NG Discovery board and programm again but MCU doesn't run at all.

 

I asked chatgpt about this but its answer was not helpful for me.

Please help me.

 

Thank you.

Best regards,

James.

0 REPLIES 0