Flash Erase does not work when DBANK = 0
In my own application , I noticed that Flash page erase stopped working once i cleared the DBANK flag in the option bits.
While i start debug this, i see a irregularity
It looks there is a difference in datasheet and ST-Link , the datasheet says when DBANK = 0 we use single bank configuration, but the tiptool in ST-link says the opposite. I suppose the datasheet is correct?
To debug this issue i downloaded the FLASH_EraseProgram example for the NUCLEO-G474RE board.
This example works fine in DUAL bank mode, but i wonder how to test in SINGLE bank mode.
i see in stm32g4xx_hal_flash.h this line : #if defined (FLASH_OPTR_DBANK)
This checks the DBANK FLAG , and when this is set , the flash HAL defines will be configured for a single bank FLASH ? This seems like a a bug in the hal files?
How do i test the single bank flash HAL codes properly , at this moment this is all very confusing?
Thank you
#if defined (FLASH_OPTR_DBANK)
#define FLASH_SIZE ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0xFFFFU)) ? (0x200UL << 10U) : \
(((*((uint32_t *)FLASH_SIZE_DATA_REGISTER)) & 0xFFFFUL) << 10U))
#define FLASH_BANK_SIZE (FLASH_SIZE >> 1)
#define FLASH_PAGE_NB 128U
#define FLASH_PAGE_SIZE_128_BITS 0x1000U /* 4 KB */
#else
#define FLASH_SIZE ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0xFFFFU)) ? (0x80UL << 10U) : \
(((*((uint32_t *)FLASH_SIZE_DATA_REGISTER)) & 0xFFFFUL) << 10U))
#define FLASH_BANK_SIZE (FLASH_SIZE)
#define FLASH_PAGE_NB ((FLASH_SIZE == 0x00080000U) ? 256U : 64U)
#endif
#define FLASH_PAGE_SIZE 0x800U /* 2 KB */
#define FLASH_TIMEOUT_VALUE 1000U /* 1 s */