Serial Connection Over GPIO Pins Won't Function

What is the problem?

I'm trying to run Octoprint using just the Pi's GPIO pins - my build doesn't have much spare space for cables.

The device is a Pi 3B. 5V power coming in from a buck converter is on GPIO 4 and 6, and the serial connection to the printer is on GPIO 8, 10, and 14. The printer runs on a BigTreeTech SKR v1.4 Turbo, and it's connected to the Pi using the middle three pins of its TFT port.

I made the config changes required for serial over GPIO on the Pi, and this setup worked until I changed out the connector on the serial cable. Now, Octoprint does not recognize the GPIO serial connection. It still connects properly over a USB cable, but the case won't accommodate a USB connection on the mainboard.

What did you already try to solve it?

I switched to a fresh set of cables to connect everything. After that, I worried I'd screwed up some config in Octoprint, so I did a clean reinstall. I have checked and triple-checked my cable routing - RX to TX, TX to RX, GND to GND.

Applicable config changes from this Prusa article have been done to make the UART accessible for serial and disable the serial console.

This is the Pi's output when ls -l /dev is run:

pi@octopi:~ $ ls -l /dev
total 0
crw-r--r-- 1 root root     10, 235 Apr  3 23:17 autofs
drwxr-xr-x 2 root root         580 Apr  3 23:17 block
crw------- 1 root root     10, 234 Apr  3 23:17 btrfs-control
drwxr-xr-x 3 root root          60 Jan  1  1970 bus
crw------- 1 root root     10,  63 Apr  3 23:17 cachefiles
drwxr-xr-x 2 root root        2700 Apr  3 23:17 char
crw------- 1 root root      5,   1 Apr  4 00:43 console
crw------- 1 root root     10,  62 Apr  3 23:17 cpu_dma_latency
crw------- 1 root root     10, 203 Apr  3 23:17 cuse
drwxr-xr-x 7 root root         140 Apr  3 23:17 disk
crw-rw---- 1 root video    29,   0 Apr  3 23:17 fb0
lrwxrwxrwx 1 root root          13 Feb 14  2019 fd -> /proc/self/fd
crw-rw-rw- 1 root root      1,   7 Apr  3 23:17 full
crw-rw-rw- 1 root root     10, 229 Apr  3 23:17 fuse
crw-rw---- 1 root gpio    254,   0 Apr  3 23:17 gpiochip0
crw-rw---- 1 root gpio    254,   1 Apr  3 23:17 gpiochip1
crw-rw---- 1 root gpio    254,   2 Apr  3 23:17 gpiochip2
crw-rw---- 1 root gpio    247,   0 Apr  3 23:17 gpiomem
crw------- 1 root root     10, 183 Apr  3 23:17 hwrng
lrwxrwxrwx 1 root root          12 Feb 14  2019 initctl -> /run/initctl
drwxr-xr-x 2 root root          60 Jan  1  1970 input
crw-r--r-- 1 root root      1,  11 Apr  3 23:17 kmsg
lrwxrwxrwx 1 root root          28 Feb 14  2019 log -> /run/systemd/journal/dev-log
brw-rw---- 1 root disk      7,   0 Apr  3 23:17 loop0
brw-rw---- 1 root disk      7,   1 Apr  3 23:17 loop1
brw-rw---- 1 root disk      7,   2 Apr  3 23:17 loop2
brw-rw---- 1 root disk      7,   3 Apr  3 23:17 loop3
brw-rw---- 1 root disk      7,   4 Apr  3 23:17 loop4
brw-rw---- 1 root disk      7,   5 Apr  3 23:17 loop5
brw-rw---- 1 root disk      7,   6 Apr  3 23:17 loop6
brw-rw---- 1 root disk      7,   7 Apr  3 23:17 loop7
crw-rw---- 1 root disk     10, 237 Apr  3 23:17 loop-control
drwxr-xr-x 2 root root          60 Apr  3 23:17 mapper
crw-rw---- 1 root video   241,   0 Apr  3 23:17 media0
crw-r----- 1 root kmem      1,   1 Apr  3 23:17 mem
crw------- 1 root root     10,  59 Apr  3 23:17 memory_bandwidth
brw-rw---- 1 root disk    179,   0 Apr  3 23:17 mmcblk0
brw-rw---- 1 root disk    179,   1 Apr  3 23:17 mmcblk0p1
brw-rw---- 1 root disk    179,   2 Apr  3 23:17 mmcblk0p2
drwxrwxrwt 2 root root          40 Jan  1  1970 mqueue
drwxr-xr-x 2 root root          60 Apr  3 23:17 net
crw------- 1 root root     10,  61 Apr  3 23:17 network_latency
crw------- 1 root root     10,  60 Apr  3 23:17 network_throughput
crw-rw-rw- 1 root root      1,   3 Apr  3 23:17 null
crw------- 1 root root    108,   0 Apr  3 23:17 ppp
crw-rw-rw- 1 root tty       5,   2 Apr  4  2021 ptmx
drwxr-xr-x 2 root root           0 Feb 14  2019 pts
brw-rw---- 1 root disk      1,   0 Apr  3 23:17 ram0
brw-rw---- 1 root disk      1,   1 Apr  3 23:17 ram1
brw-rw---- 1 root disk      1,  10 Apr  3 23:17 ram10
brw-rw---- 1 root disk      1,  11 Apr  3 23:17 ram11
brw-rw---- 1 root disk      1,  12 Apr  3 23:17 ram12
brw-rw---- 1 root disk      1,  13 Apr  3 23:17 ram13
brw-rw---- 1 root disk      1,  14 Apr  3 23:17 ram14
brw-rw---- 1 root disk      1,  15 Apr  3 23:17 ram15
brw-rw---- 1 root disk      1,   2 Apr  3 23:17 ram2
brw-rw---- 1 root disk      1,   3 Apr  3 23:17 ram3
brw-rw---- 1 root disk      1,   4 Apr  3 23:17 ram4
brw-rw---- 1 root disk      1,   5 Apr  3 23:17 ram5
brw-rw---- 1 root disk      1,   6 Apr  3 23:17 ram6
brw-rw---- 1 root disk      1,   7 Apr  3 23:17 ram7
brw-rw---- 1 root disk      1,   8 Apr  3 23:17 ram8
brw-rw---- 1 root disk      1,   9 Apr  3 23:17 ram9
crw-rw-rw- 1 root root      1,   8 Apr  3 23:17 random
drwxr-xr-x 2 root root          60 Jan  1  1970 raw
crw-rw-r-- 1 root netdev   10,  57 Apr  3 23:17 rfkill
lrwxrwxrwx 1 root root           7 Apr  3 23:17 serial0 -> ttyAMA0
lrwxrwxrwx 1 root root           5 Apr  3 23:17 serial1 -> ttyS0
drwxrwxrwt 2 root root          40 Feb 14  2019 shm
drwxr-xr-x 3 root root         180 Apr  3 23:17 snd
lrwxrwxrwx 1 root root          15 Feb 14  2019 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root          15 Feb 14  2019 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root          15 Feb 14  2019 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty       5,   0 Apr  3 23:17 tty
crw--w---- 1 root tty       4,   0 Apr  3 23:17 tty0
crw--w---- 1 root tty       4,   1 Apr  4 00:42 tty1
crw--w---- 1 root tty       4,  10 Apr  3 23:17 tty10
crw--w---- 1 root tty       4,  11 Apr  3 23:17 tty11
crw--w---- 1 root tty       4,  12 Apr  3 23:17 tty12
crw--w---- 1 root tty       4,  13 Apr  3 23:17 tty13
crw--w---- 1 root tty       4,  14 Apr  3 23:17 tty14
crw--w---- 1 root tty       4,  15 Apr  3 23:17 tty15
crw--w---- 1 root tty       4,  16 Apr  3 23:17 tty16
crw--w---- 1 root tty       4,  17 Apr  3 23:17 tty17
crw--w---- 1 root tty       4,  18 Apr  3 23:17 tty18
crw--w---- 1 root tty       4,  19 Apr  3 23:17 tty19
crw--w---- 1 root tty       4,   2 Apr  3 23:17 tty2
crw--w---- 1 root tty       4,  20 Apr  3 23:17 tty20
crw--w---- 1 root tty       4,  21 Apr  3 23:17 tty21
crw--w---- 1 root tty       4,  22 Apr  3 23:17 tty22
crw--w---- 1 root tty       4,  23 Apr  3 23:17 tty23
crw--w---- 1 root tty       4,  24 Apr  3 23:17 tty24
crw--w---- 1 root tty       4,  25 Apr  3 23:17 tty25
crw--w---- 1 root tty       4,  26 Apr  3 23:17 tty26
crw--w---- 1 root tty       4,  27 Apr  3 23:17 tty27
crw--w---- 1 root tty       4,  28 Apr  3 23:17 tty28
crw--w---- 1 root tty       4,  29 Apr  3 23:17 tty29
crw--w---- 1 root tty       4,   3 Apr  3 23:17 tty3
crw--w---- 1 root tty       4,  30 Apr  3 23:17 tty30
crw--w---- 1 root tty       4,  31 Apr  3 23:17 tty31
crw--w---- 1 root tty       4,  32 Apr  3 23:17 tty32
crw--w---- 1 root tty       4,  33 Apr  3 23:17 tty33
crw--w---- 1 root tty       4,  34 Apr  3 23:17 tty34
crw--w---- 1 root tty       4,  35 Apr  3 23:17 tty35
crw--w---- 1 root tty       4,  36 Apr  3 23:17 tty36
crw--w---- 1 root tty       4,  37 Apr  3 23:17 tty37
crw--w---- 1 root tty       4,  38 Apr  3 23:17 tty38
crw--w---- 1 root tty       4,  39 Apr  3 23:17 tty39
crw--w---- 1 root tty       4,   4 Apr  3 23:17 tty4
crw--w---- 1 root tty       4,  40 Apr  3 23:17 tty40
crw--w---- 1 root tty       4,  41 Apr  3 23:17 tty41
crw--w---- 1 root tty       4,  42 Apr  3 23:17 tty42
crw--w---- 1 root tty       4,  43 Apr  3 23:17 tty43
crw--w---- 1 root tty       4,  44 Apr  3 23:17 tty44
crw--w---- 1 root tty       4,  45 Apr  3 23:17 tty45
crw--w---- 1 root tty       4,  46 Apr  3 23:17 tty46
crw--w---- 1 root tty       4,  47 Apr  3 23:17 tty47
crw--w---- 1 root tty       4,  48 Apr  3 23:17 tty48
crw--w---- 1 root tty       4,  49 Apr  3 23:17 tty49
crw--w---- 1 root tty       4,   5 Apr  3 23:17 tty5
crw--w---- 1 root tty       4,  50 Apr  3 23:17 tty50
crw--w---- 1 root tty       4,  51 Apr  3 23:17 tty51
crw--w---- 1 root tty       4,  52 Apr  3 23:17 tty52
crw--w---- 1 root tty       4,  53 Apr  3 23:17 tty53
crw--w---- 1 root tty       4,  54 Apr  3 23:17 tty54
crw--w---- 1 root tty       4,  55 Apr  3 23:17 tty55
crw--w---- 1 root tty       4,  56 Apr  3 23:17 tty56
crw--w---- 1 root tty       4,  57 Apr  3 23:17 tty57
crw--w---- 1 root tty       4,  58 Apr  3 23:17 tty58
crw--w---- 1 root tty       4,  59 Apr  3 23:17 tty59
crw--w---- 1 root tty       4,   6 Apr  3 23:17 tty6
crw--w---- 1 root tty       4,  60 Apr  3 23:17 tty60
crw--w---- 1 root tty       4,  61 Apr  3 23:17 tty61
crw--w---- 1 root tty       4,  62 Apr  3 23:17 tty62
crw--w---- 1 root tty       4,  63 Apr  3 23:17 tty63
crw--w---- 1 root tty       4,   7 Apr  3 23:17 tty7
crw--w---- 1 root tty       4,   8 Apr  3 23:17 tty8
crw--w---- 1 root tty       4,   9 Apr  3 23:17 tty9
crw-rw---- 1 root dialout 204,  64 Apr  4 02:44 ttyAMA0
crw------- 1 root root      5,   3 Apr  3 23:17 ttyprintk
crw-rw---- 1 root dialout   4,  64 Apr  4 02:45 ttyS0
crw------- 1 root root     10, 239 Apr  3 23:17 uhid
crw------- 1 root root     10, 223 Apr  3 23:17 uinput
crw-rw-rw- 1 root root      1,   9 Apr  3 23:17 urandom
drwxr-xr-x 3 root root          60 Apr  3 23:17 v4l
crw-rw---- 1 root video   243,   0 Apr  3 23:17 vchiq
crw-rw---- 1 root video   248,   0 Apr  3 23:17 vcio
crw------- 1 root root    249,   0 Apr  3 23:17 vc-mem
crw-rw---- 1 root tty       7,   0 Apr  3 23:17 vcs
crw-rw---- 1 root tty       7,   1 Apr  3 23:17 vcs1
crw-rw---- 1 root tty       7,   2 Apr  3 23:17 vcs2
crw-rw---- 1 root tty       7,   3 Apr  3 23:17 vcs3
crw-rw---- 1 root tty       7,   4 Apr  3 23:17 vcs4
crw-rw---- 1 root tty       7,   5 Apr  3 23:17 vcs5
crw-rw---- 1 root tty       7,   6 Apr  3 23:17 vcs6
crw-rw---- 1 root tty       7, 128 Apr  3 23:17 vcsa
crw-rw---- 1 root tty       7, 129 Apr  3 23:17 vcsa1
crw-rw---- 1 root tty       7, 130 Apr  3 23:17 vcsa2
crw-rw---- 1 root tty       7, 131 Apr  3 23:17 vcsa3
crw-rw---- 1 root tty       7, 132 Apr  3 23:17 vcsa4
crw-rw---- 1 root tty       7, 133 Apr  3 23:17 vcsa5
crw-rw---- 1 root tty       7, 134 Apr  3 23:17 vcsa6
crw-rw---- 1 root video   244,   0 Apr  3 23:17 vcsm
crw-rw-rw- 1 root root     10,  58 Apr  3 23:17 vcsm-cma
crw-rw---- 1 root tty       7,  64 Apr  3 23:17 vcsu
crw-rw---- 1 root tty       7,  65 Apr  3 23:17 vcsu1
crw-rw---- 1 root tty       7,  66 Apr  3 23:17 vcsu2
crw-rw---- 1 root tty       7,  67 Apr  3 23:17 vcsu3
crw-rw---- 1 root tty       7,  68 Apr  3 23:17 vcsu4
crw-rw---- 1 root tty       7,  69 Apr  3 23:17 vcsu5
crw-rw---- 1 root tty       7,  70 Apr  3 23:17 vcsu6
crw------- 1 root root     10, 137 Apr  3 23:17 vhci
crw-rw---- 1 root video    81,   0 Apr  3 23:17 video10
crw-rw---- 1 root video    81,   1 Apr  3 23:17 video11
crw-rw---- 1 root video    81,   2 Apr  3 23:17 video12
crw------- 1 root root     10, 130 Apr  3 23:17 watchdog
crw------- 1 root root    251,   0 Apr  3 23:17 watchdog0
crw-rw-rw- 1 root root      1,   5 Apr  3 23:17 zero

