Continued Problems connecting Klipper Serially

Basic Information:

Printer Model: N/A
MCU / Printerboard: BTT SKR Mini E3 V3
Host / SBC: Raspberry Pi Zero 2W
klippy.log (39.9 KB)

The saga continues.

So, I have the Mainsail webpage coming up, I am comfortable knowing that the Mini E3 is being programmed with Klipper (as noted elsewhere I am erasing the STM32’s Flash and turning on and off the STATUS LED). I have an oscilloscope hooked up to the RX and TX lines and I see NRZ serial data going back and forth at 250,000 bps.

But I am still getting:

The Klipper Installation process I am following for the Raspberry Pi zero 2W is:

  1. Load an SD Card using the Raspberry Pi Imager with the latest 64bit rPi OS Lite.
  2. sudo apt-get update && sudo apt-get install git -y
  3. git clone https://github.com/dw-0/kiauh.git
  4. ./kiauh/kiauh.sh and install Klipper, Moonraker & Mainsail.
  5. I do @Sineos recommended instruction to make sure Moonraker is installed correcty: ~/moonraker/scripts/install-moonraker.sh
  6. sudo apt install python3-serial - I’m not sure if it’s needed here but I’m doing it as part of the Katapult process
  7. sudo nano /boot/firmware/config.txt and add the lines:
# Free up the good uart
dtoverlay=pi3-disable-bt
  1. sudo nano /boot/firmware/cmdline.txt and remove all “console” references
  2. In printer.cfg I set up [mcu] as:
[mcu]
serial: /dev/ttyAMA0
baud: 250000
restart_method: command
  1. sudo reboot

When the Raspberry Pi comes back up, I ssh in again and check /dev/tty* and dmesg:

