Open demenkovms opened 1 year ago
Opening device /dev/spidev0.0
Orange Pi Zero's CS is CS1, not CS0.
Add the following two lines to /boot/armbianEnv.txt and reboot
overlays=spi-spidev usbhost2 usbhost3
param_spidev_spi_bus=1
$ ls /dev/spi*
/dev/spidev1.0
Clone latest and build.
$ cc -o demo demo.c fontx.c ili9340.c -lwiringPi -lm -pthread -DWPI -DSPI1
Thanks for answer! Not I get
but nothing shows on display - it's white
set in ili9340.c
#define D_C 12
#define RES 11
#define C_S 13
There are several WiringPi libraries that can be used with ZERO, and the allocation of GPIO is different for each.
This is the WiringPi library I'm using.
It's probably not the same as you are using.
You can check the GPIO number of your library using GPIO command and LED Blinking.
$ gpio -g mode 13 out
$ gpio -g write 13 on
$ gpio -g write 13 off
hm...
in my
is I need set number by from GPIO or wPi?
is I need set number by from GPIO or wPi?
probably neither
You should investigate the GPIO pinmap.
Does the following command blink the LED connected to pin number 8?
$ gpio -g mode 198 out
$ gpio -g write 198 on
$ gpio -g write 198 off
On my WiringPi this will flash pin number 8.
$ gpio -g mode 20 out
$ gpio -g write 20 on
$ gpio -g write 20 off
It is very difficult to use WiringPi Library in the OrangePi series.
led is not not blink and gpio not made on...
I download this library https://github.com/xpertsavenue/WiringOP-Zero and it works correct with LED.
then I change in ili9340.c pins for wPi
#define D_C 8
#define RES 9
#define C_S 10
recompiled demo, but nothing changed...
I need to downgrade kernel to 5.10. Is I correctly understood?
You are correct, but there is no mention of OPI-ZERO anywhere.
OPI-ZERO is SPI1, so there may be other issues.
then, may be it’s possible to change spi in library code?
I can’t understand your mention.
The WiringPi library is provided in source, so you can modify it as you like.
And since this project is also provided in source, you can modify it to your liking.
I mean: in your library used /dev/spi0, and in Opi Zero used /dev/spi1. Can I change spi0 to spi1 in code?
Can I change spi0 to spi1 in code?
Use compile flag. -DSPI1
yes. I compiled with this flag, as you wrote some posts earlier. It’s runs correctly but nothing shows on display
Using the latest repo, I have verified that it works fine on OrangePiPC.
$ uname -a
Linux orangepipc 5.10.60-sunxi #21.08.1 SMP Wed Aug 25 18:19:32 UTC 2021 armv7l GNU/Linux
$ cat /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=8724794f-4966-4eeb-9e56-4eab78d3c318
rootfstype=ext4
overlays=spi-spidev
param_spidev_spi_bus=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
$ ls /dev/spi*
/dev/spidev0.0
RES-->Pin#5 DC-->Pin#3
git clone https://github.com/nopnop2002/Raspberry-ili9340spi
cd Raspberry-ili9340spi
cc -o demo demo.c fontx.c ili9340.c -lwiringPi -lm -pthread -DWPI
sudo ./demo
Try latest, and with -DSPI1.
OrangePi ONE works fine.
However, it doesn't work properly with OrangePi ZERO.
It's probably a problem with ZERO's SPI driver.
I really can not understand what is wrong...
I reinstall Armbial for early version:
uname -a
Linux orangepizero 5.10.12-sunxi #21.02.1 SMP Wed Feb 3 20:39:30 CET 2021 armv7l GNU/Linux
edit /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=serial
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=usbhost2 usbhost3
rootdev=UUID=13a6830e-cee9-4001-83ce-6b4e7542699c
rootfstype=ext4
overlays=spi-spidev
param_spidev_spi_bus=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
and now I have SPI0:
gpio readall return:
Try to blink LED:
gpio mode 6 OUT
gpio write 6 on
gpio write 6 off
all work correctly - led was blink
check connection:
TFT OPI SDO(MISO) --------> SPI1_MISO/PA16 (gpio 16 - wPi 12 - pin 21) SCK --------> SPI1_CLK/PA14 (gpio 14 - wPi 14 - pin 23) SDI(MOSI) --------> SPI1_MOSI/PA15 (gpio15 - wPi 11 - pin 19) DC --------> PA12 (gpio 12 - wPi 0 - pin 3) RESET --------> PA11 (gpio 11 - wPi 1 - pin 5) CS --------> PA13 (gpio 13 - wPi 16 - pin 26) VCC, LED --------> 3.3v GND --------> GND
download new repo, make
cc -o demo demo.c fontx.c ili9340.c -lwiringPi -lm -pthread -DWPI
on run ./demo get output:
but the display is white...
change and try
It will blink pin#3
gpio mode 0 OUT
gpio write 0 on
gpio write 0 off
It will blink pin#5
gpio mode 1 OUT
gpio write 1 on
gpio write 1 off
param_spidev_spi_bus=0 ---> param_spidev_spi_bus=1
DC --------> PA12 (gpio 12 - wPi 0 - pin 3) --> #define D_C 0 // wPi IO0=Pin#3
RESET --------> PA11 (gpio 11 - wPi 1 - pin 5) --> #define RES 1 // wPi IO1=Pin#5
cc -o demo demo.c fontx.c ili9340.c -lwiringPi -lm -pthread -DWPI -DSPI1
I tried this and it doesn't work.
$ dmesg | grep spi
[ 4.488718] spidev spi1.0: probing from DT
$ ls /dev/spi*
/dev/spidev1.0
$ uname -a
Linux orangepizero 5.10.34-sunxi #21.05.1 SMP Thu May 6 20:13:21 UTC 2021 armv7l GNU/Linux
$ cat /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=serial
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=usbhost2 usbhost3
rootdev=UUID=93502503-5a81-4c0c-b76e-fabcad07a82b
rootfstype=ext4
overlays=spi-spidev
param_spidev_spi_bus=1
param_spidev_spi_cs=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
Hardware SPI doesn't work properly on ZERO.
So we supported software SPI. Very slow but work.
I used this library.
https://github.com/xpertsavenue/WiringOP-Zero
$ uname -a
Linux orangepizero 5.15.93-sunxi #23.02.2 SMP Fri Feb 17 23:49:46 UTC 2023 armv7l GNU/Linux
Try to use it on Orange Pi Zero with WiringPi.
I connect TFT to OPI zero, to SPI 1
make
cc -o demo demo.c fontx.c ili9340.c -lwiringPi -lm -DWPI
in /boot/orangepiEnv.txt add:
run ./demo and get:
Please, help: what I did wrong? Thanks!