SPI pin 25 gpio25 conflict with touchscreen and MCP2515 CAN OBD2 adapter

  • DietPi version | cat /boot/dietpi/.version
  • root@DietPi:~# cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=16
    G_DIETPI_VERSION_RC=3
    G_GITBRANCH='master'
    G_GITOWNER='MichaIng'
    G_LIVE_PATCH_STATUS[0]='applied'
    G_LIVE_PATCH_STATUS[1]='applied'
    G_LIVE_PATCH_STATUS[2]='applied'
    
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
  • trixie 0
    
  • Kernel version | uname --all
  • Linux DietPi 6.12.47+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
    
  • Architecture | dpkg --print-architecture
  • arm64
    
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
  • RPi Zero 2 W (aarch64)
    

this is the elecrow touchscreen that I am using

Extra details

This is supposed the entire config.txt

but I can’t get to copy the entire text in VIM nor NANO

there is a conflict with the touchscreen at the end.

now VIM isn’t copying at alll anymore to the clipboard

:%y+
https://dietpi.com/forum/t/elecrow-3-5-5-7-inch-monitor-touch-screen-setup/24180
#For more options and information see
#http://rptl.io/configtxt
#Some settings may impact device functionality. See link above for details
#Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on#dtparam=i2s=ondtparam=spi=on#projects-saspberry.com how to connect raspberry to candtoverlay=mcp2515-can0,oscillator=160000000,interrupt=25dtoverlay=spi0-hw-cs
#Enable audio (loads snd_bcm2835)
dtparam=audio=on
#Additional overlays and parameters are documented
#/boot/firmware/overlays/README
#Automatically load overlays for detected cameras
camera_auto_detect=1
#Automatically load overlays for detected DSI displays
display_auto_detect=1
#Automatically load initramfs files, if found
auto_initramfs=1
#Enable DRM VC4 V3D driver
#dtoverlay=vc4-kms-v3dmax_framebuffers=2
#Don’t have the firmware create an initial video= setting in cmdline.txt.
#Use the kernel’s default instead.
disable_fw_kms_setup=1
#Run in 64-bit mode
arm_64bit=1
#Disable compensation for displays with overscan
disable_overscan=1
#Run as fast as firmware / board allows
arm_boost=1[cm4]
root@DietPi:~# dmesg | grep -i spi
[    9.223491] ads7846 spi0.1: supply vcc not found, using dummy regulator
[    9.227124] ads7846 spi0.1: touchscreen, irq 184
[    9.229657] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/                        spi_master/spi0/spi0.1/input/input0
[    9.374223] pinctrl-bcm2835 3f200000.gpio: pin gpio25 already requested by sp                        i0.1; cannot claim for spi0.0
[    9.387622] pinctrl-bcm2835 3f200000.gpio: error -EINVAL: pin-25 (spi0.0)
[    9.412237] mcp251x spi0.0: Error applying setting, reverse things back
root@DietPi:~# sudo vi /boot/config.txt
root@DietPi:~# reboot
root@DietPi:~#

I changed the display IRQ from 25 to 26.

root@DietPi:~# dmesg | grep -i spi
[    9.063473] ads7846 spi0.1: supply vcc not found, using dummy regulator
[    9.068814] ads7846 spi0.1: touchscreen, irq 184
[    9.072274] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/                                    spi_master/spi0/spi0.1/input/input0
[    9.089488] mcp251x spi0.0: probe with driver mcp251x failed with error -34
root@DietPi:~#
root@DietPi:~# for i in /proc/device-tree/spi*; do ls -l "$i"; cat "$i/status"; echo; done
ls: cannot access '/proc/device-tree/spi*': No such file or directory
cat: '/proc/device-tree/spi*/status': No such file or directory

root@DietPi:~#

when I find more time I might be able to find out how to copy the entire /boot/config.txt …

desktop indicates Error, no session for pid 845

I’ll just give it a quick “bump”

Both devices (the ads7846 and the MCP2515) want to use the same IRQ-Pin (Pin 25).

So in your config.txt you set also penirq=25 for the MCP2515, but only one can use it.

root@DietPi:~# dmesg | grep -i spi
[    9.063473] ads7846 spi0.1: supply vcc not found, using dummy regulator
[    9.068814] ads7846 spi0.1: touchscreen, irq 184
[    9.072274] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/                                   spi_master/spi0/spi0.1/input/input0
[    9.089488] mcp251x spi0.0: probe with driver mcp251x failed with error -34
root@DietPi:~#

thank you jappe

desktop indicates Error, no session for pid 845

I don’t know how to copy the entire boot/config in VIM.
it doesn’t copy it till to the end.

my touchscreen doesn’t work even after changing the gpio to 26

Press G then v and then gg and then y.

With G you jump to the end of the document, v enables visual mode (so you can select text), gg jumps to the top (so now you have selected everything) and with y you copy to clipboard.

Or you can just do:

cat /boot/config.txt

and then copy it straight out of the terminal window.

I still think there is a mistake in the config.txt
If you don’t need the mcp2515 remove it from the config, or you need both devices to work in parallel?

Thanks for your help Jappe,

it says 66 lines yanked but I can’t paste it here

I executed cat /boot/config.txt but I can’t paste it here.
I am connected via ssh from my windows laptop to the dietpi.

I need my MCP2515 that is what I am trying to get to work.
I am trying to read my cars CAN OBD2 bus messages to then display the data on a gauge.
My instrument cluster went bust and I thought this way I could have a more modern, versatile and cheaper cluster.
I need SPI working with the MCP2515 and also get the touchscreen to work at the same time.

After execution mark the whole text in your SSH client and copy it? Do you use putty?
Without the info from the config.txt we can not do anything


root@DietPi:/boot# cat /boot/config.txt
# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on
#projects-saspberry.com how to connect raspberry to can
dtoverlay=mcp2515-can0,oscillator=160000000,interrupt=25dtoverlay=spi0-hw-cs

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Additional overlays and parameters are documented
# /boot/firmware/overlays/README

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Automatically load initramfs files, if found
auto_initramfs=1

# Enable DRM VC4 V3D driver
#dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

# Run as fast as firmware / board allows
arm_boost=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[cm5]
dtoverlay=dwc2,dr_mode=host

[all]
hdmi_force_hotplug=1
dtparam=i2c_arm=on
dtparam=spi=on
enable_uart=1
display_rotate=0
max_usb_current=1
config_hdmi_boost=7
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_drive=1
hdmi_cvt 800 480 60 6 0 0 0
dtoverlay=ads7846,cs=1,penirq=26,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
root@DietPi:/boot#

thanks I managed to copy the entire config file now.
yes I am using putty.

root@DietPi:/boot# dmesg | grep -i spi
[    9.536584] mcp251x spi0.0: probe with driver mcp251x failed with error -34
[    9.557887] ads7846 spi0.1: supply vcc not found, using dummy regulator
[    9.561566] ads7846 spi0.1: touchscreen, irq 185
[    9.564365] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/                         spi_master/spi0/spi0.1/input/input0
root@DietPi:/boot#

the MCP2515 is currently not connected. does it have to be for the error to go away?

when I startx then I get the error message on the touchscreen saying “no seesion for pid 1418”
the touchscreen is connected via hdmi cable to the raspberry.

root@DietPi:/boot# find /sys/ -name "spi"
/sys/kernel/tracing/events/spi
/sys/kernel/debug/tracing/events/spi
/sys/bus/spi
/sys/firmware/devicetree/base/__symbols__/spi
/sys/firmware/devicetree/base/__overrides__/spi
root@DietPi:/boot#

Yes, this happens when the overlay is active but the device is not connected, nothing to worry about.

This is an error from x server, not from the touchscreen. The driver is loading correctly and the device is recognized:

ads7846 spi0.1: touchscreen, irq 185
input: ADS7846 Touchscreen ...

What desktop environment did you install? Seems like something is not right with the start of the desktop.

dpkg -l | grep -E 'lxde|xfce|mate|lxqt'

thanks for not giving up on me :flexed_biceps:

ii  libxfce4ui-2-0:arm64                 4.20.1-1                             arm64        widget library for Xfce - Gtk+3 variant
ii  libxfce4ui-common                    4.20.1-1                             all          common files for libxfce4ui
ii  libxfce4util-common                  4.20.1-1                             all          common files for libxfce4util
ii  libxfce4util7:arm64                  4.20.1-1                             arm64        Utility functions library for Xfce4
ii  lxde                                 13.0                                 all          metapackage for LXDE
ii  lxde-common                          0.99.3-1                             all          LXDE common configuration files
ii  lxde-core                            13.0                                 all          metapackage for the LXDE core
ii  lxde-icon-theme                      0.5.2-1                              all          LXDE standard icon theme
ii  openbox-lxde-session                 0.99.3-1                             all          LXDE session manager and configuration files
root@DietPi:~#

Ok to summarize:
You do startx and the desktops loads and then you get the error (desktop indicates Error, no session for pid 845) on the desktop? So the display is working without touch capability?
Or the desktop does not load and you get this error in the terminal?

i start startx and the display shows the desktop which shows each time a differrent pid fault.
A graphical window, I can see the desktop completely showing the logo and software, launcher and config.

no session for pid 9190

it was just now, and it has an “OK” button to aknowledge it but I can’t hit ok because of the non-responding touch screen.

so the pid changes and also the position of the window.

most of the time it is in the center but also sometimes top left corner…

Alright, please check if xserver recognized the touchscreen as an input device: xinput list
if not you probably need to install xserver-xorg-input-evdev (it’s a pretty old thread tho; see: https://forums.raspberrypi.com/viewtopic.php?t=173993#p1131080)

sudo apt install xserver-xorg-input-evdev

then restart xserver.
It will probably also need some calibration, but first let’s get it to run.

root@DietPi:~# startx


X.Org X Server 1.21.1.16
X Protocol Version 11, Revision 0
Current Operating System: Linux DietPi 6.12.47+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64
Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 cgroup_disable=memory snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=800 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:54:D0:A1 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  root=PARTUUID=883791ce-02 rootfstype=ext4 rootwait net.ifnames=0 logo.nologo console=ttyS0,115200 console=tty1
xorg-server 2:21.1.16-1.3+rpt1 (https://www.debian.org/support)
Current version of pixman: 0.44.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Sep 25 14:05:06 2025
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
^Cxinit: connection to X server lost

waiting for X server to shut down .(II) Server terminated successfully (0). Closing log file.

xinit: unexpected signal 2
root@DietPi:~# xinput list
-bash: xinput: command not found
root@DietPi:~# sudo apt install xserver-xorg-input-evdev
xserver-xorg-input-evdev is already the newest version (1:2.11.0-1).
Summary:
  Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 1
root@DietPi:~#

should I go ahead with the rest?

sudo apt-get install xserver-xorg-input-evdev
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
sudo reboot

No, the package is already installed and I don’t know what the cfg is about.

Maybe you can ask the vendor of the touchscreen how to enable the touch abilities on Linux

I was wondering if I had to execute the above?

this is the link to the post of setting up my display
I had a seperate post for the display and the SPI.

https://github.com/goodtft/LCD-show

thank you for pointing me towards the manufacturer.That made me doublecheck and I noticed that I probably had installled the incorrect driver:

LCD-show/LCD5-show at bbd0a9c539f16ba058fb19dda1e71c65c620f81f · goodtft/LCD-show · GitHub

I should probably have installed the retropi?

LCD-show-retropie/LCD5-show at bb18a2ae494b5a59c2f41fb7de8d8feafa128832 · lcdwiki/LCD-show-retropie · GitHub

No, this overrides one config with another on, but they are present in the same directory. Looks illogical to me, but idk why they did this.

No, with this script you would also install some retropi games.

In one of the former posts the command xinput failed bc the package was not isntalled.
Can you intsall and try again

apt install xinput
xinput list

Edit:
in the LCD5 script they also do:

sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf

So this already happened on your system, if you used this script.

This config.txt is from the touchscreen vendor/docs or so? Because it is very different from our default one, including the comments at its top.

There is a dedicated overlay as well as display_auto_detect=1. Not sure whether related, but usually one uses only one of them, depending on whether it works with display_auto_detect=1 alone (which internally tries to select a matching device tree overlay based on detected hardware). The device tree would then setup GPIO and other stuff as needed.

And since the config contains a bunch of legacy settings: Did you check whether it (config and device tree overlay) supports the new RPi kernel stack with Linux 6.6 and 6.12? Much has changed since Raspberry Pi OS Bullseye and the Linux 6.1 kernel and firmware stack it contained.

But touch input and display output might be also well separated.

EDIT: The script LCD-show/LCD5-show at bbd0a9c539f16ba058fb19dda1e71c65c620f81f · goodtft/LCD-show · GitHub ? also enables KMS but in a way that required the setting to be present commented. Not sure whether it can have something to do with touch input, but worth a try:

/boot/dietpi/func/dietpi-set_hardware rpi-opengl vc4-kms-v3d

It does that for RPi Bookworm only with fKMS and RPi 5 only real KMS. But the latter should be used in most cases, since the libraries fKMS benefits from are not part of modern firmware stack anymore.

s

root@DietPi:~# apt install xinput
Installing:
  xinput

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 1
  Download size: 51.8 kB
  Space needed: 114 kB / 55.7 GB available

Get:1 https://deb.debian.org/debian trixie/main arm64 xinput arm64 1.6.4-1+b2 [51.8 kB]
Fetched 51.8 kB in 2s (33.0 kB/s)
Selecting previously unselected package xinput.
(Reading database ... 58654 files and directories currently installed.)
Preparing to unpack .../xinput_1.6.4-1+b2_arm64.deb ...
Unpacking xinput (1.6.4-1+b2) ...
Setting up xinput (1.6.4-1+b2) ...
root@DietPi:~#
root@DietPi:~# xinput list
Unable to connect to X server
root@DietPi:~#
X.Org X Server 1.21.1.16
X Protocol Version 11, Revision 0
Current Operating System: Linux DietPi 6.12.47+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64
Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 cgroup_disable=memory snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=800 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:54:D0:A1 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  root=PARTUUID=883791ce-02 rootfstype=ext4 rootwait net.ifnames=0 logo.nologo console=ttyS0,115200 console=tty1
xorg-server 2:21.1.16-1.3+rpt1 (https://www.debian.org/support)
Current version of pixman: 0.44.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Sat Sep 27 21:22:34 2025
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

@michaing I will look into the other things further when I have more time and get back to you.
Thank you guys so far for your help.

I am still in my testing phase, there is nothing going on on this system, so if you suggest to just start from scratch then we could do that.
But I am testing to find a stable working solution with all equipment working.