Raspberry Limitation & How To Solve

The Raspberry present some challenges when comes to UART and Serial connections. In the specific:

The mini UART is a secondary low throughput UART intended to be used as a console. The mini Uart has the following features:

  • 7 or 8 bit operation.

  • 1 start and 1 stop bit.

  • No parities.

  • Break generation.

  • 8 symbols deep FIFOs for receive and transmit.

  • SW controlled RTS, SW readable CTS.

  • Auto flow control with programmable FIFO level.

  • 16550 like registers.

  • Baudrate derived from system clock.

As per SAS documentation, for the connection, you need:

19.2 KBaud in a “wakeup” mode. The 11-bit data packet consists of one start bit, eight data bits, a ninth ‘wakeup’ bit, and one stop bit.

As you can see, you will never be able to connect successfully to a machine using ONLY the Raspberry. Here how to solve this pickle.

Solution 1

Use an RS-232 to TTL logic level converter. We tested the MAX3323

In case you decide to buy and use the MAX3323 remember to: 1) Update your machine:

user@host $ sudo apt-get update
user@host $ sudo apt-get dist-upgrade
user@host $ sudo apt-get clean
  1. Enable UART in config and disable bluetooth

user@host $ echo "enable_uart=1" >> /boot/firmware/config.txt
user@host $ echo "dtoverlay=disable-bt" >> /boot/firmware/config.txt
  1. Disable getty (serial agent for console login)

user@host $ sudo systemctl disable serial-getty@ttyS0.service
  1. Ensure console is not set in cmdline.txt

user@host $ sudo nano /boot/firmware/cmdline.txt # Remove "console=serial0,115200" from text if applicable
  1. Reboot for changes to take effect

user@host $ sudo reboot
  1. Configure serial connection to “serial0” port in config.yml (If you are using the default tx and rx pins on pi (8,10))

connection:
  serial_port: /dev/serial0

Solution 2

Buy and use an USB to serial adapter, we tested this one from Prolific and works like a charm and nothing has to be done on raspberry.