Jump to content

Peter Gregory

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by Peter Gregory

  1. I'm trying to include pin definitions for SPI but I don't see a good example of how this is done. I tried this approach based on another DTS, but it does not work. Any advice on how to clean up this DTS and make it work would be appreciated. If I omit the pin mappings, the overlay works and the SPI devices exist (SPI0.0 & SPI0.1) and appear to work on my scope. /dts-v1/; /plugin/; / { compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5"; fragment@0 { target = < 0xffffffff >; __overlay__ { spi0_cs1 { pins = "PC3"; function = "gpio_out"; output-high; phandle = < 0x01 >; }; spi1_cs1 { pins = "PA21"; function = "gpio_out"; output-high; phandle = < 0x02 >; }; }; }; fragment@1 { target = < 0xffffffff >; __overlay__ { pinctrl-names = "default\0default"; pinctrl-1 = < 0x01 >; cs-gpios = < 0x00 0xffffffff 0x02 0x03 0x00 >; }; }; fragment@2 { target = < 0xffffffff >; __overlay__ { pinctrl-names = "default\0default"; pinctrl-1 = < 0x02 >; cs-gpios = < 0x00 0xffffffff 0x00 0x15 0x00 >; }; }; fragment@3 { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; spidev@0 { reg = < 0x00 >; /* Chip Select 0 */ compatible = "spidev"; spi-max-frequency = <1000000>; status = "okay"; }; spidev@1 { reg = < 0x01 >; /* Chip Select 1 */ compatible = "spidev"; spi-max-frequency = <1000000>; status = "okay"; }; }; }; };
  2. I've made a some progress on getting the touch part of the LCD working. The default SPI0.0 CS is pin 24 but the second SPI0.1 CS is pin 26, the pin I need. So, I just needed to enable 2 SPI devices. Enable 2nd spi device Orange PI PC First, create the overlay to enable 2 CS pins for one SPI device nano spi-double-spidev-cs.dts /dts-v1/; /plugin/; / { compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5"; fragment@0 { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; spidev@0 { reg = <0>; /* Chip Select 0 */ compatible = "spidev"; spi-max-frequency = <1000000>; status = "okay"; }; spidev@1 { reg = <1>; /* Chip Select 1 */ compatible = "spidev"; spi-max-frequency = <1000000>; status = "okay"; }; }; }; }; Compile the overlay dtc -I dts -O dtb -o spi-double-spidev-cs.dtbo spi-double-spidev-cs.dts Copy the overlay to the user overlays location sudo cp spi-double-spidev-cs.dtbo /boot/overlay-user/spi-double-spidev-cs.dtbo Configure the user overlay and SPI devices sudo nano /boot/orangepiEnv.txt overlays=spi-spidev spi-add-cs1 user_overlays=spi-double-spidev-cs param_spidev_spi_bus=0 param_spidev_spi_cs=0 reboot and you will have 2 SPI devices Now, update the touch controller to use SPI0.1 sudo nano /etc/modprobe.d/ads7846_device.conf options ads7846_device model=7846 verbose=2 cs=1 gpio_pendown=2 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=$ However, I'm seeing an error starting the driver: [ 6.866374] ads7846_device: loading out-of-tree module taints kernel. [ 6.867290] ads7846_device: ads7846_device_init() [ 6.867296] ads7846_device: SPI devices registered: [ 6.867314] ads7846_device: spidev spi0.1 1000kHz 8 bits mode=0x00 [ 6.867324] ads7846_device: spidev spi0.0 1000kHz 8 bits mode=0x00 [ 6.867328] ads7846_device: [ 6.867340] ads7846_device: Settings: [ 6.867347] ads7846_device: model = 7846 [ 6.867354] ads7846_device: gpio_pendown = 6 [ 6.867359] ads7846_device: swap_xy = 1 [ 6.867362] ads7846_device: x_min = 200 [ 6.867365] ads7846_device: x_max = 3900 [ 6.867368] ads7846_device: y_min = 200 [ 6.867371] ads7846_device: y_max = 3900 [ 6.867374] ads7846_device: x_plate_ohms = 60 [ 6.867376] ads7846_device: pressure_min = 0 [ 6.867379] ads7846_device: pressure_max = 255 [ 6.867382] ads7846_device: keep_vref_on = 1 [ 6.867384] ads7846_device: vref_delay_usecs = 0 [ 6.867386] ads7846_device: vref_mv = 0 [ 6.867389] ads7846_device: settle_delay_usecs = 0 [ 6.867391] ads7846_device: penirq_recheck_delay_usecs = 0 [ 6.867394] ads7846_device: y_plate_ohms = 0 [ 6.867396] ads7846_device: debounce_max = 0 [ 6.867399] ads7846_device: debounce_tol = 0 [ 6.867401] ads7846_device: debounce_rep = 0 [ 6.867414] ads7846_device: Deleting spi0.1 [ 6.867993] spi spi0.1: spi_setup / gpio_is_valid(21) ... doing gpio_request ... [ 6.868013] spi spi0.1: failed to request gpio [ 6.868291] ads7846 spi0.1: spi_setup / gpio_is_valid(21) ... doing gpio_request ... [ 6.868303] ads7846 spi0.1: failed to request gpio [ 6.868394] ads7846 spi0.1: spi0.1 supply vcc not found, using dummy regulator [ 6.871787] ads7846 spi0.1: touchscreen, irq 70 [ 6.873235] input: ADS7846 Touchscreen as /devices/platform/soc/1c68000.spi/spi_master/spi0/spi0.1/input/input1 [ 6.873332] ads7846_device: SPI devices registered: [ 6.873343] ads7846_device: spidev spi0.0 1000kHz 8 bits mode=0x00 [ 6.873349] ads7846_device: ads7846 spi0.1 2000kHz 8 bits mode=0x00 [ 6.873352] ads7846_device: Anyone else see this before? It still works the SPI port (I see activity on the SPI pins and the correct pin for SPI0.1 goes active low for CS, pin 26. I think the issue now is the interrupt for pin down on pin 22 (BCM 2), I'm not sure how to configure that. Anyone else gotten that to work?
  3. I'm trying to get a HDMI LCD touchscreen working. The pinout is compatible with Orange PI PC except the SPI CS pin is on pin 26 (WPI 11) instead of pin 24 (WPI 10). Is there an easy way to move the SPI CS pin to another GPIO pin? Also, I'm not sure how to properly configure the pen down interrupt pin for pin 22 (WPI 6) So far, I've got the following working: Image: Orangepipc_2.0.8_debian_buster_desktop_linux5.4.65.7z Touchscreen: 3.5 Inch HD HDMI USB LCD Touch Screen 3.5" Display Module 480×320 1920x1080 for Raspberry Pi 3rd 4th Generation 4B/3B+/3B/2B orangepiEnv.txt: overlays=spi-add-cs1 spi-spidev param_spidev_spi_bus=0 param_spidev_spi_cs=0 Luckily, the kernel headers are loaded, so Makefile works. mkdir ds7846 cd ds7846 wget https://sourceforge.net/p/openipmi/linux-ipmi/ci/master/tree/drivers/input/touchscreen/ads7846.c?format=raw mv ads7846.c?format=raw ads7846.c nano Makefile: obj-m := ads7846.o KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) all: $(MAKE) -C $(KDIR) M=$(PWD) modules clean: $(MAKE) -C $(KDIR) M=$(PWD) clean install: $(MAKE) -C $(KDIR) M=$(PWD) modules_install make make install depmod cd .. git clone https://github.com/notro/fbtft_tools/ cd fbtft_tools/ads7846_device make make install depmod cd .. sudo nano /etc/modules-load.d/99-ads7846.conf ads7846 ads7846_device sudo nano /etc/modprobe.d/ads7846_device.conf options ads7846_device model=7846 verbose=2 cs=0 gpio_pendown=1 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900 after reboot, the SPI device is there and the touch driver attaches to the port. [ 7.124454] ads7846_device: loading out-of-tree module taints kernel. [ 7.125336] ads7846_device: ads7846_device_init() [ 7.125343] ads7846_device: SPI devices registered: [ 7.125354] ads7846_device: spidev spi0.0 1000kHz 8 bits mode=0x00 [ 7.125357] ads7846_device: [ 7.125366] ads7846_device: Settings: [ 7.125369] ads7846_device: model = 7846 [ 7.125372] ads7846_device: gpio_pendown = 1 [ 7.125375] ads7846_device: swap_xy = 1 [ 7.125378] ads7846_device: x_min = 200 [ 7.125380] ads7846_device: x_max = 3900 [ 7.125383] ads7846_device: y_min = 200 [ 7.125386] ads7846_device: y_max = 3900 [ 7.125388] ads7846_device: x_plate_ohms = 60 [ 7.125391] ads7846_device: pressure_min = 0 [ 7.125393] ads7846_device: pressure_max = 255 [ 7.125396] ads7846_device: keep_vref_on = 1 [ 7.125398] ads7846_device: vref_delay_usecs = 0 [ 7.125401] ads7846_device: vref_mv = 0 [ 7.125403] ads7846_device: settle_delay_usecs = 0 [ 7.125406] ads7846_device: penirq_recheck_delay_usecs = 0 [ 7.125409] ads7846_device: y_plate_ohms = 0 [ 7.125411] ads7846_device: debounce_max = 0 [ 7.125414] ads7846_device: debounce_tol = 0 [ 7.125416] ads7846_device: debounce_rep = 0 [ 7.125425] ads7846_device: Deleting spi0.0 [ 7.126442] ads7846 spi0.0: spi0.0 supply vcc not found, using dummy regulator [ 7.144047] ads7846 spi0.0: touchscreen, irq 65 [ 7.144980] input: ADS7846 Touchscreen as /devices/platform/soc/1c68000.spi/spi_master/spi0/spi0.0/input/input1 [ 7.145055] ads7846_device: SPI devices registered: [ 7.145063] ads7846_device: ads7846 spi0.0 2000kHz 8 bits mode=0x00 [ 7.145066] ads7846_device: Of course, no touch events are detected. Anyone else have any luck getting this to work? I'm not familiar with changing the device tee to move GPIO pins, is there a configuration option for the spi_add_cs1?
  4. I recently got my SPI display to work with OPZero2. This document was very helpful: https://tienda.tettsa.gt/wp-content/uploads/2022/08/OrangePi_Zero2_H616_User-manual_v3.7.pdf Your GPIO pin numbers are not correct. I wired to the same GPIO pins suggested in the document above: 1 - VCC (1) 3.3v 2 - GND (6) Gnd 3 - CS (24) Spi1 CS 4 - RESET (7) GPIO 6 - 73 5 - DC (11) GPIO 1 - 70 6 - SDI (MOSI) (19) Spi1 MOSI 7 - SCLK (23) Spi1 CLK 8 - LED (13) GPIO 0 - 69 9 - SDO (MISO) (21) Spi1 MISO The GPIO mapping looks like this: options fbtft_device custom name=fb_ili9341 gpios=dc:70,reset:73,led:69 speed=16000000 busnum=1 cs=1 bgr=1 txtbuflen-32768 fps=10 rotate=90
  5. I got my 320x240 ILI9341 touchscreen to work with the image from the OrangePI site: Armbian_23.5.2_Orangepizero2_bookworm_legacy_4.9.318_minimal The display is one I bought from Amazon Hosyond 2.8 Inches TFT LCD Touch Screen Shield Display Module 320x240 SPI Serial ILI9341 with Touch Pen Compatible with Arduino R3/Mega2560 Development Board This document was very helpful getting the display set up on the OPZero 2: https://tienda.tettsa.gt/wp-content/uploads/2022/08/OrangePi_Zero2_H616_User-manual_v3.7.pdf I still don't have the touch part working. If anyone has success getting 2 selects working with SPI1 on OPZero2 and touch working, let me know. The basic steps to getting the SPI LCD to work are: 1) wire up the display to the OPZero2 2.8 Inch TFT SPI 240x320 => OPZero2 1 - VCC => (1) 3.3v 2 - GND => (6) Gnd 3 - CS => (24) Spi1 CS 4 - RESET => (7) GPIO 6 5 - DC => (11) GPIO 1 6 - SDI (MOSI) => (19) Spi1 MOSI 7 - SCLK => (23) Spi1 CLK 8 - LED => (13) GPIO 0 9 - SDO (MISO) => (21) Spi1 MISO 10 - T_CLK 11 - T_CS 12 - T_DIN 13 - T_DO 14 - T_IRQ 2) Install Armbian_23.5.2_Orangepizero2_bookworm_legacy_4.9.318_minimal - must be legacy kernel to work 4.9 is OK 3) sudo apt install fbi kbd armbian-config 4) sudo armbian-config set up desktop now to make the LCD work and start on boot 5) sudo nano /boot/armbianEnv.txt overlays=spi-spidev param_spidev_spi_bus=1 param_spidev_spi_cs=1 extraargs=fbcon=map:1 6) sudo nano /etc/modules-load.d/fbtft.conf fbtft fbtft_device 7) sudo nano etc/modprobe.d/fbtft.conf options fbtft_device custom name=fb_ili9341 gpios=dc:70,reset:73,led:69 speed=16000000 busnum=1 cs=1 bgr=1 txtbuflen-32768 fps=10 rotate=90 😎 sudo dpkg-reconfigure console-setup select UTF-8 select Guess optimal character set select terminus select 6/12 9) sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf Section "Device" Identifier "myfb" Driver "fbdev" Option "fbdev" "/dev/fb1" EndSection Now when it boots it should boot to the SPI LCD Display
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines