Skip to content

Enter DFU mode with stm32F401 (bootloader Issue) #8523

Closed
@devHAA

Description

@devHAA

Description

Hello,

I'm having troubles with mbed-os 5. With the previous version of mbed (v163) it worked perfectly. With the following piece of assembler code, the micro (stm32F401) enters DFU mode. But with the newest version of mbed-os 5 (5.10.2) doesn't work.

  • Target: NUCLEO-F401RE
  • Toolchain: GCC_ARM (7 2018-q2-update)
  • Using eclipse + mbed-cli (v1.8.2)
  • Mbed OS (5.10.2)
void enterDFU(){

__asm ("LDR     R0, =0x40023844");// RCC_APB2ENR
__asm ("LDR     R1, =0x00004000");// ENABLE SYSCFG CLOCK
__asm ("STR     R1, [R0, #0]");

__asm ("LDR     R0, =0x40013800");// remap ROM at zero
__asm ("LDR     R1, =0x00000001");// SYSCFG_MEMRMP
__asm ("STR     R1, [R0, #0]");

__asm ("LDR     R0, =0x1FFF0000");// ROM BASE
__asm ("LDR     SP,[R0, #0]");    // SP @ +0
__asm ("LDR     R0,[R0, #4]");    // PC @ +4

__asm ("BX      R0");             // Jump to Bootloader
}

I've been doing some tests and I think that the problem is in the last line __asm ("BX R0"); , when it should jump to the Bootloader. If I try to connect the device on the PC it says "descriptor request error".

Any ideas what may be happening, Thank you.

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions