Jump to content

Peter Gregory

Members
  • Posts

    30
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Peter Gregory got a reaction from Sma in Orange PI PC HDMI LCD MPI3508 Touchscreen SPI move CS from pin 24 to pin 22   
    So, it is working!  It just wasn't working with my edge custom built image: Armbian_23.08.0-trunk_Orangepipc_bookworm_edge_6.5.5_minimal.img.
    I reproduced my efforts on the latest armbian image Armbian_23.8.1_Orangepipc_bookworm_current_6.1.47.img and it is working as expected.
    The display works and the touch events are working properly.  I changed my wiring to test swapping LCD and Touch.  Here is my working wiring chart:

    1 - VCC     (1)  3.3v
    2 - GND     (6)  GND
    3 - CS         (24) PC3 SPI0 CS
    4 - RESET     (26) PA21 GPIO 11
    5 - DC         (31) PA8 GPIO 22
    6 - SDI (MOSI)    (19) PC0 SPI0 MOSI
    7 - SCLK    (23) PC2 SPI0 CLK
    8 - LED        (33) PA9 GPIO 23
    9 - SDO (MISO)    (21) PC1 SPI0 MISO
    10 - T_CLK      (23) PC2 SPI0 CLK *
    11 - T_CS       (18) PC7 GPIO 5
    12 - T_DIN    (19) PC0 SPI0 MOSI *
    13 - T_DO    (21) PC1 SPI0 MISO *
    14 - T_IRQ    (29) PA7 GPIO 21
     
    Here are steps to get the display working:
     
    Install latest armbian image: Armbian_23.8.1_Orangepipc_bookworm_current_6.1.47.img
     
    sudo armbian-config
     
    enable desktop
     
    sudo nano /boot/armbianEnv.txt
     
    user_overlays=touchscreen
    extraargs=fbcon=map:1
     
    nano touchscreen.dts
     
    /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target = <&pio>; __overlay__ { spi0_cs1: spi0_cs1 { pins = "PC7"; function = "gpio_out"; output-high; }; opiz_display_pins: opiz_display_pins { pins = "PA21", "PA8", "PA9"; function = "gpio_out"; }; ads7846_pins: ads7846_pins { pins = "PA7"; function = "irq"; }; }; }; fragment@1 { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-1 = <&spi0_cs1>; pinctrl-names = "default", "default"; cs-gpios= <0>, <&pio 2 7 0>; /* PC7 */ ads7846: ads7846@1 { reg = <0>; /* Chip Select 0 */ compatible = "ti,ads7846"; spi-max-frequency = <500000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&ads7846_pins>; interrupt-parent = <&pio>; interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */ pendown-gpio = <&pio 0 7 0>; /* PA7 */ /* driver defaults, optional */ ti,x-min = /bits/ 16 <0>; ti,y-min = /bits/ 16 <0>; ti,x-max = /bits/ 16 <0x0FFF>; ti,y-max = /bits/ 16 <0x0FFF>; ti,pressure-min = /bits/ 16 <0>; ti,pressure-max = /bits/ 16 <0xFFFF>; ti,x-plate-ohms = /bits/ 16 <400>; }; opizdisplay: opiz-display@0 { reg = <1>; /* Chip Select 1 */ compatible = "ilitek,ili9341"; spi-max-frequency = <16000000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&opiz_display_pins>; rotate = <90>; bgr = <0>; fps = <10>; buswidth = <8>; dc-gpios = <&pio 0 8 0>; /* PA8 */ reset-gpios = <&pio 0 21 1 >; /* PA21 */ led-gpios=<&pio 0 9 0>; /* PA9 */ debug=<0>; }; }; }; };  
    sudo armbian-add-overlay touchscreen.dts
     
    sudo nano /etc/modules-load.d/fbtft.conf
     
    fbtft
    fb_ili9341
     
    sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
     
    Section "Device"
      Identifier "myfb"
      Driver "fbdev"
      Option "fbdev" "/dev/fb1"
    EndSection
     
    reboot and your display and touch should work!
  2. Like
    Peter Gregory got a reaction from Werner in Orange PI PC + 3+3 watt amp power issues   
    I finally got a configuration that works.  I got a 5v 4amp wall power supply to run the Orange PI PC
    I connected my amp power to the 2 5v header pins and 2 and pins.
    I connected the audio jack's L and R & common ground using the SMD pads instead of an audio plug (My plug was stereo and was shorting the video out to audio channels)
    I put the audio signals through a audio isolation transformer to get rid of the ground loop current and filter out the big pop when the audio codec kicks on
    That's it!
    The 4a is strong enough to run the board and the amp without significant voltage drop on high power usage (~200ma draw from amp)
    The isolation transformers eliminate the ground loop hum and chatter from the board operations.
    The audio is clean and loud.
  3. Like
    Peter Gregory got a reaction from going in Orange PI PC HDMI LCD MPI3508 Touchscreen SPI move CS from pin 24 to pin 22   
    So, it is working!  It just wasn't working with my edge custom built image: Armbian_23.08.0-trunk_Orangepipc_bookworm_edge_6.5.5_minimal.img.
    I reproduced my efforts on the latest armbian image Armbian_23.8.1_Orangepipc_bookworm_current_6.1.47.img and it is working as expected.
    The display works and the touch events are working properly.  I changed my wiring to test swapping LCD and Touch.  Here is my working wiring chart:

    1 - VCC     (1)  3.3v
    2 - GND     (6)  GND
    3 - CS         (24) PC3 SPI0 CS
    4 - RESET     (26) PA21 GPIO 11
    5 - DC         (31) PA8 GPIO 22
    6 - SDI (MOSI)    (19) PC0 SPI0 MOSI
    7 - SCLK    (23) PC2 SPI0 CLK
    8 - LED        (33) PA9 GPIO 23
    9 - SDO (MISO)    (21) PC1 SPI0 MISO
    10 - T_CLK      (23) PC2 SPI0 CLK *
    11 - T_CS       (18) PC7 GPIO 5
    12 - T_DIN    (19) PC0 SPI0 MOSI *
    13 - T_DO    (21) PC1 SPI0 MISO *
    14 - T_IRQ    (29) PA7 GPIO 21
     
    Here are steps to get the display working:
     
    Install latest armbian image: Armbian_23.8.1_Orangepipc_bookworm_current_6.1.47.img
     
    sudo armbian-config
     
    enable desktop
     
    sudo nano /boot/armbianEnv.txt
     
    user_overlays=touchscreen
    extraargs=fbcon=map:1
     
    nano touchscreen.dts
     
    /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target = <&pio>; __overlay__ { spi0_cs1: spi0_cs1 { pins = "PC7"; function = "gpio_out"; output-high; }; opiz_display_pins: opiz_display_pins { pins = "PA21", "PA8", "PA9"; function = "gpio_out"; }; ads7846_pins: ads7846_pins { pins = "PA7"; function = "irq"; }; }; }; fragment@1 { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-1 = <&spi0_cs1>; pinctrl-names = "default", "default"; cs-gpios= <0>, <&pio 2 7 0>; /* PC7 */ ads7846: ads7846@1 { reg = <0>; /* Chip Select 0 */ compatible = "ti,ads7846"; spi-max-frequency = <500000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&ads7846_pins>; interrupt-parent = <&pio>; interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */ pendown-gpio = <&pio 0 7 0>; /* PA7 */ /* driver defaults, optional */ ti,x-min = /bits/ 16 <0>; ti,y-min = /bits/ 16 <0>; ti,x-max = /bits/ 16 <0x0FFF>; ti,y-max = /bits/ 16 <0x0FFF>; ti,pressure-min = /bits/ 16 <0>; ti,pressure-max = /bits/ 16 <0xFFFF>; ti,x-plate-ohms = /bits/ 16 <400>; }; opizdisplay: opiz-display@0 { reg = <1>; /* Chip Select 1 */ compatible = "ilitek,ili9341"; spi-max-frequency = <16000000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&opiz_display_pins>; rotate = <90>; bgr = <0>; fps = <10>; buswidth = <8>; dc-gpios = <&pio 0 8 0>; /* PA8 */ reset-gpios = <&pio 0 21 1 >; /* PA21 */ led-gpios=<&pio 0 9 0>; /* PA9 */ debug=<0>; }; }; }; };  
    sudo armbian-add-overlay touchscreen.dts
     
    sudo nano /etc/modules-load.d/fbtft.conf
     
    fbtft
    fb_ili9341
     
    sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
     
    Section "Device"
      Identifier "myfb"
      Driver "fbdev"
      Option "fbdev" "/dev/fb1"
    EndSection
     
    reboot and your display and touch should work!
  4. Like
    Peter Gregory got a reaction from going in Orange PI PC HDMI LCD MPI3508 Touchscreen SPI move CS from pin 24 to pin 22   
    I'm getting closer - I finally got the touch and display to initialize.  The trick is determining which GPIO pins can be used and which support interrupts.
    Here is the pinout and connection diagram I am using:

    1 - VCC     (1)  3.3v
    2 - GND     (6)  GND
    3 - CS         (24) PC3 SPI0 CS
    4 - RESET     (29) PA7 GPIO 21
    5 - DC         (31) PA8 GPIO 22
    6 - SDI (MOSI)    (19) PC0 SPI0 MOSI
    7 - SCLK    (23) PC2 SPI0 CLK
    8 - LED        (33) PA9 GPIO 23
    9 - SDO (MISO)    (21) PC1 SPI0 MISO
    10 - T_CLK      (23) PC2 SPI0 CLK *
    11 - T_CS       (26) PC7 GPIO 5
    12 - T_DIN    (19) PC0 SPI0 MOSI *
    13 - T_DO    (21) PC1 SPI0 MISO *
    14 - T_IRQ    (18) PA21 GPIO 11 (Supports interrupt)
     
    DTS that is working
    /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target = <&pio>; __overlay__ { spi0_cs1: spi0_cs1 { pins = "PC7"; function = "gpio_out"; output-high; }; opiz_display_pins: opiz_display_pins { pins = "PA7", "PA8", "PA9"; function = "gpio_out"; }; ads7846_pins: ads7846_pins { pins = "PA21"; function = "irq"; }; }; }; fragment@1 { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-1 = <&spi0_cs1>; pinctrl-names = "default", "default"; cs-gpios= <0>, <&pio 2 7 0>; opizdisplay: opiz-display@0 { reg = <0>; /* Chip Select 0 */ compatible = "ilitek,ili9341"; spi-max-frequency = <16000000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&opiz_display_pins>; rotate = <90>; bgr = <0>; fps = <10>; buswidth = <8>; dc-gpios = <&pio 0 8 0>; /* PA8 */ reset-gpios = <&pio 0 7 1 >; /* PA7 */ led-gpios=<&pio 0 9 0>; /* PA9 */ debug=<4>; }; ads7846: ads7846@1 { reg = <1>; /* Chip Select 1 */ compatible = "ti,ads7846"; spi-max-frequency = <2000000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&ads7846_pins>; interrupt-parent = <&pio>; interrupts = <0 21 2>; /* PC7 IRQ_TYPE_EDGE_FALLING */ pendown-gpio = <&pio 0 21 0>; /* PC7 */ /* driver defaults, optional */ ti,x-min = /bits/ 16 <0>; ti,y-min = /bits/ 16 <0>; ti,x-max = /bits/ 16 <0x0FFF>; ti,y-max = /bits/ 16 <0x0FFF>; ti,pressure-min = /bits/ 16 <0>; ti,pressure-max = /bits/ 16 <0xFFFF>; ti,x-plate-ohms = /bits/ 16 <400>; }; }; }; };
    Using this configuration I get the following from dmesg:
     
    [    6.231015] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
    [    6.234683] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
    [    6.235590] systemd[1]: Mounting sys-fs-fuse-connections.mount - FUSE Control File System...
    [    6.235823] fb_ili9341 spi0.0: fbtft_property_value: buswidth = 8
    [    6.235857] fb_ili9341 spi0.0: fbtft_property_value: debug = 4
    [    6.235870] fb_ili9341 spi0.0: fbtft_property_value: rotate = 90
    [    6.235892] fb_ili9341 spi0.0: fbtft_property_value: fps = 10
    [    6.573436] fb_ili9341 spi0.0: Display update: 1787 kB/s, fps=0
    [    6.574355] Console: switching to colour frame buffer device 40x30
    [    6.575115] graphics fb1: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 16 KiB buffer memory, fps=10, spi0.0 at 16 MHz
    [    8.471370] SPI driver ads7846 has no spi_device_id for ti,tsc2046
    [    8.471402] SPI driver ads7846 has no spi_device_id for ti,ads7843
    [    8.471410] SPI driver ads7846 has no spi_device_id for ti,ads7845
    [    8.471417] SPI driver ads7846 has no spi_device_id for ti,ads7873
    [    8.471620] ads7846 spi0.1: setup mode 0, 8 bits/w, 2000000 Hz max --> 0
    [    8.471794] ads7846 spi0.1: supply vcc not found, using dummy regulator
    [    8.481255] systemd[1]: Finished systemd-binfmt.service - Set Up Additional Binary Formats.
    [    8.486590] ads7846 spi0.1: touchscreen, irq 62
    [    8.501181] input: ADS7846 Touchscreen as /devices/platform/soc/1c68000.spi/spi_master/spi0/spi0.1/input/input2
     
    I try touching the screen, but I'm not set up to use the new touch device as the main input yet.
    I think I'm very close to getting this display operational.
     
    running everest I get the following:
    everest
    'No device specified, trying to scan all of /dev/input/event*
    Not running as root, no devices may be available.
    Available devices:
    /dev/input/event0: gpio-keys
    /dev/input/event1: sunxi-ir
    /dev/input/event2: ADS7846 Touchscreen
    /dev/input/event3: BRLTTY 6.5 Linux Screen Driver Keyboard
     
    evtest --grab /dev/input/event2
    Input driver version is 1.0.1
    Input device ID: bus 0x1c vendor 0x0 product 0x1ea6 version 0x0
    Input device name: "ADS7846 Touchscreen"
    Supported events:
      Event type 0 (EV_SYN)
      Event type 1 (EV_KEY)
        Event code 330 (BTN_TOUCH)
      Event type 3 (EV_ABS)
        Event code 0 (ABS_X)
          Value      0
          Min        0
          Max     4095
        Event code 1 (ABS_Y)
          Value      0
          Min        0
          Max     4095
        Event code 24 (ABS_PRESSURE)
          Value      0
          Min        0
          Max    65535
    Properties:
    Testing ... (interrupt to exit)
    Event: time 1695777743.332287, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
    Event: time 1695777743.332287, type 3 (EV_ABS), code 0 (ABS_X), value 562
    Event: time 1695777743.332287, type 3 (EV_ABS), code 1 (ABS_Y), value 2228
    Event: time 1695777743.332287, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 64919
    Event: time 1695777743.332287, -------------- SYN_REPORT ------------
    Event: time 1695777743.340652, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
    Event: time 1695777743.340652, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
    Event: time 1695777743.340652, -------------- SYN_REPORT ------------
    Event: time 1695777762.428725, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
    Event: time 1695777762.428725, type 3 (EV_ABS), code 0 (ABS_X), value 21
    Event: time 1695777762.428725, type 3 (EV_ABS), code 1 (ABS_Y), value 3185
    Event: time 1695777762.428725, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 65502
    Event: time 1695777762.428725, -------------- SYN_REPORT ------------
    Event: time 1695777762.440670, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
    Event: time 1695777762.440670, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
    Event: time 1695777762.440670, -------------- SYN_REPORT ------------
     
    I'm getting touch events.  I still need to find out how to set the touch device as the default pointer.
     
    After testing and trying to get the touch working consistently I've come to the conclusion the interrupt is not working as expected.
    I can hook my device up to a scope and every touch will cause a drop in the pen down pin, but I don't see a corresponding drop in CS1 pin to SPI activity to get the touch data.  Every now and then it will query the touch device in response to a touch event, but it does it only after repeated touch & move operations.  I don't see a way to turn on debugging for the touch module, so it is difficult to determine where the problem is.  Anyone else see this behavior?
  5. Like
    Peter Gregory got a reaction from going in Orange PI PC HDMI LCD MPI3508 Touchscreen SPI move CS from pin 24 to pin 22   
    Great advice.  I made the switch to the latest Armbian image
     
    Armbian_23.8.1_Orangepipc_bookworm_current_6.1.47
     
    I was in the process of applying what I've done so far. Enabling dual SPI with the spi-double-spidev-cs user overlay does not work in this image (it didn't work on the other image properly either)
    I'll check out the binaries listed above and see if I can make them work for me.
    Thanks for all the advice!  If I get it working, I'll paste a tutorial.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines