2020-05-16 04:57 AM
Hello
I'm migrating my STM32F072 project to the STM32L072.
In my original project (F072) I can jump to the DFU bootloader by software via a function located before SystemInit.
I tried to convert this to be used by L072 by changing the address of bootloader program to 0x1ff00004 it's not working.
Is it due to the dual memory bank? Is there a way to get it working?
Thank-you
André
2020-05-16 06:13 AM
I.m.h.o., best way to do so is to set some marker in on-chip ram, trigger reset and early in startup code test for that pattern in RAM and if found, reset it. set up VTOR etc for system bootloader and jump to system bootloader.
2020-05-16 07:56 AM
This thread claims the BOOT0 pin is sampled in the bootloader, but I'm a bit skeptical. The other comments should help you:
2020-05-17 02:04 AM
void (*SysMemBootJump)(void);
#define SRAM_ADDRESS_DFU (unsigned long *)0x20004FF0 // *((unsigned long *)0x20004FF0) 20kRam
void SystemInit (void)
{
if ( *((unsigned long *)SRAM_ADDRESS_DFU) == 0xDEADBEEF ) {
*((unsigned long *)SRAM_ADDRESS_DFU) = 0xCAFEFEED; // Reset our trigger
__set_MSP(0x20002250);
// 0x1ff0 0000 is "System Memory" start address for STM32 L0xx
SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1ff00004)); // Point the PC to the System Memory reset vector (+4)
SysMemBootJump();
while (1);
}
....
Hi,
It's exactly what I do, working perfectly with F072, not working with L072
2020-05-17 06:07 AM
You have to set SYSCFG->CFGR1 so that system rom gets mapped at address 0 before the jump
2020-05-17 10:30 AM
Hi thank-you for feedback,
I added
SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1ff00004)); // Point the PC to the System Memory reset vector (+4)
SYSCFG->CFGR1 |= 0x01 ;
SysMemBootJump();
Maybe I didn't correctly understand you, but the system reset immediately and didn't jump in the DFU mode
2020-05-17 10:45 AM
STM32L0 also has VTOR, so you may need to set it too.
2020-05-17 12:38 PM
Not better :(
2020-05-18 03:47 AM
Then single step in the debugger and find out where and why things go wrong.
2024-06-21 07:32 AM
Hi, I'm facing the same issue on my L072.
Have you finally succeeded to get into DFU ? If so, can you tell me how ?