AnsweredAssumed Answered

DFU Bootloader for STM32L072xx

Question asked by raggini.davide on Jun 24, 2017
Latest reply on Nov 21, 2017 by chabin.laurent

Hi there,


I'm facing some problem in getting a STM32L072 MCU in DFU (USB) mode by jumping to the Bootloader in-code.

Following other posts suggestion and the AN2606 i've written these two functions:



uint32_t dfu_reset_to_bootloader_magic;

1) The function that I call to set a token in memory and trigger a soft-reset:


 * Jump to the DFU Mode for firmware upgrade using USB


void dfuse_RunBootloader( void )


    dfu_reset_to_bootloader_magic = RESET_TO_BOOTLOADER_MAGIC_CODE;




2) The function that get executed as first function in the main:


 * Check if a DfuSe Bootloader request was triggered

 * and jump to the dedicated internal routine.


void dfuse_CheckAndRun( void )



    if (dfu_reset_to_bootloader_magic == RESET_TO_BOOTLOADER_MAGIC_CODE) {


        dfu_reset_to_bootloader_magic = 0;

        // Just to be sure that's all de-initialised






        __ASM volatile ("movs r3, #0\nldr r3, [r3, #0]\nMSR msp, r3\n" : : : "r3", "sp");

        // Application Interrupt and Reset Control :: resetting the peripherals, change the value to 0x05FA0001


           #define SCB_AIRCR_VECTKEY_RESET (0x05FA0001)



        ((void (*)(void)) *((uint32_t*) 0x00000004))();






After the jump, the MCU goes correctly to the System Flash Memory area containing the Bootloader but no DFU USB device appears in Windows (so nothing can be done with DfuSe). 


Did I miss something before the jump to the code / did I made some code error?


Thank you for your help and I hope this question will help also other people!