Working SPI Display

Hey, I think I have had the same setup using the adafruit pi tft spi 240x240 1.3" st7789 display. Mine says that it should be able to work, are you using the same exact display? I am using Ubuntu 20.04. THIS IS THE INSTRUCTION SET TO GET THE RASPI TO WORK WITH THE DISPLAY:

cd ~
sudo pip3 install --upgrade adafruit-python-shell click
sudo apt-get install -y git
git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts.git
cd Raspberry-Pi-Installer-Scripts
sudo python3 adafruit-pitft.py --display=st7789_240x240 --rotation=0 --install-type=console

Your work is VERY appreciated along with everyone else working on this as it really helps open up portable use implementations of these SBC’s. Please help me with either a simple “yep” or NOPE to get started if you read this.

this version of lcd st7789 is compatible with this image radxa-zero3_debian_bullseye_xfce_b6.img?

hi @houssemmiled, I was able to make the st7735r lcd work on the radxa zero 3w simply by adding an overlay for it (adapted from rk3568-spi3-m0-cs0-waveshare35.dts) (fbft and drivers for st7735r and st7789v are already in the kernel).

The overlay I used is radxa-zero3-spi3-lcd.zip (797 Bytes)

1 Like

Hi, do you have any idea how could I make this overlay to Rock 3C ?

You need to select the corresponding driver according to your screen display ic and touch ic.
As for overlay dts, you can refer to this overlay script.

1 Like

Hi, thank you for the response.

If I activate this overlay script. But had no succes.

Later, I have downloaded the GIT folder (https://github.com/mrkprdo/radxa-zero-lcd-driver-installer) so I modified the meson-g12a-spi-st7735r file to contain the correct pinout that I am using:

// configure pin assigment below
reset-gpios = <0x30 113 1>; // pin 22
dc-gpios = <0x31 106 0>; // pin 18
led-gpios = <0x31 104 0>; // pin 15

After that, I uploaded it to Rock-3c and then ran:
$ sudo ./build.sh -t st7735r -c

However, it fails at the end when moving the created files:

make[1]: Leaving directory '/usr/src/linux-headers-5.10.160-38-rk356x'
Done building.
Installing dto files and kernel driver 
cp: cannot create regular file '/boot/dtbs/5.10.160-38-rk356x/amlogic/overlay': 
No such file or directory 
FATAL ERROR: Couldn't open "/boot/dtbs/5.10.160-38-rk356x/amlogic/overlay/meson-g12a-spi-st7735r.dts" file or directory.

It fails at this installer step:
then
echo “Installing dto files and kernel driver”
echo “$PASSWORD” | sudo -S cp {fb_$TARGETDRIVER.ko,fbtft.ko} /usr/lib/modules/$KERNELVERSION/kernel/drivers/staging/fbtft/
echo “$PASSWORD” | sudo -S cp …/meson-g12a-spi-$TARGETDRIVER.dts $DTOPATH
echo “$PASSWORD” | sudo -S dtc -@ -I dts -O dtb -o $DTOPATH/meson-g12a-spi-$TARGETDRIVER.dtbo $DTOPATH/meson-g12a-spi-$TARGETDRIVER.dts
fi

I also tried copying the .dts files to directory /boot/dtbo/
$ sudo cp *.dts /boot/dtbo/
And running rsetup 's main interface.
But I have received this message: “can’t compile files”

I dont know what to do.

This is the file I have modifyed meson-g12a-spi-st7735r.dts

Hi, I can’t make it work.
Oh god.

What did I make wrong ?

Have you followed this tutorials ?

1 Like

This script https://github.com/mrkprdo/radxa-zero-lcd-driver-installer may not comptable with ROCK 3C.

  1. The SoC for the ROCK 3C is a Rockchip rk3566, not an amlogic, so DTOPATH is wrong, and the overlay path is /boot/dtbo/ in the ROCK 3C 5.10 kernel.
  2. You need to modify the three pins(reset-gpios/dc-gpios/led-gpios) according to your connection.
1 Like

Yes.

I have tryed to use it with this code with no succes:
sudo dd if=/dev/zero of=/dev/fb0 bs=10k count=1

When I try:
ffmpeg -i cat.jpg -f rawvideo -pix_fmt rgb24 -r 60 -s 160x128 /dev/fb0
convert cat.jpg -depth 8 -colorspace RGB -format raw - | sudo dd of=/dev/fb0

Both don’t work.
rock@rock-3c:~/scripts$ convert cat.jpg -depth 8 -colorspace RGB -format raw - | sudo dd of=/dev/fb0
[sudo] password for rock:
51+1 records in
51+1 records out
26435 bytes (26 kB, 26 KiB) copied, 0.000352335 s, 75.0 MB/s

How do I send images to /dev/fb0 ???

Did the driver load successfully? Please check that with cmd “sudo dmesg | grep spi3”.

1 Like

Yes:
~$ sudo dmesg | grep spi3
[sudo] password for rock:
[ 15.961576] fb_st7735r spi3.0: fbtft_property_value: width = 128
[ 15.961589] fb_st7735r spi3.0: fbtft_property_value: height = 160
[ 15.961595] fb_st7735r spi3.0: fbtft_property_value: regwidth = 16
[ 15.961601] fb_st7735r spi3.0: fbtft_property_value: buswidth = 8
[ 15.961608] fb_st7735r spi3.0: fbtft_property_value: debug = 0
[ 15.961613] fb_st7735r spi3.0: fbtft_property_value: rotate = 90
[ 15.961619] fb_st7735r spi3.0: fbtft_property_value: fps = 60
[ 15.961624] fb_st7735r spi3.0: fbtft_property_value: txbuflen = 32768
[ 17.076199] graphics fb0: fb_st7735r frame buffer, 160x128, 40 KiB video memory, 32 KiB buffer memory, fps=60, spi3.0 at 4 MHz

How do I proceed now?

  1. Backup /etc/X11/xorg.conf.d/20-modesetting.conf
  2. Clear the existing content and add the following
Section "Device"
     Identifier  "Rockchip Graphics"
     Driver      "fbdev"
     Option      "fbdev"          "/dev/fb0"
     Option      "DRI"            "2"
EndSection
  1. Reset your system, then you can boot up from spi lcd.
1 Like

Hi.
I did this but the screen is always blank.

I read another post about Rock3C it says that I cant use the same PIN for CS0:
“it appears on the Rock 3C, at least with my version, enabling SPI locks the user from changing the pin state, so the display didn’t know when it was receiving commands or data (always thought it was data), meaning that it wasn’t initializing correctly.”
Post About SPI in Rock3C

I have a ST7789 also.
But bombusT didn’t tell where to put the pins.
What if we try to use ST7789? Could you please check over BombusT post and see if you can find wich pins did he use?
It seems that he only activated the original SPI overlay and did the rest in python coding.
He used:
import numbers
import time
import numpy as np
import spidev
import gpiod

And the example was:

# Example usage:

if _ name _ == “_ main _”:
# Specify the SPI port, CS, DC, and other parameters
port = 3
cs = 0
dc = 10 # Set this to whatever pin you want to connect (you cannot use pin 21 on the Rock 3C)
backlight = 19 # This is the same pin location as on the R pi, but do whatever you want.
rst = None
rotation=180
width = 320
height = 240
spi_speed_hz=60 * 1000 * 1000