cancel
Showing results for 
Search instead for 
Did you mean: 

Info: Use of the EXTI requires the AFIO clock!

swhite
Associate III
Posted on May 30, 2009 at 09:26

Info: Use of the EXTI requires the AFIO clock!

8 REPLIES 8
swhite
Associate III
Posted on May 17, 2011 at 13:12

I had an issue with interrupts on a GPIO pin over the last few days. Since I notice that others have had issues with this feature here I thought I'd post my findings.

To get interrupts working on a GPIO pin you need to

1) Configure the GPIO pin & enable the clock for the port.

2) Configure the EXTI.

3) Configure the NVIC.

What the reference manual etc don't say is that you MUST enable the AFIO clock for the EXTI to operate. It is NOT enough just enable the clock for the port you're using. This should be done between steps 1) & 2) above.

I hope this saves someone a few days of frustration.

nickkinchin
Associate II
Posted on May 17, 2011 at 13:12

Hi,

I've just been working through the fimware lib example 'NVIC\Priority' and found that the example uses 'RCC_APB2Periph_AFIO' in the RCC_APB2PeriphClockCmd call.

When I removed this the EXTI interrupt still worked. To me it seems it makes no difference.

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);

Both versions of the above code allow the EXTI to work when I tried it. I don't know what to think!

Regards, Nick.

16-32micros
Associate III
Posted on May 17, 2011 at 13:12

Hi,

Refer to my post at this Thread :

http://www.st.com/mcu/forums-cat-8453-23.html

We will enhance the RM0008 manual to make the usage more visible and easy for your designs.

Cheers,

STOne-32.

swhite
Associate III
Posted on May 17, 2011 at 13:12

I was told by an ST FAE that the AFIO clock was required when using the EXTI after I spent a day trying to get my code to work. As soon as I enabled it (it wasn't already) everything worked. The FAE agreed that the reference manual was vague about this ''feature''.

nanayakkaraan
Associate II
Posted on May 17, 2011 at 13:12

Hello,

Can somebody kindly figure out what is comparable to AFIO registers for STM32L devices :o

Thank you.

Posted on May 17, 2011 at 13:12

Can somebody kindly figure out what is comparable to AFIO registers for STM32L devices :o

 

They are in the SYSCFG unit according to the Reference Manual.

SYSCFG_EXTICRx

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Evangelist III
Posted on May 17, 2011 at 13:12

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);

 

 

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);

 

 

Both versions of the above code allow the EXTI to work when I tried it. I don't know what to think!

Presumably, the AFIO clock is also being enabled somewhere else in the code?

Andrew Neil
Evangelist III
Posted on May 17, 2011 at 13:12

Refer to my post at this Thread :

http://www.st.com/mcu/forums-cat-8453-23.html

 

 

That link doesn't work!

It just takes me to the list of forums!

(still waiting for a decent thread-linking capability on the ST forums)