AML-S905X-CC (Le Potato) 480x320 ILI9486 3.5" 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
  4. Velleman VMP400 (Rebrand MPI3501)

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.

To get it working:

  1. Move the 2J1 jumper to the pin closest to the edge of the board to enable pin 11 on the GPIO header.
  2. sudo ldto enable spicc-cs1
  3. sudo ldto enable spicc-cs1-ili9486-xpt2046

If the ldto command cannot be found, install the libretech-wiring-tool. Our new images already include this so you can skip if you are using a recent image.

To apply permanently on every boot.

  1. sudo ldto merge spicc-cs1
  2. sudo ldto merge spicc-cs1-ili9486-xpt2046

To remove:

  1. sudo ldto reset
  2. sudo reboot

If you do not reboot after reset, you will not get the correct results if you merge again.

ili9486-xpt2046 is the generic overlay. We have pre-tuned the touchscreen for
mhs3528 and mpi3501 displays. To use the pre-tuned overlays, replace ili9486-xpt2046 from the instructions above with the name of the display.

If you are using X11 or Raspbian Desktop, you need to create the file /usr/share/X11/xorg.conf.d/10-ili9486.conf if it does not exist already with the following contents:

Section "OutputClass"
	Identifier	"ILI9486"
	MatchDriver	"ili9486"
	Driver		"modesetting"
	Option		"PrimaryGPU" "true"
EndSection

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.

We had solved various software related issues and this display should work without issue now following the instructions above.

Updated my OS to current patch level and re-tried all three displays I tested previously, and now all three appear to have correct color and show no artifacts or glitches. They look great.

Did not have time to test touch functions or dig through logs to see if there were any changes there.

Solid improvement overall – nice work.

1 Like

For the touch controller, make sure you move the jumper on the edge of the board. If you don’t, it won’t work because that is the interrupt pin.

Good callout. Confirmed mine was properly set, and was able to verify touch works on all 3 screens as well.

For others’ reference: there’s a diagram on the header spreadsheet provided by Libre Computer:
AML-S905X-CC-V1.0A Headers

On Le Potato, there are two 3-pin headers between the HDMI jack and the micro-USB power jack. The one closer to the HDMI port is the UART (serial) connector (mine has a box around the pins, and labeled GND-TX-RX), and the one closest to the micro-USB power jack is the CEC/GPIO11 selection jumper pins…

As noted, setting the jumper across the two pins closest to the edge of the board selects GPIO11 interrupts, and setting the jumper across the two pins closest to the interior of the board selects CEC (Consumer Electronic Control commands over HDMI). The GPIO-connected screens need GPIO11 interrupts selected, so jumper the two pins closest to the edge.

I think I got all that right, but correct me if I’m wrong.

1 Like

The one closer to the HDMI port is the UART (serial) connector

Correct

the one closest to the micro-USB power jack is the CEC/GPIO11 selection jumper pins

Correct

As noted, setting the jumper across the two pins closest to the edge of the board selects GPIO11 interrupts

Correct

setting the jumper across the two pins closest to the interior of the board selects CEC (Consumer Electronic Control commands over HDMI)

Correct

The GPIO-connected screens need GPIO11 interrupts selected, so jumper the two pins closest to the edge.

Correct

yo will this work with a 3.5inch rpi display? this is the wiki page for it: 3.5inch RPi Display - LCD wiki

Yes: MPI3501 is the screen name.

i need a tutorial of how to use this: libretech-wiring-tool/spicc-cs1-mpi3501.dts at master · libre-computer-project/libretech-wiring-tool · GitHub also do i need it to make it work?

Read the OP and follow those instructions.

wheres the op? idek how to use that code

Read the post at the top and follow the instructions.

How would I get a 320x240 2.8" TFT resistive touch screen working on Le Potato?

It’s got an STMPE610 resistive touch screen controller and uses IL19341 2.8" screen. I have this one one specifically.

Continuing from the last post since I (new user) can’t post more than two links per post :frowning:

I tried moving the 2J1 jumper as described above and installing driver with the instructions from Adafruit easy install. It didn’t work and I ended up with just an illuminated white screen on boot. I suspect that it’s because the GPIO layout on Le Potato is different than the Raspberry Pi?

I also tried just using the ldto commands listed in the instructions above but that obviously didn’t work because the touch controller and screen are totally different. I need to research what those commands are doing.

I’m using the 2022-09-22-raspbian-bullseye-arm64+aml-s905x-cc.img Raspbian image which has kernel 6.0.12.

Any hints as to what I should try next would be much appreciated, love my Le Potato so far.

There is already an overlay for this display. You need to copy the overlay and add the touch screen node and driver compatible and any interrupt pins.

Hello, i got my display working but it is only showing the boot log and not the raspbian desktop. The touch work perfectly. So how could i make the desktop display on the spi display rather than on the HDMI?

Hello, I did all the steps on the ubuntu image and all worked fine no problem, but when I try on the raspbian image, specificly the “2022-09-22-raspbian-bullseye-arm64+aml-s905x-cc.img.xz” image, when I do the steps the screen changes from white to black but it does not do anything else, only keeps black, and so far I have not found any way to select the display manually using the GUI.

This is a known issue with the default X11 config and we are working on it. Hopefully have it fixed by the end of the week.

2 Likes