Use all UART - Pinmux UART and serial


I would need to use all UART of DUO.
I can’t find a way to make /dev/ttyS1 (or 2) work.
It looks like I would need to refresh something in the Linux system after reconfiguring with duo-pinmux :

[root@milkv-duo]/# duo-pinmux -l
GP0 function:
[ ] UART1_TX
[v] UART2_TX
[ ] GP0
[ ] IIC0_SCL
[ ] WG0_D0
[ ] DBG_10

GP1 function:
[ ] UART1_RX
[v] UART2_RX
[ ] GP1
[ ] IIC0_SDA
[ ] WG0_D1
[ ] WG1_D0
[ ] DBG_11

But ttyS2 still makes I/O error :

[root@milkv-duo]~# stty -F /dev/ttyS2 9600
stty: /dev/ttyS2: I/O error
[root@milkv-duo]~# setserial -a /dev/ttyS2
/dev/ttyS2, Line 2, UART: unknown, Port: 0x0000, IRQ: 0
	Baud_base: 0, close_delay: 50, divisor: 0
	closing_wait: 3000
	Flags: spd_normal

Setserial on ttyS0 in comparison (that one seem to work)

[root@milkv-duo]~# setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x0000, IRQ: 15
	Baud_base: 1562500, close_delay: 50, divisor: 0
	closing_wait: 3000
	Flags: spd_normal

What step am I missing ? What does I need to refresh in this system to make this TTY work ?


Edit cv1800b_milkv_duo_sd.dts and add the relevant entries for the uarts that you need, like uart4.

If you want to make the pinmux settings permanent, edit cvi_board_init.c.

Note that this entails rebuilding the SD image using the supplied SDK.

Thank you so much for your answer, I will try that right now.

That worked to make the serial port accessible.
I connected a Cisco network switch console port to my Duo using a voltage divider as Cisco Serial seem to be 5V. No matter what I always got this kind of output (does not seem to be linked with voltage levels (tired with different resistors) :

[root@milkv-duo]~# python 

--- Available ports:
--- Enter port index or full name: /dev/ttyS4
--- Miniterm on /dev/ttyS4  9600,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
y�V�������ff̙e�2&F..>␖~j�i␙I)���U_�	�e�1��$�M␛f�R�3��]␗^��d�M␗>B6N~ry�2I&M7~2��r��s$�S䤞=5Y=6�����ff̙e�2"F..&␖~j�i␙��e%��X�*J���XQ�Y�sK�$M�>�$��H9B9�␓�$��$�M␛f�R�3��]␗^��d�M␗>B6N~ry�2I&M7~2��r��s$�S�␄␀

I tried

  • GPIO0 & 1 with UART2 (configured myself)
  • GPIO 1&2 with UART4 which is from default image.
  • hex dump the serial interface od -x < /dev/ttyS2

And always got this king of result. Be sure I double-checked with an USB serial adapter on my laptop that everything works find on the other side (baud rates etc…)

My gut says that something is wrong on the way the UART decodes data or the baudrate is wrong even when requested to be lower ?
Any suggestion would be helpful. I will try to sum up my findings in an UART tutorial.
And thank you again @kinsa for your accurate answer.


I’m using mine for RS485 modbus communication. I don’t see any issues but I’m using my own buildroot setup. Take a look here.

Try a proper 3.3v ttl serial adapter. If you have a scope, you can check if you see noise on the TX side.

Hi, thank you for your answer. I bought a hobby scope and here is a picture of the signal I got after my resistor-based voltage divider. Could you confirm that this kind of signal should be ok for the Milkv Duo ?

I also tried to set the Cisco switch to 115 200bauds but still got the weird special characters in my serial session…

It looks like your UART signal from cisco is inverted. When idle, the pin should be high.