biqu@serial-test:~ $ ls /dev -l | grep tty*
crw--w---- 1 root tty       5,   1 Aug  3 16:07 console
crw-rw-rw- 1 root tty       5,   2 Aug  3 16:12 ptmx
lrwxrwxrwx 1 root root           7 Aug  3 16:07 serial0 -> ttyAMA0
crw-rw-rw- 1 root tty       5,   0 Aug  3 16:07 tty
crw--w---- 1 root tty       4,   0 Aug  3 16:07 tty0
crw--w---- 1 root tty       4,   1 Aug  3 16:07 tty1
crw--w---- 1 root tty       4,  10 Aug  3 16:07 tty10
crw--w---- 1 root tty       4,  11 Aug  3 16:07 tty11
crw--w---- 1 root tty       4,  12 Aug  3 16:07 tty12
crw--w---- 1 root tty       4,  13 Aug  3 16:07 tty13
crw--w---- 1 root tty       4,  14 Aug  3 16:07 tty14
crw--w---- 1 root tty       4,  15 Aug  3 16:07 tty15
crw--w---- 1 root tty       4,  16 Aug  3 16:07 tty16
crw--w---- 1 root tty       4,  17 Aug  3 16:07 tty17
crw--w---- 1 root tty       4,  18 Aug  3 16:07 tty18
crw--w---- 1 root tty       4,  19 Aug  3 16:07 tty19
crw--w---- 1 root tty       4,   2 Aug  3 16:07 tty2
crw--w---- 1 root tty       4,  20 Aug  3 16:07 tty20
crw--w---- 1 root tty       4,  21 Aug  3 16:07 tty21
crw--w---- 1 root tty       4,  22 Aug  3 16:07 tty22
crw--w---- 1 root tty       4,  23 Aug  3 16:07 tty23
crw--w---- 1 root tty       4,  24 Aug  3 16:07 tty24
crw--w---- 1 root tty       4,  25 Aug  3 16:07 tty25
crw--w---- 1 root tty       4,  26 Aug  3 16:07 tty26
crw--w---- 1 root tty       4,  27 Aug  3 16:07 tty27
crw--w---- 1 root tty       4,  28 Aug  3 16:07 tty28
crw--w---- 1 root tty       4,  29 Aug  3 16:07 tty29
crw--w---- 1 root tty       4,   3 Aug  3 16:07 tty3
crw--w---- 1 root tty       4,  30 Aug  3 16:07 tty30
crw--w---- 1 root tty       4,  31 Aug  3 16:07 tty31
crw--w---- 1 root tty       4,  32 Aug  3 16:07 tty32
crw--w---- 1 root tty       4,  33 Aug  3 16:07 tty33
crw--w---- 1 root tty       4,  34 Aug  3 16:07 tty34
crw--w---- 1 root tty       4,  35 Aug  3 16:07 tty35
crw--w---- 1 root tty       4,  36 Aug  3 16:07 tty36
crw--w---- 1 root tty       4,  37 Aug  3 16:07 tty37
crw--w---- 1 root tty       4,  38 Aug  3 16:07 tty38
crw--w---- 1 root tty       4,  39 Aug  3 16:07 tty39
crw--w---- 1 root tty       4,   4 Aug  3 16:07 tty4
crw--w---- 1 root tty       4,  40 Aug  3 16:07 tty40
crw--w---- 1 root tty       4,  41 Aug  3 16:07 tty41
crw--w---- 1 root tty       4,  42 Aug  3 16:07 tty42
crw--w---- 1 root tty       4,  43 Aug  3 16:07 tty43
crw--w---- 1 root tty       4,  44 Aug  3 16:07 tty44
crw--w---- 1 root tty       4,  45 Aug  3 16:07 tty45
crw--w---- 1 root tty       4,  46 Aug  3 16:07 tty46
crw--w---- 1 root tty       4,  47 Aug  3 16:07 tty47
crw--w---- 1 root tty       4,  48 Aug  3 16:07 tty48
crw--w---- 1 root tty       4,  49 Aug  3 16:07 tty49
crw--w---- 1 root tty       4,   5 Aug  3 16:07 tty5
crw--w---- 1 root tty       4,  50 Aug  3 16:07 tty50
crw--w---- 1 root tty       4,  51 Aug  3 16:07 tty51
crw--w---- 1 root tty       4,  52 Aug  3 16:07 tty52
crw--w---- 1 root tty       4,  53 Aug  3 16:07 tty53
crw--w---- 1 root tty       4,  54 Aug  3 16:07 tty54
crw--w---- 1 root tty       4,  55 Aug  3 16:07 tty55
crw--w---- 1 root tty       4,  56 Aug  3 16:07 tty56
crw--w---- 1 root tty       4,  57 Aug  3 16:07 tty57
crw--w---- 1 root tty       4,  58 Aug  3 16:07 tty58
crw--w---- 1 root tty       4,  59 Aug  3 16:07 tty59
crw--w---- 1 root tty       4,   6 Aug  3 16:07 tty6
crw--w---- 1 root tty       4,  60 Aug  3 16:07 tty60
crw--w---- 1 root tty       4,  61 Aug  3 16:07 tty61
crw--w---- 1 root tty       4,  62 Aug  3 16:07 tty62
crw--w---- 1 root tty       4,  63 Aug  3 16:07 tty63
crw--w---- 1 root tty       4,   7 Aug  3 16:07 tty7
crw--w---- 1 root tty       4,   8 Aug  3 16:07 tty8
crw--w---- 1 root tty       4,   9 Aug  3 16:07 tty9
crw-rw---- 1 root dialout 204,  64 Aug  3 16:12 ttyAMA0
crw------- 1 root root      5,   3 Aug  3 16:07 ttyprintk
crw-rw---- 1 root dialout   4,  64 Aug  3 16:07 ttyS0
crw-rw---- 1 root tty       7,   0 Aug  3 16:07 vcs
crw-rw---- 1 root tty       7,   1 Aug  3 16:07 vcs1
crw-rw---- 1 root tty       7,   2 Aug  3 16:07 vcs2
crw-rw---- 1 root tty       7,   3 Aug  3 16:07 vcs3
crw-rw---- 1 root tty       7,   4 Aug  3 16:07 vcs4
crw-rw---- 1 root tty       7,   5 Aug  3 16:07 vcs5
crw-rw---- 1 root tty       7,   6 Aug  3 16:07 vcs6
crw-rw---- 1 root tty       7, 128 Aug  3 16:07 vcsa
crw-rw---- 1 root tty       7, 129 Aug  3 16:07 vcsa1
crw-rw---- 1 root tty       7, 130 Aug  3 16:07 vcsa2
crw-rw---- 1 root tty       7, 131 Aug  3 16:07 vcsa3
crw-rw---- 1 root tty       7, 132 Aug  3 16:07 vcsa4
crw-rw---- 1 root tty       7, 133 Aug  3 16:07 vcsa5
crw-rw---- 1 root tty       7, 134 Aug  3 16:07 vcsa6
crw-rw---- 1 root tty       7,  64 Aug  3 16:07 vcsu
crw-rw---- 1 root tty       7,  65 Aug  3 16:07 vcsu1
crw-rw---- 1 root tty       7,  66 Aug  3 16:07 vcsu2
crw-rw---- 1 root tty       7,  67 Aug  3 16:07 vcsu3
crw-rw---- 1 root tty       7,  68 Aug  3 16:07 vcsu4
crw-rw---- 1 root tty       7,  69 Aug  3 16:07 vcsu5
crw-rw---- 1 root tty       7,  70 Aug  3 16:07 vcsu6
biqu@serial-test:~ $ sudo dmesg | grep tty*
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000413] printk: console [tty0] enabled
[    0.004869] RCU Tasks: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1.
[    0.005022] RCU Tasks Rude: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1.
[    0.005182] RCU Tasks Trace: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1.
[    0.069223] raspberrypi-firmware soc:firmware: Attached to firmware from 2024-05-24T15:31:28, variant start
[    0.094517] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    2.542379] Setting default values for core params
[    2.544037] Finished setting default values for core params
[    2.993708] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 99, base_baud = 0) is a PL011 rev2
[    2.997314] printk: console [ttyAMA0] enabled
[    8.198186] systemd[1]: Created slice system-getty.slice - Slice /system/getty.
[    8.256268] systemd[1]: Created slice system-serial\x2dgetty.slice - Slice /system/serial-getty.
[    8.478174] systemd[1]: Expecting device dev-ttyAMA0.device - /dev/ttyAMA0...
biqu@serial-test:~ $

