2020-08-25 12:09 AM
Hi,
I'm implementing an OTA system using the L486VG MCU.
This one has the dual bank option and the BFB2 option bit to enable to boot in Bank2.
It works and I can constantly swap the banks and erase and read them.
Only when the BFB2 bit is set and there is no valid firmware in Bank 2 it boots from Bank 1.
The problem is that I need logic in my firmware to know what bank got booted so I can erase the correct bank before writing my new firmware. How could I do this? At the moment I just check the BFB2 bit, but that is no assurance that it's in Bank 2.
Thanks,
Marvin
Solved! Go to Solution.
2020-08-25 06:31 AM
Check the SYSCFG_FB_MODE bit to see if it accurately reflects what is mapped.
2020-08-25 01:04 AM
Pretty sure you can read the mapping register. Failing that you can put a unique identifier in each, and perhaps a common boot loader at the front of each bank that forks.
2020-08-25 06:31 AM
Check the SYSCFG_FB_MODE bit to see if it accurately reflects what is mapped.
2020-08-25 08:11 AM
Thanks for the info!
For others searching for more info on this you can read the FB_MODE bit like this:
if(SYSCFG->MEMRMP & 0x00000100)
{
//bank2 is mapped
}
else
{
//bank1 is mapped
}