cancel
Showing results for 
Search instead for 
Did you mean: 

Hello everyone, I used a bootloader for Stm32f1xx, but if I use hal_delay after the jump function, the microcontroller stops working. I'm waiting for your help.

h.musabyacel
Associate

if (HAL_GPIO_ReadPin(button_GPIO_Port,button_Pin)==1) //mypushbutton==1

 { 

  /* If Key is pressed */

  /* Execute the IAP driver in order to re-program the Flash */

  printf("\r\n\r\n");

  Main_Menu();

 }

// /* Keep the user application running */

 else

 {

if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)

  {

   /* Jump to user application */

   JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);

   Jump_To_Application = (pFunction) JumpAddress;

   /* Initialize user application's Stack Pointer */

   __set_MSP(*(__IO uint32_t*) ApplicationAddress);

HAL_UART_DeInit(&huart1);

HAL_UART_MspDeInit(&huart1);

HAL_RCC_DeInit();

HAL_MspDeInit();

HAL_DeInit();

HAL_PWR_DeInit();

__disable_irq();

__DSB();

Jump_To_Application();

  }

}

2 REPLIES 2

Don't jump from interrupt/callback context.

And when you disable interrupts at the processor level expect to have to re-enable them if you ever want to see them again.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
h.musabyacel
Associate

thanks for your answer,

when I did what you said program is running but if I use delay function program stops working. 

no problem when I use USART interrupt, but if I use a delay, processor stops working.

what do you think about this problem?