How to erase pages on bank 2 on stm32g4?
I was trying to erase some flash pages on an stm32g474re nucleo (and on a custom board with the stm32g474veh3).
The flash pages are all on flash bank 2, because i read in the reference manual that flash bank 2 can be written while code is running from bank 1.
However, erasing pages in the second bank (by setting 'Banks' of the FLASH_EraseInitTypeDef to FLASH_BANK_2) has no effect.
In the example given in https://www.st.com/en/embedded-software/stm32cubeg4.html, (STM32Cube_FW_G4_V1.1.0/Projects/NUCLEO-G474RE/Examples/FLASH/FLASH_EraseProgram), there is a function defined called
uint32_t GetBank(uint32_t Addr)
which just returns FLASH_BANK_1.
This does not make sense to me, isn't flash bank 2 the one bank where erasing or writing makes sense?
Greetings,
Rafael