Which I think is good.

But, I am still not connecting and when I look at the (attached) klippy.log, I see:

mcu 'mcu': Starting serial connect
webhooks client 547617607440: New connection
webhooks client 547617607440: Client info {'program': 'Moonraker', 'version': 'v0.9.2-0-gb40751b'}
b'Got error -1 in read: (11)Resource temporarily unavailable'
mcu 'mcu': Timeout on connect
mcu 'mcu': Wait for identify_response
Traceback (most recent call last):
  File "/home/biqu/klipper/klippy/serialhdl.py", line 68, in _get_identify_data
    params = self.send_with_response(msg, 'identify_response')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/biqu/klipper/klippy/serialhdl.py", line 262, in send_with_response
    return src.get_response([cmd], self.default_cmd_queue)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/biqu/klipper/klippy/serialhdl.py", line 319, in get_response
    self.serial.raw_send_wait_ack(cmds[-1], minclock, reqclock,
  File "/home/biqu/klipper/klippy/serialhdl.py", line 254, in raw_send_wait_ack
    self._error("Serial connection closed")
  File "/home/biqu/klipper/klippy/serialhdl.py", line 61, in _error
    raise error(self.warn_prefix + (msg % params))

Any ideas?

This is incredibly frustrating because I was able to set up serial communications three-four days ago using the process above…

To clarify, you have programmed the device with Katapult, then used flashtool to upload Klipper to the MCU? The first thing I would recommend is verifying that the bootloader offset is correct. The bootloader offset when building Klipper needs to match the application offset you chose for Katapult.

Edit: FWIW, make sure you disable the hciuart service:

 sudo systemctl disable hciuart

And also disable the serial console.

1 Like

Thanx for getting back to me - I’m just on my way out the door but I’ll try your suggestions in a few hours.

Correct. I know Katapult/Klipper is running correctly because a) I am turning the status LED on and off in different builds and b) I can see activity on the “TX2” line coming from the board when I’m running Klipper.

Did that.

I’ll. try that.

I thought that’s what happens when I do:

In my process above.

So, I’ll do another image (starting now) and I’ll report back.

I’ll load and install KIAUH and then do:

sudo systemctl disable hciuart

Followed by: https://www.raspberrypi.com/documentation/computers/configuration.html#disabling-the-linux-serial-console

and then check /dev/tty followed by setting the new printer.cfg and see if I get a connection.

If that works, then I’ll redo everything and try Katapult again.

Thanx!

Ok. I guess my general observation is that if the upload using flashtool.py succeeded then the system UART configuration should be correct.

Katapult has a configuration option to toggle the status LED. I’m not aware of any way to make Klipper toggle the status LED, however it can be set on/off using initial pins. When its blinking, that means that Katapult is running and awaiting commands. Generally speaking this only happens in two scenarios:

  1. The user has requested the bootloader (via double reset, command, etc)
  2. Katapult has detected that no application code is present in the application area.

If you go back to the original issue, flashtool.py was not working. Let’s get basic Klipper working on the board again with a serial interface.

I’m using the initial pins option to verify that the firmware has loaded.

[quote=“Arksine, post:4, topic:18066, full:true”]1) The user has requested the bootloader (via double reset, command, etc)
2) Katapult has detected that no application code is present in the application area.
[/quote]

I’m not getting any blinking LEDs. How does Katapult “know” what the status pin is?

Ok. So for more clarification, Katapult is not flashed to the board? Only Klipper? Did you overwrite the old bootloader with the programmer, or just flash klipper using the stock bootloader?

You configure the Status LED in the build.

I’m still trying to get Klipper working - once that happens, I’ll erased the board and go back to Katapult.

I didn’t notice the Status LED before - when did that get added to Katapult (I just checked it on one of my other printers and it says it’s “New”)? It looks like a nice feature.

Success! I have Klipper working on the BTT SKR Mini E3 V3
klippy serial-arksine.log (54.5 KB)

Here’s the process I used to load Klipper:

So, with that going, I’ll go back and restart the Katapult process.

Thanx @Arksine

1 Like

It has been there for a while. The menuconfig tags it as new, I haven’t looked into the mechanism kconfiglib uses to do it. Its very useful when you have a status LED since it gives you a visual indicator that the bootloader is running.

One question on the STATUS LED’s use Katapult; how does it affect its operation in Klipper?

If you look at the attached klippy.log and screen shot, you’ll see that I define the STATUS LED as a tool to check if Klipper is working; the provided slider allows me to set the brightness of the STATUS from Mainsail.

It won’t impact usage in Klipper. One of the unique things Katapult does is reset the MCU prior to jumping to the application, so all registers are reset to their initial state. Even if this weren’t the case, Klipper would reset the pin and reconfigure it based on your settings.

1 Like

BTT PI components
SKR MINI3.0
CAN YOU GUIDE ME IN THE COMMUNICATION OF MY BTT PI AND MY SKR MINI 3.0
Sin título2

I’ve replied to your message.

Let’s see if we can resolve the issue there.

thank you very much from spain

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.