AML-S905X-CC 480x320 ILI9486 SPI Touchscreen Display

ILI9486 is the chip powering most 3.5" SPI displays targeted for Raspberry Pi and features a 480x320 resolution. The touch controller is based on XPT2046 chip.

Some common names for compatible displays are:

  1. MHS3528
  2. MPI3501
  3. Waveshare 3.5’ RPi LCD A

The upstream Linux driver was fixed by one our consultancy BayLibre on 2022-11-28 and that software work should appear in Linux 6.3. You will need to use our kernel with at least version 6.0.10-00437 or higher.

  1. Install the libretech-wiring-tool if sudo ldto command does not exist. Our new images already include this so you can skip if you are using a recent image.
  2. sudo ldto enable spicc-cs1
  3. sudo ldto enable spicc-cs1-ili9486-xpt2046

To apply permanently on every boot.

  1. sudo ldto merge spicc-cs1
  2. sudo ldto merge spicc-cs1-ili9486-xpt2046
  3. echo "blacklist meson_drm" | sudo tee /etc/modprobe.d/blacklist-meson-drm.conf
  4. sudo depmod -ae
  5. sudo update-initramfs -u

To remove:

  1. sudo ldto reset
  2. sudo rm /etc/modprobe.d/blacklist-meson-drm.conf
  3. sudo depmod -ae
  4. sudo update-initramfs -u

ili9486-xpt2046 is the generic overlay.
mhs3528 and mpi3501 are tuned for those specific displays.

Can confirm these instructions work with a Waveshare 3.5 inch SPI touchscreen: 3.5inch RPi LCD (A) - Waveshare Wiki – bought on Amazon, described as “Waveshare 3.5inch Resistive Touch Control Screen TFT LCD Compatible with Raspberry Pi 4B/3B+/3B/2B/B+/A+/Zero/Zero W/WH/Zero 2W Series Boards 480x320 Resolution SPI”

Specs and pinout details available on those product pages.

Using a 2GB AML-S905X-CC “Le Potato”, running ubuntu-22.04.1-preinstalled-desktop-arm64+aml-s905x-cc.img from the Libre Computing repository. Fully updated and patched. I’m accessing the system a few different ways (SSH, Remote Desktop Connection, direct with keyboard/mouse/HDMI display, and now with SPI touchscreen), for convenience and testing purposes. To add some procedural detail to the above instructions:

[power off, plug the screen into the GPIO header, boot the system]
sudo apt install libretech-gpio libretech-dtoverlay # was already installed/latest version
sudo ldto reset # to ensure no conflicting merged overlays installed
sudo reboot # to ensure all overlays cleared and starting clean
sudo ldto enable spicc-cs1 # to test-enable spi overlay
sudo ldto enable spicc-cs1-ili9486-xpt2046 # to test-enable basic LCD and touchscreen overlay
dmesg # check log to see if screen was detected

Your logs may differ, but as an example (most of the warnings have no negative impact – the key is the screen is identified and enumerated):

[Fri Nov 18 23:50:37 2022] [drm] Initialized ili9486 1.0.0 20200118 for spi0.0 on minor 1
[Fri Nov 18 23:50:37 2022] checking generic (7f807000 7e9000) vs hw (0 0)
[Fri Nov 18 23:50:37 2022] meson_vdec: module is from the staging directory, the quality is unknown, you have been warned.
[Fri Nov 18 23:50:37 2022] SPI driver ads7846 has no spi_device_id for ti,tsc2046
[Fri Nov 18 23:50:37 2022] SPI driver ads7846 has no spi_device_id for ti,ads7843
[Fri Nov 18 23:50:37 2022] SPI driver ads7846 has no spi_device_id for ti,ads7845
[Fri Nov 18 23:50:37 2022] SPI driver ads7846 has no spi_device_id for ti,ads7873
[Fri Nov 18 23:50:37 2022] ads7846 spi0.1: Looking up vcc-supply from device tree
[Fri Nov 18 23:50:37 2022] ads7846 spi0.1: Looking up vcc-supply property in node /soc/bus@c1100000/spi@8d80/touchscreen@1 failed
[Fri Nov 18 23:50:37 2022] ads7846 spi0.1: supply vcc not found, using dummy regulator
[Fri Nov 18 23:50:37 2022] ili9486 spi0.0: [drm] fb1: ili9486drmfb frame buffer device
[Fri Nov 18 23:50:37 2022] ads7846 spi0.1: touchscreen, irq 36
[Fri Nov 18 23:50:37 2022] input: ADS7846 Touchscreen as /devices/platform/soc/c1100000.bus/c1108d80.spi/spi_master/spi0/spi0.1/input/input1

ls /dev # per the log, fb1 was the new device, and confirmed in /dev
sudo ldto merge spicc-cs1 # the test-enable worked, so merge it into boot
sudo ldto merge spicc-cs1-ili9486-xpt2046 # merge this into boot, too
sudo reboot # to verify the merge worked and it loads on boot
dmesg # verify detected with log entries similar to above

At this point I was able to use the Display Settings control panel in my windowing environment to enable and configure the LCD touchscreen. I did some quick tests and was able to run it as the only display, as a secondary display/extension to the primary display, and disabled. In general, it behaved normally. There were some vertical line pattern artifacts and minor color discrepancies but the display was usable and touch appeared to work. I haven’t done in-depth testing or tried the “tuned” mhs3528 or mpi3501 overlays to see if they improve anything. I’ve also been testing with this system for a week, so it’s not a pure/pristine OS, but I think this is repeatable.

Quick-and-dirty tests on 2 additional 3.5-inch SPI LCDs of similar design and specs to the Waveshare. No changes to overlays, just direct swaps after powering down to see if they would work at all:

MHS-3.5 inch display from one of the cheaper black “Raspberry Pi 3 case with touch screen” combos on Amazon: Inverted (upside-down) display compared to Waveshare. Colors appear to be correct and shows no vertical line artifacts – looks crisp and great. Downside is touch not working, with additional errors in dmesg.

Generic LCD labeled “3.5 inch RPi Display” – of unknown manufacturer and origin, probably an MPI3501 – but same basic specs as the 2 others. Inverted compared to Waveshare. Color distortion and vertical line artifacts similar to Waveshare. Touch not working, with additional errors in dmesg.

Both can be controlled with Display Properties.

I probably won’t do any deeper testing with these displays – just wanted to share the encouraging results so others can carry it further. I suspect using the tuned overlays, or playing with the various frequencies and settings within the overlays, could improve the behavior.

This is not as reliable as we like yet. We’re still in the process of fixing all of the problems and should have a reliable solution soon.