2026-01-29 4:35 AM - last edited on 2026-01-29 5:08 AM by Andrew Neil
Hello ST Community,
I am working on an OTA firmware update implementation on STM32L496, and I am facing an issue related to dual-bank internal flash usage when the firmware size exceeds 512 KB.
I would like to explain my setup and the problem in a simple and clear way.
MCU and Flash Details
MCU: STM32L496
Internal Flash: 1 MB
Flash configured in dual-bank mode
Bank1: 512 KB
Bank2: 512 KB
What We Are Doing
Normal Application
The main application is stored in internal flash
Firmware is built using STM32CubeIDE
No OTA activity during normal operation
OTA (Current / Tested)
OTA is performed using NB-IoT and NFC
Firmware is received in chunks
Chunks are written to flash
CRC is verified
After successful verification, firmware is switched
This OTA flow works only when firmware size is less than 512 KB.
Main Issue (Occurs Even Without OTA)
When the firmware size increases beyond 512 KB (for example ~600 KB), the system starts misbehaving even if OTA is not started at all.
Observed Behavior
UART logs show garbage or corrupted values
Application does not work as expected
Random or unstable behavior is observed
Important Point
This happens:
Without erasing flash
Without writing flash
Without switching banks
During normal execution only
When firmware size is below 512 KB, the system works perfectly.
Our Understanding of the Problem
When firmware size is less than 512 KB, the entire code fits in Bank1
When firmware size exceeds 512 KB:
The linker places code and data in both Bank1 and Bank2
The application executes across both banks
According to documentation, executing code from both banks should be supported.
However, in our case, once the code spans Bank1 and Bank2, instability is observed.
Why This Is Important for OTA
We are planning to move OTA storage to external SPI flash (MX25R3235F, 4 MB) and use a bootloader-based OTA approach.
However, even with external flash OTA:
The application firmware itself will still be larger than 512 KB
If execution across Bank1 + Bank2 is not reliable, external OTA will also not work
So the first priority is to understand and solve this dual-bank execution issue for large firmware.
Questions
Is it fully supported to run a single application spanning Bank1 and Bank2 on STM32L496?
Are there any specific option byte settings required for firmware larger than 512 KB?
Are there any known limitations or errata related to large firmware on STM32L4 series?
Are there any recommended linker script examples from ST for applications larger than one bank?
Summary
Firmware <512 KB → works correctly
Firmware >512 KB → unstable behavior
Issue occurs even without OTA
OTA (internal or external) depends on resolving this first
Any guidance, confirmation, or reference from the community would be very helpful.
Thank you for your time and support.
Best regards,
Taksh Patel
2026-01-29 6:06 AM
Some STM32L496 chips only have 512 kB of FLASH. Which one are you using?
After updating, verify the content of the flash using STM32CubeProgrammer. If it matches what is expected, there is no issue with the update procedure.
There is no inherent problem or restriction with an application using both banks. Probably your OTA isn't working correctly here.