0

I have a Respeaker Core v2.0 and I would like to use the UART interface (this board has a USB to TTL adapter connected to the Uart port) in order to make this board communicate with another one.

SETUP [ EDITED ]

I have plugged a serial to TTL converter to laptop and connected it to the TX, RX and GND pins of the RespeakerCore. I then opened a miniterm console (with the right baudrate and port settings) on my laptop and another one on the Respeaker. I powered on the Respeaker and the following appears on miniterm:

Starting kernel ...

[    0.065704] /cpus/cpu@f00 missing clock-frequency property
[    0.071689] /cpus/cpu@f01 missing clock-frequency property
[    0.077712] /cpus/cpu@f02 missing clock-frequency property
[    0.083677] /cpus/cpu@f03 missing clock-frequency property
[    0.829278] rk-vcodec 20020000.vpu-service: could not find power_model node
[    0.856875] rockchip-vop 20050000.vop: invalid resource
[    0.862758] rockchip-vop 20050000.vop: invalid resource
[    0.868586] rockchip-vop 20050000.vop: missing rockchip,grf property
[    0.876380] i2c i2c-0: of_i2c: modalias failure on /hdmi@200a0000/ports
[    2.037851] cpu cpu0: Failed to get pvtm
[    2.122396] rockchip-dmc dmc: Failed to get pvtm
[    2.128437] rockchip-dmc dmc: failed to get vop bandwidth to dmc rate
[    2.139954] rknandbase v1.2 2018-05-08
[    2.612237] rk_gmac-dwmac 30200000.ethernet: Can not read property: tx_delay.
[    2.620241] rk_gmac-dwmac 30200000.ethernet: set tx_delay to 0x30
[    2.627017] rk_gmac-dwmac 30200000.ethernet: Can not read property: rx_delay.
[    2.635007] rk_gmac-dwmac 30200000.ethernet: set rx_delay to 0x10
[    2.642046] rk_gmac-dwmac 30200000.ethernet: cannot get clock clk_mac_speed
[    5.638765] get ac108 regulator name failed 
[    5.749516] get ac108 regulator name failed 
[    5.760861] mali-utgard 20001000.gpu: Failed to get pvtm
[    5.938710] devfreq 20001000.gpu: Couldn't update frequency transition information.
[    6.153327] ac108_write error->[REG-0x00,val-0x12]
[    6.175033] ac108_write error->[REG-0x00,val-0x12]
[    9.971169] rk_gmac-dwmac 30200000.ethernet: rk_get_eth_addr: mac address: 72:1c:0a:8e:4a:4a

Debian GNU/Linux 9 glutamate ttyS2

respeaker.io Debian Image 20180801

Support/FAQ: http://respeaker.io

glutamate login:

The TX and RX pins are used as serial console.

userk@glutamate:~$ setserial -g /dev/ttyS[0123]
/dev/ttyS0, UART: 16550A, Port: 0x0000, IRQ: 29
/dev/ttyS1, UART: 16550A, Port: 0x0000, IRQ: 30
/dev/ttyS2, UART: 16550A, Port: 0x0000, IRQ: 31
/dev/ttyS3, UART: unknown, Port: 0x0000, IRQ: 0

And there is one service that is using the ttyS2 device I am interested about.

userk@glutamate:~$ sudo systemctl status | grep tty
           │ ├─system-serial\x2dgetty.slice
           │ │ ├─serial-getty@ttyS2.service
           │ │ │ └─721 /sbin/agetty --keep-baud 115200,38400,9600 ttyS2 vt220
           │ │ └─serial-getty@ttyGS0.service
           │ │   └─747 /sbin/agetty --keep-baud 115200,38400,9600 ttyGS0 vt220
           │ │ └─767 brcm_patchram_plus --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/bcm43438a0.hcd /dev/ttyS1
           │ ├─system-getty.slice
           │ │ └─getty@tty1.service
           │ │   └─720 /sbin/agetty --noclear tty1 linux
               │ ├─1050 grep tty

What I have tried

I tried to stop the service with the following command:

sudo systemctl stop serial-getty@ttyS2.service

but after 5 seconds it automatically restarts.

The problem

After a short period of time the system starts sending the console output again to the ttyS2 port.

Is it possible to completely remove the serial console linked to ttyS2?

Solution

Just Stop and disable the service:

sudo systemctl stop serial-getty@ttyS2.service
sudo systemctl disable serial-getty@ttyS2.service

and the communication works in both directions.

1

You are looking in the wrong place.

The fundamental configuration item that drives this is the console setting that one gives on the command line to the kernel via the boot loader. It's that that tells the generator what serial console services to start. It is that that tells the kernel where to send kernel console output. It is that that tells the kernel where to send /dev/console output. If you do not want your serial device to be a console, it is that that you need to adjust.

However, notice that you do not have a serial-getty@ttyS2.service service. You have a getty@ttyS2.service service and a serial-getty@ttyGS0.service service. So the system thinks that ttyGS0 is your serial console device, and apparently already does not think that ttyS2 is.

You probably made getty@ttyS2.service by hand at some point. It is not something that systemd makes as standard; because it is incorrect. The getty@.service template is not suitable for serial devices, and is designed for kernel virtual terminal devices. Note that the correct template, serial-getty@.service, has been instantiated against the other device that the system does think to be your console.

So disable getty@ttyS2.service.

Further reading

  • Super useful readings! Thanks JdeBp I disabled the correct service and it seems to work. I will try on monday again and check that everything is working fine. I will then accept your answer – UserK Oct 12 '18 at 16:18
  • You were right, I wrote this question after a couple of attempts to fix the problem. After a reboot, the output of the 'sudo systemctl status | grep tty' changes. When I disable the service that handles the ttyS2 port, the serial connection works. The problem is that this situation is temporary and after a period of time the console is reassigned to ttyS2 port automatically. I will add a EDIT section to the question – UserK Oct 23 '18 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.