Skip to main content
oosthuizen
Associate II
January 24, 2013
Question

EXTI and SWI

  • January 24, 2013
  • 5 replies
  • 1326 views
Posted on January 24, 2013 at 20:13

EXTI and SWI

#stm32f0-exti-swi
This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
January 24, 2013
Posted on January 24, 2013 at 20:26

Forum appears to have eaten, please try again.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
oosthuizen
Associate II
January 24, 2013
Posted on January 24, 2013 at 20:37

Ok attempt number 4:  In my final application I have to implement a external interrupt on PA14 of a 

STM32F051K6 to wake from sleep. Using the NVIC WFI mode example on a STM32F0-Discovery board I implement the function but cant debug because of the SWCLK function that shares this pin. All well and good but in ''release build'' the EXTI interrupt doesn't seem to fire. Do I have to disable SWI somehow? Is this even possible?

Thanks

Tesla DeLorean
Guru
January 25, 2013
Posted on January 25, 2013 at 03:51

Ok attempt number 4: In my final application I have to implement a external interrupt on PA14 of aSTM32F051K6 to wake from sleep. Using theNVIC WFI mode example on a STM32F0-Discovery board I implement the function but cant debug because of the SWCLK function that shares this pin. All well and good but in ''release build'' the EXTI interrupt doesn't seem to fire. Do I have to disable SWI somehow? Is this even possible?

I think the way to disable SWD is to reconfigure the GPIO's off the AF setting, presumably you're setting them up as inputs? As a blind stab, it should probably look like this

void EXTI14_Config(void)
{
EXTI_InitTypeDef EXTI_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* Enable GPIOA clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
/* Configure PA14 pin as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Connect EXTI14 Line to PA14 pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource14);
/* Configure EXTI14 line */
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable and set EXTI14 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = EXTI4_15_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority = 0x00;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}

void EXTI4_15_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line14) != RESET)
{
/* Something Something */
/* Clear the EXTI line 14 pending bit */
EXTI_ClearITPendingBit(EXTI_Line14);
}
}

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
oosthuizen
Associate II
January 25, 2013
Posted on January 25, 2013 at 07:28

Thanks clive1,

That is how I configure the pin and EXTI. Is the sequence of any importance? I have functions that Setup RCC then GPIOs and so on. I'll build a program with just the EXTI config and see where that gets me.

Cheers

EDIT: After no luck with the EXTI only code I released that it could be switch bounce. Added a RC to my test switch and Bobs my uncle.  To recap, setup PIN PA14 for EXTI as you would any other PIN (see clive1's post). This will disable the SWI at run time.

A big thanks to clive1 for easing the calm!

Cheers

oosthuizen
Associate II
February 11, 2013
Posted on February 11, 2013 at 09:18

Will the functionality of EXTI change if pull ups/downs are enabled in the pin configuration? Or will EXTI still function with pull ups/downs? All the examples I've seen don't use pull ups/downs. Is there a reason for that?