I have strong reserves against libmraa because I had erroneous display with the same Waveshare LCD on a RPi4, whereas both RPi.GPIO and libgpiod succeeded (same hardware, same pin assignment). Would you say libmraa has capabilities the two others don’t ?
Working SPI Display
@mrkprdo In the end I followed your advice and succeeded in piloting my display using libmraa. I’m running Arch Linux and found a working mraa PKGBUILD for Radxa boards on the AUR. I’ll still try to port my script to libgpiod because it feels better integrated in Arch systems ; that will be another story.
As you mentioned, there is no need to compile a specific DT overlay to get SPI display support. I can witness SPI_A works fine using the default overlay. It’s just that the display’s connection instructions I had (written for a RaspberryPi) need to be adapted - specifically, the instructions I had said to use physical pin 22, but this pin is an open drain on the Radxa Zero, which makes it unsuited for input/output as is (followers, see Radxa Zero GPIO specifics).
In the end, what’s unclear to me is when are your LCD driver or SPI display instructions needed - or what benefit they would bring over using the default overlay together with hardware-specific libraries. As @SCIFI.radio mentioned, there would be a need for newcomers’ documentation on this subject. I hope that my questions will help us understanding what happens in a newcomer’s head
Anyway thank you very much for pointing me in the right direction !
That’s good to hear you have made it to work.
The SPI display instructions i made is to compile dto with fbtft kernel driver and use the display as framebuffer. End goal is to make these displays as monitor like this.. But unfortunately radxa zero spi is quite slow.
I just debug the st7789vw lcd on my radxa zero,It’s running ok,but there is some issues should be avoided:
- the reset pin on ZERO should be careful of these open drain pins
- It seems difficult to compute or look for the phandler value of the first gpio group,if
U want use these pins as dc or res pins for tft lcds.
3.the ko file should be compiled on you host machine,or the magic problem of linux driver would bother you all times
Hi,
I have a Rock 3c and would like to connect a 2,2" QVGA TFT LCD Display, ILI9341 Driver with SPI.(https://www.elektor.de/2-2-spi-tft-display-module-ili9341-240x320 )
Your guide looks very promising. Did you test it on other Rock’s. What ist the correct configuration of the dto file for ILI9341
Thx
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)
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.
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 ?
This script https://github.com/mrkprdo/radxa-zero-lcd-driver-installer may not comptable with ROCK 3C.
- 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.
- You need to modify the three pins(reset-gpios/dc-gpios/led-gpios) according to your connection.
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”.
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?
- Backup /etc/X11/xorg.conf.d/20-modesetting.conf
- Clear the existing content and add the following
Section "Device"
Identifier "Rockchip Graphics"
Driver "fbdev"
Option "fbdev" "/dev/fb0"
Option "DRI" "2"
EndSection
- Reset your system, then you can boot up from spi lcd.
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