Skip to main content
Visitor II
January 11, 2024
Solved

GPO is not working properly

  • January 11, 2024
  • 2 replies
  • 1242 views

Hi Guys I'm facing one problem in GPO side .i have try to read the input pin PA_3 and PA_2 that time i'm facing one issue .

what i'm do try to read the switch using PA_3 and PA_2 Software side i have write pull down 
when i'm press the switch one PA_3 executing that loop same pa_2 but problem i have press the PA_3 switch is working Pa_2 loop and i press the pa_2 switch but is working pa_3 loop sometime is work normally 

 

this is my code so please help

    This topic has been closed for replies.
    Best answer by TDK

    You have a blocking 10sec delay within each loop. It won't look at PA2 until PA3 is complete with its 10 second loop.

    You need better program logic here. Use a state machine or a callback to advance whatever it is you want to do. Increment a counter and when it reaches certain values, toggle pins at the appropriate time.

    2 replies

    Graduate II
    January 11, 2024

    What board?

    Is there a UART using these pins? Provide a schematic. 

    TDKAnswer
    Super User
    January 11, 2024

    You have a blocking 10sec delay within each loop. It won't look at PA2 until PA3 is complete with its 10 second loop.

    You need better program logic here. Use a state machine or a callback to advance whatever it is you want to do. Increment a counter and when it reaches certain values, toggle pins at the appropriate time.