4-1 Introduction to GPIO
Learning Objectives
This chapter aims to help learners understand GPIO operations on the Pandora platform and master the basic principles of input and output control.
Learners will learn how to use the GPIO subsystem and libgpiod to configure and operate GPIO pins, achieve simple GPIO input/output functions, and understand their application scenarios in embedded systems.
1. What is GPIO?
GPIO stands for General Purpose Input/Output. Simply put, there are small pins (like sockets) on the Jetson board that you can configure to:
- Input: Such as reading whether a button has been pressed, or if a sensor has detected an object.
- Output: Such as turning on an LED light, starting a motor, or activating a buzzer.
These pins act as a bridge for you to communicate with the outside world!
2. How to use GPIO on Jetson?
On Jetson, GPIOs are like "numbered sockets" on the board, but the numbering is unique. NVIDIA assigns a unique identifier to each pin, such as GPIO3_PAA.01 or PQ.05. These identifiers correspond to GPIO numbers in the Linux system, allowing you to control them via programming.
You can control Jetson GPIOs in two ways:
- Python Program: Using a Python library called Jetson.GPIO to write programs that control the pins.
- Linux Commands: Directly using Linux system tools for operation.
We will mainly focus on using Linux commands to control GPIO on the Pandora.
3. Pandora GPIO Numbering
Pandora features a 40-pin header, where each pin has its own identifier. For example:
- GPIO01 corresponds to PQ.05
- GPIO07 corresponds to PG.06
- GPIO09 corresponds to PAC.06
- GPIO11 corresponds to PQ.06
- GPIO12 corresponds to PH.00
- GPIO13 corresponds to PN.01
These identifiers work like "ID cards" for the pins, telling us which pin is which. You can use these identifiers to configure the pin's function (Input or Output).
Quick Tips
- Safety First: Ensure the Jetson board is powered off when wiring to prevent damaging the board or components.
- Check Documentation: If you are unsure about a pin's number or function, check NVIDIA's official documentation or the board's user manual.