Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Orange Pi Zero PA19 goes HIGH when reading input

Featured Replies

When I try to read the input on PA19 immediately goes to "1" even though there is no voltage being sent to the pin.

 

Example:

#!/usr/local/bin/python

from pyA20.gpio import gpio
from pyA20.gpio import port

pin_to_circuit = port.PA19

gpio.init()

gpio.setcfg(pin_to_circuit, gpio.OUTPUT)
gpio.output(pin_to_circuit, 0)

gpio.setcfg(pin_to_circuit, gpio.INPUT)
print(gpio.input(pin_to_circuit))

I don't understand why this would put "1" with nothing even connected to the PA19 pin?


Are there some settings I need to change to get PA19 working as a normal GPIO pin?

4 hours ago, David12412412 said:

I don't understand why this would put "1" with nothing even connected to the PA19 pin?

Pretty normal : PA19 is shared also as TWI1-SDA which is an I2C bus provided on header, and there are some PullUps resistors already present on the OPiZero board.

 

So, simply short PA19 to GND, you will see that your script will print "0".

 

  • Author

Is there any way to disable TWI1-SDA, so that PA19 just acts as a normal GPIO pin?  (so that I can read inputs normally as i would on another GPIO pin)

14 hours ago, David12412412 said:

If i short PA19 to GND how will I detect any input on PA19 as it will always just show "0"?

I didn't say to short to GND permanently, but simply to check that the input is working fine as normal GPIO ...

 

4 hours ago, David12412412 said:

Is there any way to disable TWI1-SDA

It is already disabled by default, unless you load an I2C DT overlay ...

  • Author

I'm still not really understanding how I go about using PA19 as a normal GPIO input port, so that I can check if an input has been received (such as from a push button).

 

Shorting PA19 to GND just means the voltage goes straight to GND and doesn't get detected as an INPUT.

 

I'm not sure if I'm asking my question in the wrong way?

For example if I have a push button from 3.3V to PA19 how can I detect a push on the button?

 

Circuit like this:

 

3.3V --------> Push Button ------->1k Resistor ------> PA19

 

Currently I cannot detect a push on this circuit because PA19 just shows "1" all the time for the input.

Edited by David12412412

On 8/2/2020 at 4:31 PM, David12412412 said:

3.3V --------> Push Button ------->1k Resistor ------> PA19

Error prone HW design with floating IO.
Proper design with fixed IO states:

VCC --------> Pullup Resistor ---|
GND --------> Push Button -------+------> PA19

The pullup is already in place.
Pressing the button will flip the IO from 1 to 0.

15 hours ago, Gabriel Bastos said:

Have u managed to PA19 work as input without reading HIGH level ?

What do you mean by "without reading HIGH level" ?

PA19 has a PullUp resistor, so by default it will be read as HIGH. To read it as LOW, it need to be shorted to GND as mentioned earlier in this thread ...

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.