AnsweredAssumed Answered

stm32f103 IAP App not running with EXTI_Init enabled

Question asked by chan.anson.002 on Jun 5, 2014
Latest reply on Jun 9, 2014 by chan.anson.002
hi, all
I'm working on a IAP function with stm32f103cb.
Partition(IROM1 configuration):
part           base    size
bootloader:0x8000000      0xF800
user app:  0x800F800     0x10000

implementation:
bootloader: receive user app image from uart and write to P2, jump to P2 when finishing.

#define APPLICATION_ADDRESS  (0x80000000+0xF800)
uint8_t jump_flag = 0;
int main(void)
{
 RCC_Configuration();
 NVIC_Configuration();
 GPIO_Configuration();
 USART2_Configuration();
 
if(jump_flag)
    {
 
    if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
    {
      /* Jump to user application */
      JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
      Jump_To_Application = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
     uprint("Jump_To_Application!");
     delay_ms(1);
      Jump_To_Application();
 
    }
    }

user app: LED binking

void NVIC_Configuration(void)
{
    NVIC_InitTypeDef NVIC_InitStructure;
    EXTI_InitTypeDef EXTI_InitStructure;
     
//  NVIC_SetVectorTable(NVIC_VectTab_FLASH,APPLICATION_ADDRESS);
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
 
    NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&NVIC_InitStructure);                                            
     
    GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0);
     
    EXTI_InitStructure.EXTI_Line = EXTI_Line0; 
    EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
    EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
    EXTI_InitStructure.EXTI_LineCmd = ENABLE;          
    EXTI_Init(&EXTI_InitStructure);
}
 
int main(void)
{
    RCC_Configuration();
//    NVIC_Configuration();
    NVIC_SetVectorTable(NVIC_VectTab_FLASH,0xF800);
    GPIO_Configuration();
    USART2_Configuration();
     
    uprintf("LED blinking!");
    while(1)
    {
        delay_ms(1000);
        GPIOC->ODR ^= GPIO_Pin_13;
    }
}

issue:
the user app runs well if NVIC_Configuration() or EXTI_Init(&EXTI_InitStructure); is commented.
but when uncommented it doesn't work.
It's hard to debug this part. I'm confused if I missed anything.
Any thoughts? Many thanks.

Outcomes