Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/zero/zero/app-development/gpio-pin-selection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
sidebar_position: 3
---

# GPIO 引脚选择指南

以 Radxa ZERO 为例,当你需要选择一个 GPIO 引脚时,以下几点值得考虑:

1. 如果你计划将某个引脚用作其他硬件功能(如 SPI / I2C / PWM 等),那么它**不能**再作为 GPIO 使用。
2. 一般来说,ADC 引脚**不能**用作 GPIO(引脚 15 和 26)。至少不能作为输出来使用。
3. 尽量避免使用引脚 8 和 10,它们是默认的调试串口,许多软件部分都假设它们可用。
4. 尽量避免使用仅在特定硬件版本上才可用的引脚(引脚 35 和 38),以便在采购时有更多灵活性。
5. 尽量避免使用开漏(OD)引脚(引脚 22 和 36),因为它们需要额外的电路才能像普通 GPIO 一样工作。

以上指南在拥有足够开发资源的情况下几乎都可以被打破,并且它们按照所需工作量从多到少排序。但如果你已经因为 GPIO 数量不足而考虑违背第 4 条,那么你或许应该考虑加入一个 I2C/SPI GPIO 扩展芯片,省去这些麻烦。

:::info
本页以 Radxa ZERO 为例。其他产品的具体引脚功能请以对应产品的 [硬件接口说明](../hardware-design/hardware-interface) 为准。
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
sidebar_position: 3
---

# GPIO Pin Selection Guidelines

Taking Radxa ZERO as an example, here are some things to consider when you need to pick a GPIO pin:

1. If you plan to use a pin as another hardware feature (i.e. SPI/I2C/PWM/etc), then it CANNOT be used as GPIO.
2. Generally, ADC pins CANNOT be used as GPIO (pin 15 & 26). Not the output at least.
3. Avoid pin 8 & 10, since they are the default debug console, and many software parts assume they are available.
4. Avoid pins that are only available on a specific hardware revision (pin 35 & 38) to allow more sourcing flexibility.
5. Avoid OD pins (pin 22 & 36) since they require additional circuit to function like a normal GPIO.

Now almost every guideline above can be violated given enough development resources, and they are ordered by the effort required from the most to the least. But if you are already considering to go against #4 due to the lack of available GPIOs, you might want to include an I2C/SPI GPIO expander and save the headache.

:::info
This page takes Radxa ZERO as an example. For other products, please refer to the pin functions listed in the corresponding [hardware interface](../hardware-design/hardware-interface) page.
:::
Loading