This is what dmesg displays when the SKR board is connected via USB:

[  782.045546] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[  782.179166] usb 1-1.2: New USB device found, idVendor=1d50, idProduct=6029, bcdDevice= 1.00
[  782.179181] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  782.179191] usb 1-1.2: Product: Marlin USB Device
[  782.179200] usb 1-1.2: Manufacturer: marlinfw.org
[  782.179210] usb 1-1.2: SerialNumber: 19005005AF6A84A95E5501FBF50020C7
[  782.180808] usb-storage 1-1.2:1.2: USB Mass Storage device detected
[  782.189370] scsi host0: usb-storage 1-1.2:1.2
[  782.238245] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
[  782.239296] usbcore: registered new interface driver uas
[  782.239310] usbcore: registered new interface driver cdc_acm
[  782.239318] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[  783.258110] scsi 0:0:0:0: Direct-Access     Marlin   SDCard 01        1.0  PQ: 0 ANSI: 0 CCS
[  783.280844] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  783.316493] sd 0:0:0:0: [sda] Attached SCSI removable disk

Nothing is added to the output of dmesg when the printer is connected via GPIO.

The USB connection shows as /dev/ACM0 on Octoprint. Octoprint has access to /dev/ttyACM*, /dev/ttyAMA*, /dev/ttyS*, and /dev/serial*. When it was working properly, it only had /dev/ttyAMA0, but I added the others in an effort to get it connecting.

