Second serial port


Hello everyone,

I would like to have a second serial port (UART) to access a small radio transceiver independently of the console access. Is there an easy way to do that? It would be OK if I have to design an extension board with a UART chip since I need a board with a socket for the radio anyway.

If that is not possible, I would like to be able to kill all kernel console messages that may be sent through the UART1, possibly via script after the CHIP has booted (I do not want to lose the serial console access totally) so that the app (that I am writing, that will be running on CHIP) can use the UART to talk to the radio without interference.


As I am curious as to the use of the CHIP’s UART for the purposes of MIDI, I believe that there is a usable UART1 on board that can be configured as you need it … though I don’t know about max baud rate, etc.

That said, its fairly trivial to disable console messages on UART0 and turn it into a utility port.

Another option you might consider, which is nevertheless mighty easy/useful, is simply to get an USB->Serial(FTDI) cable, which has other uses besides, to boot …


I only see UART1 pinned on the header, that is the one the console is connected to.
Where is UART0 connected?


I do not want to completely lose the console port though, just in case I needed to get back into the machine. A second, independent serial port would be best.


This is a little confusing. The CHIP already has two “serial” ports. One is the original UART on the connector pins. It is only vital during booting. After booting you can use it as you wish by disabling the console.

The other is a serial gadget connected by the microusb connector. It is only not-usable during booting. You can always connect to a running CHIP through this one. If you need a third port, use a usb/serial dongle.

I think one of @JKW s add-on boards (salsa? queso?) has an atmega where I think it is possible to use it as a pass-through uart.

You can also connect via the network using ssh.

Regards, Steve


OK that sounds good, but how do I get to the serial port on the USB connector (I assume it is a virtual COM port of some sort)? I have not installed any particular driver, this computer has a fairly fresh Win 7 installation and only the Prolific driver for the USB-TTL adapter I am using with UART1. The computer does not prompt me for any driver when I plug the CHIP into the USB port.
How do I activate or connect to the Virtual COM port? What driver do I need?


Per this and the R8 datasheet, there is a way to mux out 2 of the CSI pins to be another set of uart lines. Will probably have to wait until the 4.4 kernel with DTS overlay plugin support to get to them.


Unfortunately, the SoC used on the CHIP only has two UARTs: UART1 and UART3 (don’t ask why).

UART3 is used to communicate with the BT chip, and is not available on the headers. UART1 is the one we have the kernel console on and that you already found. So, theŕe’s basically no other option.

If you’re fine disabling the kernel logs, you should be able to do that by writing 0 in /proc/sys/kernel/printk


Ok, that makes sense and it sucks a little bit.

Looks like I am going to make an I2C-serial bridge with a small 8 bit micro and talk to it that way. The particular protocol I use with the radios is not very Linux friendly anyway, so I can use the 8 bit chip to do some of the low level stuff that is easier done on such a chip anyhow.

And then when kernel 4.4 comes out, there may be other options.



@mripard is working the kernel updates, so whatever he says trumps my knowledge. :slight_smile:


Thanks for the howto disable console messages. Saves me the time to look it up :slight_smile:


OK, I need more info. This seems to contradict what mripard says below, and there is no evidence that the microUSB jack on the CHIP is actually connected to anything other than the supply rail.
Can you explain to me how to connect to the “serial gadget”?
And if I can connect to it, is it a different UART than UART1 that is available on the headers?
PS: it seems like you may be refering to using a USB-Serial adapter plugged in the large USB connector on the PWB, not the microUSB connector. That is not the solution I need as I do not want to use the large USB connector to access the radio, I want to keep it open for a storage device.


The big question is…is it possible to run a “dumb” arduino (mini) to extend the GPIOs and bypass that “problem”? Maybe with the “big” USB connector? It would be great, if we can use UART and add a SD Card, GPS, yaddayaddayadda. Do we know exactly what pins are present on the top of the PocketChip?


No contradiction. mripard is talking about built-in old-fashioned uart ports. Of which there seems to be only one.

I was talking about the microUSB jack on the CHIP.

  1. make sure you have an actual data microusb cable, not one of those cables only for charging.

  2. Make sure the CHIP doesn’t need reflashing, but watching what comes out on the uart port during the full boot will tell you. If you can login via putty or something after the boot, the CHIP is probably ok.

  3. Do the windows dance about new hardware. It should pop up something about a new device found after you plug in the usb cable. Keep doing windows things until it is happy about the driver. Ask someone else here, or look for very early CHIP instructions about installing the serial driver.

At this point you will have a (on windows) a COMx port that is the serial port for the microusb adapter on the CHIP. So do some windows terminal thing, most people use Putty, I think, to connect and you should be able to login etc via the usb cable.

Really, find the windows instructions either on this BBS or at and you will find your new host com port talking to linux on the CHIP.

Regards, Steve


OK, the cable I was using was apparently a charging only cable (did not know I actually had one of those), I switched cables and Control Panel shows a “Gadget Serial v2.4” device. Found the reference to tell Windows what to do with it and it is now working, great!
Thanks a lot Steve!


