SPI TFT Help

Hi all,

I’m attempting to get a 2.8" TFT LCD 2.8 TFT LCD with Cap Touch Breakout Board w/MicroSD Socket [EYESPI Connector] : ID 2090 : $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits working on my PocketBeagle.

Using bb.org-overlays/src/arm/PB-simplegaming.dts at PB-simplegaming · jadonk/bb.org-overlays · GitHub as a reference I made bb.org-overlays/src/arm/PB-SPI1-ADAFRUIT28-TFT.dts at adafruit28 · AnthonyDiGirolamo/bb.org-overlays · GitHub

Then I updated /boot/uEnv.txt with

`
###Custom Cape
dtb_overlay=/lib/firmware/PB-SPI1-ADAFRUIT28-TFT.dtbo

`

and ran:

cd ~/bb.org-overlays
./install.sh

On reboot dmesg shows:

`
[ 37.071131] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[ 37.154982] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
[ 37.217569] fbtft_of_value: buswidth = 8
[ 37.217602] fbtft_of_value: debug = 1
[ 37.217611] fbtft_of_value: rotate = 0
[ 37.217619] fbtft_of_value: fps = 30
[ 37.217942] fb_ili9341 spi1.0: gpio_request_one(‘reset-gpios’=27) failed with -16
[ 37.417422] fb_ili9341: probe of spi1.0 failed with error -16

`

And /dev/fb0 doesn’t exist.

I then tried:

`
sudo rmmod fbtft_device fb_ili9341 fbtft
sudo modprobe fbtft_device name=adafruit28 busnum=1 cs=1 rotate=90 gpios=dc:65,reset:27

`

And dmesg reports:

[ 541.705866] fbtft: module is from the staging directory, the quality is unknown, you have been warned. [ 541.723630] fbtft_device: module is from the staging directory, the quality is unknown, you have been warned. [ 541.726930] spi spi1.0: ili9341 spi1.0 32000kHz 8 bits mode=0x00 [ 541.726961] spidev spi2.0: spidev spi2.0 24000kHz 8 bits mode=0x00 [ 541.726975] spidev spi2.1: spidev spi2.1 24000kHz 8 bits mode=0x00 [ 541.727716] fbtft_device: GPIOS used by 'adafruit28': [ 541.727731] fbtft_device: 'dc' = GPIO65 [ 541.727738] fbtft_device: 'reset' = GPIO27 [ 541.727754] spi spi1.0: ili9341 spi1.0 32000kHz 8 bits mode=0x00 [ 541.727765] spidev spi2.0: spidev spi2.0 24000kHz 8 bits mode=0x00 [ 541.727776] spidev spi2.1: spidev spi2.1 24000kHz 8 bits mode=0x00 [ 541.727787] spi spi1.1: fb_ili9341 spi1.1 32000kHz 8 bits mode=0x00 [ 541.778825] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned. [ 541.796831] fbtft_of_value: buswidth = 8 [ 541.796862] fbtft_of_value: debug = 1 [ 541.796871] fbtft_of_value: rotate = 0 [ 541.796879] fbtft_of_value: fps = 30 [ 541.797216] fb_ili9341 spi1.0: gpio_request_one('reset-gpios'=27) failed with -16 [ 541.820918] fb_ili9341: probe of spi1.0 failed with error -16 [ 541.821383] fb_ili9341 spi1.1: fbtft_request_gpios: gpio_request_one('dc'=65) failed with -16 [ 541.842127] fb_ili9341: probe of spi1.1 failed with error -16

Does anyone know what I’m missing? This page BeagleBone Black · notro/fbtft Wiki · GitHub mentions:

An unfortunate sideeffect is that capemgr also adds a platform device using the same DT node as the spi device:
$ ls -l /sys/devices/ocp.3/481a0000.spi/
total 0
drwxr-xr-x 3 root root 0 Aug 21 19:18 0.lcd@0
This is not a problem for regular spi drivers, but the FBTFT drivers does also support platform devices. This results in the driver probing this device as well. But the probing fails because the gpio has already been requested by the spi device. So, not a functional problem, but rather a cosmetic one with logging of errors in the kernel log that are not actual errors.

But for me there is no /dev/fb0 and I’m not sure what to try next. For reference I’m running:

`
$ uname -a
Linux beaglebone 4.4.110-ti-r142 #1 SMP Mon Jan 8 19:06:43 UTC 2018 armv7l GNU/Linux

`

Thanks very much for any help!

Anthony,
I have been trying to get some similar displays working and struggling with device trees. I did get an I2C SSD1331 display going and a SPI ILI9340. I did notice looking at your situation that the am335x-pocketbeagle-simplegaming.dts has an adafruit18 SPI display defined and it uses the same gpios for dc, reset as your adafruit28 display. The -16 error in dmesg is a “device busy” error code so this could be explained by the adafruit18 display getting the gpios first. Look through the dmesg to see if the adadfruit18 display is getting loaded. Perhaps defining different gpios for your display to eliminate any possible conflicts. I found running “dtc -I fs /sys/firmware/devicetree/base” on the board is useful to see the total device tree after booting.

Mark

Thanks for the tips Mark! I didn’t know about the “dtc -I fs /sys/firmware/devicetree/base” command, very helpful.

It looks like PB-simplegaming.dts is now in upstream bb.org-overlays with some additional fixes. I applied the same changes to my dts file and the screen is now enabled on boot! Here is the working dts:

https://github.com/AnthonyDiGirolamo/bb.org-overlays/blob/adafruit28/src/arm/PB-SPI0-ADAFRUIT28-TFT.dts

I think my original dts attempt was conflicting with cape-universal. The new fixes from jadonk@ disable it and create a new cape-universal with the pins needed for the LCD omitted.

Thanks for the working example Jason and Robert!

Glad you got it working. I was just looking at this and it seems there is a similar issue with the default am335x-pocketbeagle.dts. cape-universal is always enabled, or at least appears to be so from my experiments. The PocketBeagle behavior is different from the other bones.

Mark

I was able to add pwm backlight control. Also added SPI0 and SPI1 versions.

https://github.com/AnthonyDiGirolamo/bb.org-overlays/blob/adafruit28/src/arm/PB-SPI0-ADAFRUIT28-TFT.dts

https://github.com/AnthonyDiGirolamo/bb.org-overlays/blob/adafruit28/src/arm/PB-SPI1-ADAFRUIT28-TFT.dts

Picture or it didn’t happen:

Cape in the pic is this one: https://www.tindie.com/products/microwavemont/oled-with-24-port-usb-hub-cape-for-pocketbeagle/

Hi! how are you?
I am trying to make yort dts SPI0 with an ili9341, I read in your dts compatible:ili9341.
But i have this problem

uboot_overlays: [dtb_overlay=/lib/firmware/PB-SPI0-ADAFRUIT28-TFT.dts] ...
uboot_overlays: loading /lib/firmware/PB-SPI0-ADAFRUIT28-TFT.dts ...
6569 bytes read in 144 ms (43.9 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC

Can you help me ?

Hi! how are you?
I am trying to make yort dts SPI0 with an ili9341, I read in your dts
`compatible`:ili9341.
But i have this problem

```uboot_overlays: [fdt_buffer=0x60000] ...
uboot_overlays: [dtb_overlay=/lib/firmware/PB-SPI0-ADAFRUIT28-TFT.dts] ...

dts = source

dtbo = what you want..

uboot_overlays: loading /lib/firmware/PB-SPI0-ADAFRUIT28-TFT.dts ...
6569 bytes read in 144 ms (43.9 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC

Regards,