The following devices are based off of the XR17V35X and are known to be impacted by the GPIO configuration issue described in this article:
- 7xxxEC serial cards
- Relio R1
This article does not apply to the following kernel versions:
- 5.8.x and higher
- 5.7.9 and higher
- 5.4.54 and higher (excluding 5.5 – 5.6)
- 4.19.135 and higher (excluding 4.20 – 5.3)
- 4.14.190 and higher (excluding 4.15 – 4.18)
- 3.7.0-rc6 – 4.10.x
Linux supports direct use of XR17V35X UART based serial devices with the drivers included in the kernel. However, kernel version 4.11 includes a change to the GPIO configuration of the UART that renders Sealevel XR17V35X based devices inoperable. This issue was patched in kernel version 5.8 and this patch was also backported to the kernel versions 4.14.x – 5.7.x listed above.
Option 1: Configure the GPIO through the gpioset utility
- Install the libgpiod utility (https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/).
- It may be available as a package in your distribution. If not, it must be compiled manually using the build procedure outlined in the link above.
- After the utility is installed, run the following commands:
gpioset gpiochip0 12=0
gpioset gpiochip0 13=0
gpioset gpiochip0 14=0
gpioset gpiochip0 15=0
- Your Sealevel asynchronous serial card should now be functional. Please note that you will need to run the commands in step 2 on every boot. You might consider automating this using common Linux utilities like cron, service files, etc
Option 2: Apply a patch to your kernel module/driver and load the patched kernel module
For convenience, an example auto-patching script has been created to assist with compiling the kernel module. It can be downloaded from here. For more information on how to use the script and how to perform the steps manually please see the readme.txt file in the download.
- This script may need slight modifications to work with the kernel version you have. It has been tested on kernel versions 4.11.0, 4.12.0, 4.13.0, 4.15.0, and 5.3.0 in Linux Mint.
- Always examine the source code before applying a patched driver to your system.
Verify functionality of the serial device
You can verify the GPIO configuration is correct and that the card is working by using a loopback adapter and following the steps below.
1) Get the current ttyS for the serial card by running
sudo cat /proc/tty/driver/serial
- The ports on the card should identify as “uart:XR17V35X”
sudo stty -F /dev/ttyS* raw -echo -onlcr on each port, where
* is the number provided by the command in the previous step. This will clean up the output we see later but isn’t required for the card to function.
sudo cat /dev/ttyS* where
* is the number we have been using. We are now listening for data on this port.
4) Open up another terminal. On this terminal, enter the command
sudo echo 'hello' > /dev/ttyS* where
* is the same number used in step 3.
5) You should see
hello printed in the terminal window from step 3.