cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32L151rct6a EXTI Configuration Hang Problem

ishmeetsinghis
Associate II
Posted on October 03, 2013 at 08:47

STM32L151RCT6A under IAR Compiler, 

board hangs when I do these steps

  /* Enable SYSCFG clock */

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

  /* Connect EXTI1 Line to PA9 pin */

  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource9);

This is related to EXTI Configuration on PA9, to rising+falling edge in interrupt mode, I have written the code for configuration part, but it hangs when I do the above steps, when I remove them my code flows ahead, 

Has anyone encounter this problem ?

#stm32 #timer #exti #interrupt #rtfm #stm32-stm32l151
3 REPLIES 3
ishmeetsinghis
Associate II
Posted on October 03, 2013 at 13:04

I am trying getting EXTI interrupt but getting nowhere, here is my code which is basically direct from sample codes but not working, 

  EXTI_InitTypeDef EXTI_InitStructure;

  NVIC_InitTypeDef NVIC_InitStructure;

  GPIO_InitTypeDef GPIO_InitStructure;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource10);

  EXTI_InitStructure.EXTI_Line = EXTI_Line1;

  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;  

  EXTI_InitStructure.EXTI_LineCmd = ENABLE;

  EXTI_Init(&EXTI_InitStructure);

  NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;//0x0F;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;//0x0F;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

  EXTI_GenerateSWInterrupt(EXTI_Line1);

When I HIGH the PA10 pin, I get no software interrupt, The code does not goes to EXTI1_IRQHandler(), What seems to be missing?

Posted on October 03, 2013 at 13:50

What seems to be missing?

That PA9 is connected to Line9, and PA10 Line 10

The interrupt service via EXTI9_5_IRQHandler (EXTI9_5_IRQn), and EXTI15_10_IRQHandler (EXTI15_10_IRQn)
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ishmeetsinghis
Associate II
Posted on October 03, 2013 at 14:12

Solved, Thank you clive1, you are a life saver