cancel
Showing results for 
Search instead for 
Did you mean: 

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

jamesYSKim
Associate

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.

1 REPLY 1
mƎALLEm
ST Employee

Hello @jamesYSKim and welcome to the community,


@jamesYSKim wrote:

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.


There is no Dual bank feature on STM32F746 device. The dual bank is available on STM32F76x and STM32F77x devices.

For Flash erase example, please refer to the example provided in the STM32CubeF7 package at this link: https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32746G-Discovery/Examples/FLASH/FLASH_EraseProgram

Hope that helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.