Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:techref:hardware:port.gpio [2019/09/03 13:55] – [script "static"] add section title brianpow | docs:techref:hardware:port.gpio [2023/07/20 01:47] (current) – Add info box about gpiod-tools, gpio sysfs has been marked obsolete and won't work correctly djfe | ||
|---|---|---|---|
| Line 31: | Line 31: | ||
| | [[https:// | | [[https:// | ||
| - | You can connect 5V digital signal sensors if you use a voltage | + | You can connect 5V digital signal sensors if you use a voltage |
| - | Sensor signal output is in the 5V range, connect it to the voltage | + | Sensor signal output is in the 5V range, connect it to the voltage |
| \\ \\ {{: | \\ \\ {{: | ||
| Line 41: | Line 41: | ||
| Many times some GPIOs cannot be controlled by the kernel because they are multiplexed, | Many times some GPIOs cannot be controlled by the kernel because they are multiplexed, | ||
| - | * Example 1: on the Broadcom BCM6328 SoC, GPIO pins 25, 26, 27 and 28 are used to indicate the LAN activity with hardware controlled LEDs. The memory register for setting this multiplexing is at 0x1000009C address, 64bits wide. Let's read it in OpenWrt\\ | + | * Example 1: on the Broadcom BCM6328 SoC, GPIO pins 25, 26, 27 and 28 are used to indicate the LAN activity with hardware controlled LEDs. The memory register for setting this multiplexing is at 0x1000009C address, 64bits wide. Let's read it in OpenWrt\\ <code> |
| - | 0x0154000000000000</ | + | 0x0154000000000000</ |
| - | * Example 2: on the Atheros AR7240 SoC, GPIO pins 6, 7 and 8 are used by the JTAG interface. The memory register for AR7240 GPIO pinmux is at 0x18040028 address, 32 bits wide. Let's read it:\\ '' | + | * Example 2: on the Atheros AR7240 SoC, GPIO pins 6, 7 and 8 are used by the JTAG interface. The memory register for AR7240 GPIO pinmux is at 0x18040028 address, 32 bits wide. Let's read it:\\ <code> |
| - | 0x48002</ | + | 0x48002</ |
| ==== GPIO Interrupts ==== | ==== GPIO Interrupts ==== | ||
| GPIO interrupts are useful when a GPIO is used as input and you need to manage high signal frequencies. Without interrupts, GPIO inputs must be managed using the **polling** method. With polling you cannot manage signal inputs with high frequencies, | GPIO interrupts are useful when a GPIO is used as input and you need to manage high signal frequencies. Without interrupts, GPIO inputs must be managed using the **polling** method. With polling you cannot manage signal inputs with high frequencies, | ||
| Line 56: | Line 56: | ||
| ===== Software ===== | ===== Software ===== | ||
| + | <WRAP round info 100%> | ||
| + | **The GPIO SYSFS interface has been marked as obsolete in 2015. I couldn' | ||
| + | |||
| + | The new interface is the linux GPIO character device. One way to access it is [[https:// | ||
| + | |||
| + | You can install it with the [[: | ||
| + | |||
| + | <code bash> | ||
| + | opkg install gpiod-tools</ | ||
| + | |||
| + | A good article on how to use the new CLI and why we should move on: [[https:// | ||
| + | |||
| + | The biggest differences are: | ||
| + | * The new interface isn't stateless like the old one. Processes are able to take exclusive control over a gpio line now | ||
| + | * There is a character device / | ||
| + | * TODO | ||
| + | As I said: This page needs an overhaul. This info box is just to prevent people from wasting their time on a deprecated ABI. | ||
| + | </ | ||
| + | |||
| In linux GPIOs can be accessed through GPIO SYSFS interface: **/ | In linux GPIOs can be accessed through GPIO SYSFS interface: **/ | ||
| Line 251: | Line 270: | ||
| ===== Finding GPIO pins (input) on the PCB ===== | ===== Finding GPIO pins (input) on the PCB ===== | ||
| + | |||
| + | ==== script "gpio in" ==== | ||
| + | |||
| Sometimes you do not know where the physical GPIO pins (input) are on your device' | Sometimes you do not know where the physical GPIO pins (input) are on your device' | ||
| Line 278: | Line 300: | ||
| - Press ctrl-c to stop the script, then check which GPIOs have been created: '' | - Press ctrl-c to stop the script, then check which GPIOs have been created: '' | ||
| - | Another script | + | ==== script "gpio in" ==== |
| + | |||
| + | Another script | ||
| <code bash> | <code bash> | ||
| Line 324: | Line 348: | ||
| - Compare the changed GPIO value which corresponding to the button held | - Compare the changed GPIO value which corresponding to the button held | ||
| ===== Links ===== | ===== Links ===== | ||
| - | * [[http:// | + | * [[https:// |
| * [[http:// | * [[http:// | ||