Skip to main content
swhite
Associate III
May 30, 2009
Question

Info: Use of the EXTI requires the AFIO clock!

  • May 30, 2009
  • 8 replies
  • 1459 views
Posted on May 30, 2009 at 09:26

Info: Use of the EXTI requires the AFIO clock!

    This topic has been closed for replies.

    8 replies

    nickkinchin
    Associate II
    May 17, 2011
    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.

    swhite
    swhiteAuthor
    Associate III
    May 17, 2011
    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.

    swhite
    swhiteAuthor
    Associate III
    May 17, 2011
    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''.

    16-32micros
    Associate III
    May 17, 2011
    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.

    Andrew Neil
    Super User
    May 17, 2011
    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?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Tesla DeLorean
    Guru
    May 17, 2011
    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 VenmoUp vote any posts that you find helpful, it shows what's working..
    nanayakkaraan
    Associate III
    May 17, 2011
    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.

    Andrew Neil
    Super User
    May 17, 2011
    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)

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.