pinmux
The pin names for Duo
PIN NAME | Pin# | Pin# | PIN NAME |
---|---|---|---|
GP0 | 1 | 40 | VBUS |
GP1 | 2 | 39 | VSYS |
GND | 3 | 38 | GND |
GP2 | 4 | 37 | 3V3_EN |
GP3 | 5 | 36 | 3V3(OUT) |
GP4 | 6 | 35 | |
GP5 | 7 | 34 | |
GND | 8 | 33 | GND |
GP6 | 9 | 32 | GP27 |
GP7 | 10 | 31 | GP26 |
GP8 | 21 | 30 | RUN |
GP9 | 12 | 29 | GP22 |
GND | 13 | 28 | GND |
GP10 | 14 | 27 | GP21 |
GP11 | 15 | 26 | GP20 |
GP12 | 16 | 25 | GP19 |
GP13 | 17 | 24 | GP18 |
GND | 18 | 23 | GND |
GP14 | 19 | 22 | GP17 |
GP15 | 20 | 21 | GP16 |
GP25 | LED |
Pin multiplexing configuration
Many of Duo's pins have multipurpose functionality. When using applications (such as wiringX, pinpong) to control the functions of each pin, it is important to confirm the current state of the pin to ensure it matches the desired functionality. If it doesn't, you can use the duo-pinmux
command to switch it to the desired function
Executing the duo-pinmux
command directly allows you to view the usage instructions
[root@milkv-duo]~# duo-pinmux
pinmux for duo
duo-pinmux -p <== List all pins
duo-pinmux -l <== List all pins and its func
duo-pinmux -r pin <== Get func from pin
duo-pinmux -w pin/func <== Set func to pin
To check the multiplexing status of a specific pin, such as pin 1 on Duo, you need to know the name of that pin. As indicated in the diagram above, the name of pin 1 is GP0
. To view its multiplexing status, use the command duo-pinmux -r
followed by the pin name
[root@milkv-duo]~# duo-pinmux -r GP0
GP0 function:
[ ] JTAG_TDI
[ ] UART1_TX
[ ] UART2_TX
[ ] GP0
[v] IIC0_SCL
[ ] WG0_D0
[ ] DBG_10
You can see that the current function is IIC0_SCL
, indicating it is configured as the SCL pin for I2C0. If you want to configure pin 1 as a GPIO, you can use the following command: duo-pinmux -w pin_name/function
duo-pinmux -w GP0/GP0
Now, check the multiplexing status of the pin again
[root@milkv-duo]~# duo-pinmux -r GP0
GP0 function:
[ ] JTAG_TDI
[ ] UART1_TX
[ ] UART2_TX
[v] GP0
[ ] IIC0_SCL
[ ] WG0_D0
[ ] DBG_10
You can see that it has been configured as GP0
now
Similarly, to configure pin 1 as the TX pin for UART1, you need to execute
duo-pinmux -w GP0/UART1_TX
Check the multiplexing status
[root@milkv-duo]~# duo-pinmux -r GP0
GP0 function:
[ ] JTAG_TDI
[v] UART1_TX
[ ] UART2_TX
[ ] GP0
[ ] IIC0_SCL
[ ] WG0_D0
[ ] DBG_10
It meets the expectation