Skip to main content
Explorer
September 21, 2024
Question

Jump from UART internal bootloader to Application code issue

  • September 21, 2024
  • 1 reply
  • 2763 views

Hi Everyone,

 

I am using stm32u575 microcontroller. I am facing issue of stuck the application code in Hardfault handler when jump from internal UART bootloader to the Newly written application code.

 

Lets explain you the full process. I have a application code of FreeRTOS CMSIS 2 is running. Then, I give a command for jump to the Internal UART bootloader. The application code jump function triggers. The jump function has includes Disable all interrupts along with clear pending interrupts, deinitialize all peripherals, Disable all peripheral clocks, disable systick timer and Freertos Time base timer 6, function pointer for jump to Internal UART bootloader address etc. After this jump function executes, the Stack pointer goes to internal UART bootloader. The UART bootloader erases the application code and will write new application code that captures packets via UART communication. After the whole binary file of FreeRTOS new application process has been completed, I am triggers GO command (0x21) along with new application base address that is 0x08000000. The GO command will add 0x04 to the address and jump to the newly written application code. After jump to the new FreeRTOS application code, the code directly goes to the Hardfault handler.

 

When I press the RESET button of STM32, the newly updated binary file is running properly. But it requires my manual intervention that I don't want.

 

Can anybody know what is the cause of this problem and how can I Run the newly flashed binary after DFU update?

 

If you have any queries, please let me know.

 

 

Thanks,

Rushik Kanabar

    This topic has been closed for replies.

    1 reply

    Graduate II
    September 21, 2024

    Root cause the Hard Fault

    or watch dog reset out of the HardFault_Handler?

    Explorer
    September 21, 2024

    Thanks Tesla Deloren for reply.

     

    Sorry but Hardfault is the problem not root cause, I want to know root cause of why code go to Hardfault Handler.

     

    I can't use watchdog reset because If I use it, I want to know exect time of whole DFU transfer. But that varies according to code and if it triggers in between the DFU transfer process, my new application code will be corrupted. Also application note strictly noted that if watchdog is defined then set it max value to very high that doesn't triggers before enter to UART bootloader. So I can't do that.

     

    Anybody have other solutions?

    Graduate II
    September 21, 2024

    Sorry, so what IS causing the Hard Fault, show output from useful instrumentation..

    Call code that does a NVIC_SystemReset or WDG more directly then. Or something that spins on USB detach state and THEN reset.

    How can you call GO if the process hasn't completed?

    The time the DFU or UART loaders take should be irrelevant, you're calling GO to initiate the start / restart

     

    https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c