How to use st7735 LCD SPI screen?

Hi.
I saw some discution about SPI LCD.

I Have a ROCK3C with latest Debian.

How do I proceed?

Any tutorial ?

I need to implement into python script to image showing.

There are two methods to display the ST7735 SPI LCD: one is through the kernel Overlay, and the other is calling the kernel-exposed /dev/spidevx.x device from the user layer to read and write to the spidev.

1 Like

If you are interested in using the second method, you need to enable the spidev overlay first, and then install the related python libraries.

1 Like

Hello friend,
Thanks for the answer.
First of all, I’ve been researching about SPI and found a post commenting on conflicts with libmraa.

I would like help deciding which libraries to use. I have no experience with ROCK.

Board: Radxa Rock 3C
System: Debian (latest)
Use - Recording USB video and audio input
Extras:

  1. 3-pin button (GND, VCC, out). To start recording.
  2. LEDs for feedback (app on)
  3. SPI ST7735 1.8 inch LCD display 128x160

First question:
I’m going to use the button to start the recording process. Within a python script.
I used the MRAA library. It works.
Is there another option for use in python?

Second question:
How to use the SPI screen to give feedback on what happens in my APP.
I have no idea how to get started in Rock. I made it work in other projects but following instructions.
I installed: https://github.com/pimoroni/st7735-python
But it didn’t work.
Apparently I should activate spidev.
Can you give me some guidance on how to follow?

Thanks.

  1. you can also use python periphery.
  2. As for how to look at the screen feedback, this may depend on the specific logic in your program.
  3. The st7735-python library may depend on Adafruit_GPIO or RPI.GPIO, both of which are not compatible with the ROCK 3C.
1 Like

if you want to enable st7735 from kernel driver, you can refer to this commit.

1 Like
  1. Nice, thank you for the sugestion.
  2. yep. This is ok already.
  3. I saw that. I have discovered that st7735 python, uses RPI.GPIO and its not compatible.

But now, I dont know how to proceed.

How do I start using this kernel driver?

After installing how do I display an image into the screen?

I really don’t have any idea how to start.

This files contain:
#include “st7789v.dtsi”

DISPLAY_SPI {
status = “okay”;
#address-cells = <1>;
#size-cells = <0>;

st7789: st7789@0 {

I should change to st7735 ?
Sorry but I really couldn’t understand this part.

I’ve just updated the dts script to work better with other models of the same type.
You can refer the following steps:

  1. clone my repository by the cmd:
git clone https://github.com/nascs/overlays.git
  1. checkout the branch
cd overlays
git checkout -b spi_lcd_st7735 origin/spi_lcd_st7735
  1. install the rk356x header package
wget https://github.com/radxa-pkg/linux-rk356x/releases/download/5.10.160-37/linux-headers-5.10.160-37-rk356x_5.10.160-37-ff919543b_arm64.deb
sudo apt install ./linux-headers-5.10.160-37-rk356x_5.10.160-37-ff919543b_arm64.deb
  1. compile overlays
make build-dtbo -j$(nproc) KERNELRELEASE=5.10.160-37-rk356x CONFIG_ARCH_MESON=n CONFIG_CPU_RK3528=rockchip CONFIG_CPU_RK3568=rockchip
  1. copy the st7735 overlay to directory /boot/dtbo/
 sudo cp arch/arm64/boot/dts/rockchip/overlays/rk3568-spi3-m1-cs0-st7735.dtbo /boot/dtbo/
  1. reboot you system

  2. if the compatible filed is not comatible with your lcd, just use this field in the comments section.

1 Like

If the LCD works rightly, then you can operate the fb device “/dev/fbX”.

1 Like

Hi, thank you for the help.

I did this mentioned. Had to use the // compatible = "sitronix,st7735r"; field mentioned to start the driver.

I have done only a simple correction in width = <135>; and height = <240> and 4MHz;
Compiled, copied, and rebbot. Then installed in rsetup.

Now I can see the screen “working” it’s all white.
rock@rock-3c:~/scripts$ sudo dmesg | grep fb_st7735r
[ 15.989671] fb_st7735r: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.990464] fb_st7735r spi3.0: fbtft_property_value: width = 128
[ 15.990477] fb_st7735r spi3.0: fbtft_property_value: height = 160
[ 15.990483] fb_st7735r spi3.0: fbtft_property_value: regwidth = 16
[ 15.990489] fb_st7735r spi3.0: fbtft_property_value: buswidth = 8
[ 15.990496] fb_st7735r spi3.0: fbtft_property_value: debug = 0
[ 15.990502] fb_st7735r spi3.0: fbtft_property_value: rotate = 90
[ 15.990508] fb_st7735r spi3.0: fbtft_property_value: fps = 60
[ 15.990513] fb_st7735r spi3.0: fbtft_property_value: txbuflen = 32768
[ 17.487988] graphics fb0: fb_st7735r frame buffer, 160x128, 40 KiB video memory, 32 KiB buffer memory, fps=60, spi3.0 at 4 MHz

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

This also makes no change:
sudo dd if=/dev/zero of=/dev/fb0 bs=10k count=1

As far as I know I have to initiate the screen, reset, and then send an image. But I was doing this steps with python, I dont know how to make this.

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

Also, I Can’t see the display when: ls /dev/spidev*
should I enable spi overlay also?