2025-05-07 6:56 AM
When trying to program the STM32L4P5RE, I get an assertion failure when trying to program the second bank like this:
HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, address, data)
This call fails if my address is in the second bank `0x08080000`. Looking at the source code, I get an assertion failure here:
static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data)
{
/* Check the parameters */
assert_param(IS_FLASH_PROGRAM_ADDRESS(Address)); <---- HERE
I understand when DBANK (Or DB1M) is set, we cannot read the other bank. So how are we supposed to actually program it?
Solved! Go to Solution.
2025-05-07 8:21 AM
The chip has 512 kB of flash, so 0x08080000 is outside of those bounds, regardless of how DB1M is set.
Second bank of flash starts at 0x08040000.
2025-05-07 8:21 AM
The chip has 512 kB of flash, so 0x08080000 is outside of those bounds, regardless of how DB1M is set.
Second bank of flash starts at 0x08040000.
2025-05-07 8:38 AM
Wow, I can't believe I missed that. I've been relying on the value of the linker script from STM32CubeMX:
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K <----
But now I realize that linker script is generic: `STM32L4P5XX_FLASH.ld`. That was a little misleading. Thank you for the help!