Colibri T30 uart Input/output error


I have a problem with comunication over ttyS0 on Colibri T30 board.
This is my test script:
import serial

s = serial.Serial('/dev/ttyS0', 230400)

If I boot the kernel without console=ttyS0… in the cmdline I always get “OSError: [Errno 5] Input/output error” from the test script. After that if I start and stop the serial-getty@ttyS0.service the script no longer throws an exception and everything is working correctly.

What is serial-getty@ttyS0.service doing that makes the serial usable ?
I suspect that the issue is related to the fact that the ttyS0 uart is connected to the xbee module and during bootup u-boot is sending console output to the xbee module which in turn responds with something that is totally not expected by the tty driver.

Newer BSPs always start an explicit serial getty on UART_A (/dev/ttyS0 for Colibri t30) which can be disabled as follows:

# systemctl disable serial-getty@ttyS0.service

Please check this article.