Skip to main content
Associate
January 11, 2024
Solved

GPO is not working properly

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.
TDK
TDKBest answer
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""."

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 Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
TDK
TDKBest answer
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""."