Skip to main content
Associate
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

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

Tesla DeLorean
Guru
January 11, 2024

What board?

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

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
TDK
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.

"If you feel a post has answered your question, please click ""Accept as Solution""."