I'd appreciate any help you folks can give - I've been all over 3D printing Discords with no luck.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, what kind of hardware precisely, ...)

Raspberry Pi 3B running Octoprint v. 1.5.3
SKR v 1.4 T running Marlin v. 2.0.7.2
Modified Ender 5 Pro

Don't know all the etiquette here, but I'm hoping this "bump" doesn't count as spam or similar.

how is UART configured on the firmware end?

All I've changed in Marlin config is serial port numbers. I don't think I've done any speficic UART configuration on the Marlin end. Is there a specific config file I should check?

So what do you have defined for

#define SERIAL_PORT
#define SERIAL_PORT2

?

You can also manually test serial on the Pi by connecting TX to RX which will effectively be a loopback. Once done use something like minicom.

Some helpful info here: pi 3 - How do I make serial work on the Raspberry Pi3 (or later model) - Raspberry Pi Stack Exchange

#define SERIAL_PORT 1
#define SERIAL_PORT_2 0
#define BAUDRATE 115200

Those are the serial config lines in Marlin.

I installed minicom, looped the Pi's serial pins, and ran sudo minicom -D /dev/ttyAMA0 and the key inputs don't show up onscreen. Is this an indicator of a hardware problem, that I've somehow fried my Pi's serial pins? Or do I just have the UART configured incorrectly somehow?

This is the first I've been able to narrow the problem down, so thanks already.

Can you post the entire /boot/cmdline.txt and /boot/config.txt?

I can't see why anything would get fried from a cable change unless that cable or device it was connected to was using 5V instead of 3.3V

All of /boot/config.txt:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

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

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

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
# enable raspicam
start_x=1
gpu_mem=128
dtoverlay=pi3-disable-bt
enable_uart=1

And the entirety of /boot/cmdline.txt:

console=tty1 root=PARTUUID=6c586e13-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

The only thing that I've done other than the cables is, after the problem started, using a multimeter in resistance mode to test continuity between the pins on either end of each lead to make sure my crimping held up. Power was off, of course, and the machine was unplugged.

Just wanted to chime back in to say I found the solution (sort of) to my problem. I was messing with the Pi and got a bit of a tingle out of it, so I took a multimeter to the metal housing on the USB ports and it was charged to 5 volts. I purchased a Pi 4 and used it as a drop-in replacement - worked first try.

Seems like there was a hardware issue with my 3B that was causing some gremlins. Thanks for all your help!

Whoops sorry I missed the last reply. Glad you got it sorted tho.