AnsweredAssumed Answered

Exti stop working after jumping to the new firmware stm32L4

Question asked by raed.bouchaa on Mar 31, 2017
Latest reply on Jul 21, 2017 by LaserElettronicaSRL

Hi I am new here ,I am working on an application on stm32l4 microcontroller ,

the idea is when I press the user button the bootloader jump from the main application (0x08000000)

to the second one (0x08080000) . THe second firmware is just a blinking led application ,

the jumping is fine and the led start blinking , but my problem is that when I want to go back from the second application to

the first one (0x08000000) the exti won't work ! here's my code :

first firmware :

 if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)   {      
/* Jump to user application */     
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);     
JumpToApplication = (pFunction) JumpAddress;     
/* Initialize user application's Stack Pointer */     
__set_MSP
(*(__IO uint32_t*) APPLICATION_ADDRESS);      
__disable_irq
;     
SCB
->VTOR = FLASH_BASE | 0x80000;    
HAL_RCC_DeInit
();   
SysTick->CTRL =0;   
SysTick->LOAD=0;   
SysTick->VAL=0;  
__set_PRIMASK
(1);        
printf
("Starting Firmware 2 . . .  \r\n");   
HAL_DeInit
();       
JumpToApplication();}

the beginng of the second firmware :

  SCB->VTOR = FLASH_BASE | 0x80000;  
__set_PRIMASK
(0);   
HAL_Init
();    
SystemClock_Config();   
HAL_InitTick
(1); 

...

this is the exti callback from the second firmware :

    void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){    
HAL_NVIC_ClearPendingIRQ
(EXTI15_10_IRQn);   
HAL_NVIC_DisableIRQ
(EXTI15_10_IRQn); 
if (GPIO_Pin == GPIO_PIN_13) 
{   
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)  
{  JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);     
JumpToApplication = (pFunction) JumpAddress;      
__set_MSP
(*(__IO uint32_t*) APPLICATION_ADDRESS);       
HAL_NVIC_DisableIRQ
(EXTI15_10_IRQn);     
__disable_irq
;      
SCB
->VTOR = FLASH_BASE;     
JumpToApplication();     }}}

Can any one please tell me why this is not working ?

Outcomes