the serial gadget is very similar to a usb-serial adapter that is plugged in the large usb connector except it is all software. when you have serial gadget enabled your chip looks like a usb device to your host computer (desktop, laptop, etc.) and that device is a usb-serial adapter. if that software usb device is a usb hub then there can be more than one software usb device. i have usb serial and usb ethernet on my virtual (software) usb device that my chip creates for my desktop.


"the serial gadget is very similar to a usb-serial adapter…"
OK, thanks. So that explains that it does not take away one of the hardware port and that it only works once the chip has booted.


Where do you have the information from?
“R8 Datasheet V1.2”, page 8 tells there are 4 UARTs. In the “PIN CHARACTERISTICS” description starting at page 10 there are 4 UARTs listed named UART0…UART3. Same applies to the “GPIO MULTIPLEXING FUNCTIONS” chapter starting at page 18. So there should be 4 UARTs.
Same thing when looking inside the “R8 User Manual V1.1”. But inside this manual there are some strange things:

  • APB1 Module Clock Gating (page 68) is given for UART1 and UART3 only
  • Interrupt vector (page 103) is given for UART1 and UART3 only
  • DMA configuration is given for UART1 and UART3 only
  • “UART Register List” (page 162) tells that there are 4 UARTs.

I think UART won’t work without APB clock, interrupt and DMA. So there must be a bug in the documents. 2 possibilities:

  • APB, interrupt and DMA configuration description for UART0 and UART2 missing in the documents
  • UART0 and UART2 not available and documents erratically describing 4 UARTS

So what is the truth?
What documents do you use, which revision?

Thanks for answers.


Also looking to use a serial port other than the UART on pin 3-5 used for console.

From the pinout, there is another UART on pins 37-38 of the U14

when running

[    0.000000] console [tty0] enabled
[    2.120000] 1c28400.serial: ttyS0 at MMIO 0x1c28400 (irq = 27, base_baud = 1500000) is a U6_16550A
[    2.890000] console [ttyS0] enabled
[    2.920000] 1c28c00.serial: ttyS1 at MMIO 0x1c28c00 (irq = 28, base_baud = 1500000) is a U6_16550A
[   10.350000] systemd[1]: Expecting device dev-ttyS0.device...
[   10.380000] systemd[1]: Expecting device dev-ttyGS0.device...
[   10.870000] systemd[1]: Starting system-getty.slice.
[   10.900000] systemd[1]: Created slice system-getty.slice.
[   10.900000] systemd[1]: Starting system-serial\x2dgetty.slice.
[   10.930000] systemd[1]: Created slice system-serial\x2dgetty.slice.``` 

I also see the 2 UARTs with

```chip@chip:~$ sudo cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:U6_16550A mmio:0x01C28400 irq:27 tx:6724 rx:0 CTS|DSR|CD|RI
1: uart:U6_16550A mmio:0x01C28C00 irq:28 tx:764 rx:34 RTS|CTS|DTR
2: uart:unknown port:00000000 irq:0
3: uart:unknown port:00000000 irq:0
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0```

they match the IRQa 27 / 28 shown with `dmesg` corresponding to `ttyS0` and `ttyS1`

it shows `ttyS0` and `ttyS1` enabled as UARTs, but I could only talk to a device with `ttyS0`, after disabling getty with
`systemctl stop serial-getty@ttyS0`

Following the same procedure with ttyS1, no luck.
I set the port to the same exact params, same device, same connection, but I was not able to talk via ttyS1

Would appreciate input on how to get this going.



Ok I change the device tree to include the uart2.

The GPIO pins doesn’t change but /dev/ttyS2 works!

> chip@chip3:~$ sudo cat /proc/tty/driver/serial
> [sudo] password for chip: 
> serinfo:1.0 driver revision:
> 0: uart:U6_16550A mmio:0x01C28400 irq:28 tx:7935 rx:0 RTS|CTS|DTR|DSR|CD|RI
> 1: uart:U6_16550A mmio:0x01C28C00 irq:30 tx:27639 rx:3502 RTS|CTS|DTR
> 2: uart:U6_16550A mmio:0x01C28800 irq:29 tx:121 rx:1 brk:1 RTS|CTS|DTR
> 3: uart:unknown port:00000000 irq:0
> chip@chip3:~$ echo "allo" >/dev/ttyS2
> chip@chip3:~$ sudo cat /proc/tty/driver/serial
> serinfo:1.0 driver revision:
> 0: uart:U6_16550A mmio:0x01C28400 irq:28 tx:7935 rx:0 RTS|CTS|DTR|DSR|CD|RI
> 1: uart:U6_16550A mmio:0x01C28C00 irq:30 tx:27639 rx:3502 RTS|CTS|DTR
> 2: uart:U6_16550A mmio:0x01C28800 irq:29 tx:126 rx:2 brk:2 RTS|CTS|DTR
> 3: uart:unknown port:00000000 irq:0
> chip@chip3:~$ 

Writing “allo” add 5 bytes in the tx counter.

Only thing I need to figure is how to change the GPIO mode to get the uart2 pin on PD2 and PD3.(According to the manual).

Maybe a way to disable RTS, CTS and DTR