Skip to main content
Utkarash Patil
Associate III
September 22, 2017
Question

STM32F103 External Switch Interrupt Problem

  • September 22, 2017
  • 2 replies
  • 860 views
Posted on September 22, 2017 at 10:00

I am using  a custom board in which i have connected 5 switches to the pins as given below and pins are configured as Pull Up and i am triggering interrupt on falling edge

PB9 <===> External Switch 1      

PB5 <===> External Switch 2       

PB3 <===> External Switch 3       

PC12 <===> External Switch 4     

PC10 <===> External Switch 5     

Also i have checked the  connection with the help of Digital Multi meter where  whenever i press the Switch the connectivity is established and when i release it connectivity is broken with ground , But still in call back function for ' PB3 <===> External Switch 3

 ' i am not getting any response but for other Switches I am getting updates they are interrupting my CPU and in call back also i am able to see the updates,

That is i checked with this by inserting the break point for every switch condition in call back function But the other switches  apart from ' PB3 <===> External Switch 3

 ' execution flow goes to the break point when switch is pressed, but for switch 3 execution flow

doesn't goes to Break point when the switch is pressed 

Please tell me if  Am i missing out on something while Enabling the interrupt or in configuration Tab,in below paragraph i described the details in cubemx which i have followed,

In cubeMx firstly i used 5 pins which are connected to switches and configured them as GPIO_EXTIx  also enabled their respective interrupts in NVIC in configuration tab that are External Interrupt 3, External Interrupt 9:5 and External Interrupt 15:10, also for indication i have connected 5 pins to different LEDs and configured them as Pull up and triggered when falling edge 

The code is uploaded below 

    This topic has been closed for replies.

    2 replies

    Vangelis Fortounas
    Associate II
    September 22, 2017
    Posted on September 22, 2017 at 14:22

    Hello!

    0690X00000608KNQAY.png

    In Pinout tab->sys select the serial wire mode to release the PB3 PB4  and PA15 pins from TRACESWO NJRST and JTDI  functionality(default)

    0690X00000608LBQAY.png

    regards

    vf

    Utkarash Patil
    Associate III
    September 23, 2017
    Posted on September 23, 2017 at 05:47

    Thank You for reply It has helped me a lot and now my issue is also resolved,

    Thanks a lot for helping and providing such a good guidance.

    Vangelis Fortounas
    Associate II
    September 22, 2017
    Posted on September 22, 2017 at 17:26

    I found also that you haven't  updated your firmware library(you use 1.4vs 1.9), This problem caused when you selected at Pinout tab->sys 'Î�o Debug'. Normaly the CubMx must have produced   __HAL_AFIO_REMAP_SWJ_DISABLE(); at stm32f1xx_hal_msp.c file  but didn't produced.