• sales

    +86-0755-88291180

Luckfox Pico RV1103【Tutorial on how to use GPIO】

1] GPIO numbering calculation:


GPIO has 5 banks, GPIO0 to GPIO4, and each bank has 32 pins, named as follows:

GPIO0_A0 ~ A7 

GPIO0_B0 ~ B7 

GPIO0_C0 ~ C7 

GPIO0_D0 ~ D7 

GPIO1_A0 ~ A7 .... 

GPIO1_D0 ~ D7.... 

GPIO4_D0 ~ D7

GPIO 
The quantity can be calculated as follows, taking GPIO1_C7_d as an example:

GPIO1_C7_d = 1*32 + 2*8 + 7 = 55
(A=0, B=1, C=2, D=3)

2] Control I/O using the GPIO sysfs interface.:

echo
55 > /sys/class/gpio/export cd /sys/class/gpio/gpio55 echo out > direction echo 1 > value # Output a high level. echo 0 > value # Output a low level.
Set GPIO4_C6 as output.



3] Test the GPIO sample provided by the official SDK:

Source code: luckluckfox-gpio-test.c

3-1] Send the test routine to the Pico development board

3-2] Before running the program, make sure to grant executable permissions:chmod 777 ./luckfox_gpio_test

3-3] Run luckluckfox_gpio_test:


4] Verify the luckfox_gpio_test example:

4-1] Connect the LED to the following pins using the plugin.


4-2] he experimental phenomenon is that the LED lights up and turns off sequentially.



】FAQ:

 The number of GPIO can be calculated as follows, taking GPIO1_C7_d as an example:

GPIO1_C7_d = 1*32 + 2*8 + 7 = 55

(A=0, B=1, C=2, D=3)


Explanation of the calculation process:

In some microcontrollers or chips, pins or I/O ports are typically identified and accessed using a numbering system. This numbering system is usually composed of multiple parts, such as GPIO group, GPIO group letter, and digits.

In this example, GPIO1_C7_d is an identifier for a pin. Let’s break down the meaning of GPIO1_C7_d:

Explanation of the calculation process:

The calculation “1 * 32 + 2 * 8 + 7 = 55” is used to convert GPIO1_C7_d into a numerical identifier. Here’s how each part is calculated:

“1 * 32” represents the GPIO group number (Group) multiplied by the number of pins in each GPIO group. In this case, GPIO1 group has 32 pins.

“2 * 8” represents the index of the GPIO group letter (Group Letter) multiplied by the number of pins represented by each letter. In this device, the letter represents C, indicating it is the third letter in the group, and each letter has 8 pins.

“7” represents the number of the 7th pin (Digit).

By multiplying and adding these parts together, we get the numerical identifier of the pin GPIO1_C7_d as 55.

This numerical identifier calculation helps uniquely identify and access each pin, making it convenient for pin configuration and control in programming.

GPIO Group: In this case, it is GPIO1.

GPIO groups are used to differentiate different groups of pins. A chip may have multiple GPIO groups.

GPIO Group Letter: In this case, it is C.

GPIO group letters are used to further divide the pins within each GPIO group, typically starting from A and incrementing. (A=0, B=1, C=2, D=3)

Digit: In this case, it is 7, representing the 7th pin under the C letter in the GPIO group.

Suffix: In this case, it is the letter “d”.

Suffixes are often used to differentiate different functions or properties, such as input or output.

TAG: ESP32-P4-WIFI6-POE-ETH ESP32-C6 MIPI DSI 10.1 inch Display/CSI Camera/Audio Speaker For AI Deepseek BPI-M4 Berry ESP32 S3 X1300 X1300-A2 Raspberry Pi 5 HDMI to CSI-2 Shield 1080P@60fps & Audio & Video Also USB TO 2.5G Ethernet Port Converter RJ45 RTL8156B Driver-Free For Windows/macOS/Linux/Android Industrial ESP32-S3 Relay 8-Channel 8-Ch ESP32-WROOM IOT WiFi Bluetooth HAT For Arduino Industrial USB HUB USB3.2 Gen1 One-To-4U Onboard 7~36V DC power port For Multi Systems Raspberry Pi Camera 8MP IMX415 also For Luckfox-Omni3576 RK3576 X1012 Raspberry Pi 5 POE And PCIe to M.2 NVMe SSD Board Pi5 2280 Power over Ethernet RP2040 LoRa-HF HDMI to LVDS Raspberry Pi DSI LCD 2.9 inch Passive NFC e-Paper ink (G) RYBW Display Screen No Need Battery Wireless Power & Data Transfer ESP32 S3 Development Board 2.8 inch Round LCD Display 480x480 QMI8658 Sensor / SD /MP3 Audio /Battery Port LVGL/HMI For Arduino ESP32-P4 DEV-KIT C6 WiFi6 MIPI DSI 7/10.1 inch Display/CSI Camera/Audio Speaker For AI Deepseek Raspberry Pi Pico 2 RP2350 2 inch LCD Capacitive TouchScreen Development Board 240x320 Display QMI8658 6-Axis /OV5640 Camera /SD /Battery Port RS232 to CAN Raspberry Pi PICO Capacitive Touchscreen Raspberry Pi CM5 IO BASE A Mini Board a Base Development Platform Compute Module 5 IO Board