how to add push button to GPIO?

Using Zynq Programmable Logic and Xilinx tools to create custom board configurations

how to add push button to GPIO?

Postby parallella-project » Mon Aug 13, 2018 1:39 pm

could anyone show me how to connect a push button to one of the GPIO ports? is there any schematic available for this?
parallella-project
 
Posts: 14
Joined: Sun Apr 30, 2017 5:06 pm

Re: how to add push button to GPIO?

Postby parallella-project » Mon Aug 13, 2018 5:54 pm

The other important point is that the GPIO ports are differential. so what should I do with the other dual GPIO port in the case of using push button? I mean where should I connect the dual GPIO port?
parallella-project
 
Posts: 14
Joined: Sun Apr 30, 2017 5:06 pm

Re: how to add push button to GPIO?

Postby olajep » Fri Aug 17, 2018 1:57 am

I don't have access to a Parallella board and it's been a while since I tried this so please bare with me.

The GPIO ports on the Parallella board are single-ended in the default bitstream. Not differential.

Porcupine pinout:
https://github.com/parallella/parallell ... /README.md

There's some tools in parallella-utils you can try to use to manipulate the gpio pins:
https://github.com/parallella/parallell ... aster/gpio
https://github.com/parallella/parallell ... r/gpio_dir

From here you can defer the pin ordering on the porcupine board:
https://github.com/parallella/parallell ... pp#L45-L51

And here we can see that the offset is 54 to GPIO pin 0 on the porcupine
https://github.com/parallella/parallell ... .h#L56-L60

Now the manual way:
Code: Select all
$ sudo su
$ cd /sys/class/gpio
# export porcupine gpio pin 0 to user space
$ echo 54 > export
# export porcupine gpio pin 1 to user space. see first link for offsets
$ echo 56 > export
# set direction of pin 0 to output
$ echo out > gpio54/direction
# set value=0 to pin 0
$ echo 0 > gpio54/value
# set direction of pin 1 to input (default)
$ echo in > gpio56/direction
# CONNECT A (physical) WIRE BETWEEN PIN 0 and 1
# read value from pin 1
$ cat gpio56/value
0
# set pin 0 value to 1
$ echo 1 > gpio54/value
# read pin 1 again
$ cat gpio56/value
1


If you use this configuration you can just connect the push button between pin 0 and pin 1.
The output current on the GPIO pins is limited to 8mA which the input can handle.
https://github.com/parallella/oh/blob/m ... gpio.v#L74

A proper circuit with a current limiting resistor can be seen here:
https://raspberrypihq.com/use-a-push-bu ... y-pi-gpio/

One end is connected to VGP (VDD_GPIO in schematics) on J6
and the other to a gpio pin.

HTH,
Ola
_start = 266470723;
olajep
 
Posts: 139
Joined: Mon Dec 17, 2012 3:24 am
Location: Sweden


Return to FPGA Design

Who is online

Users browsing this forum: No registered users and 7 guests

cron