Skip to main content
Graduate
September 30, 2023
Solved

USB HOST bootloader, start application

  • September 30, 2023
  • 1 reply
  • 2407 views

Starting from this video (https://www.youtube.com/watch?v=CGUC1wqSLCE) I'm trying to write my bootloader for DFU from an USB stick. The code works but I would like to tweak it such that:

  • if at boot an USB stick is detected, than start the update, otherwise jump to application (done and it works)
  • at the end of the update, jump to the application (this does not work)

I got it work the second point by adding a delay to let me remove the USB stick. But if the USB stick is still plugged in, then the "jump to application part does not work.

I suspect that this is related some kind of USB peripheral initialization.

Here is the zip of the project.

    This topic has been closed for replies.
    Best answer by MM..1

    Try rearange your start into app from clean mcu state. I preffer reboot with some marker....

    Perfect is dont init or deinit all boot periph before jump.

    1 reply

    MM..1Answer
    Graduate II
    September 30, 2023

    Try rearange your start into app from clean mcu state. I preffer reboot with some marker....

    Perfect is dont init or deinit all boot periph before jump.

    DamianoFAuthor
    Graduate
    October 2, 2023

    Thank you so much! I have managed to implement your solution. It works, but there is still a problem: when the flash programming is finished, the application program starts but when I remove the USB memory device, the program freezes.

     

    EDIT: I fixed this issue by disabling the usb interrupt: HAL_NVIC_DisableIRQ(OTG_FS_IRQn);