メインコンテンツにスキップ

pinmux

Note that many pin functions of the Duo series are multiplexed. 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.

The pin names for Duo and Duo256M

For Duo pin multiplexing function, please refer to: Duo GPIO Pinout

For Duo256M pin multiplexing function, please refer to: Duo256M GPIO Pinout

PIN NAMEPin#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
11
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

The pin names for DuoS

For DuoS pin multiplexing function, please refer to: DuoS GPIO Pinout

Header J3

GPIO on Header J3 use 3.3V logic levels.

PIN NAMEPIN#PIN#PIN NAME
3V3
1
2
VSYS(5V)
B20
3
4
VSYS(5V)
B21
5
6
GND
B18
7
8
A16
GND*
9
10
A17
B11
11
12
B19
B12
13
14
GND
B22
15
16
A20
3V3
17
18
A19
B13
19
20
GND
B14
21
22
A18
B15
23
24
B16
GND
25
26
A28

GND*: Pin 9 is a low-level GPIO in the V1.1 version of the hardware, and is GND in the V1.2 version and later.

Header J4

GPIO on Header J4 use 1.8V logic levels.

Most of the pins on this header have dedicated functions, such as MIPI DSI signals, Touch Screen signals, and audio signals. If there is no special requirement, it is not recommended to use the pins on this header as GPIO.

PIN NAMEPIN#PIN#PIN NAME
VSYS(5V)
52
51
AUDIO_OUT_R
B1
50
49
AUDIO_OUT_L
B2
48
47
AUDIO_IN_R
B3
46
45
AUDIO_IN_L
E2
44
43
3V3
E1
42
41
C18
E0
40
39
C19
GND
38
37
GND
C20
36
35
C16
C21
34
33
C17
GND
32
31
GND
C14
30
29
C12
C15
28
27
C13

Pin multiplexing configuration

The following uses Duo as an example to introduce how to configure pin multiplexing.

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