Trying to use Katapult with a serial connection

FWIW, I just performed a build before the patch and after, the md5 is the same. So reflashing Katapult probably won’t change anything. The error shown will be different.

Looking at the latest error, at least it was able to establish a connection. It just appears that it can’t send the binary. I don’t know if it would help to shorten the wiring (if its long), perhaps you could try different baud rates (each would require reconfiguring and reflashing Katapult)

1 Like

Ah shazbot, I forgot to do the updates above when I created the new image.

executed:

git checkout origin/dev-sync-stm32-20240805

Then run:

python3 ~/Katapult/scripts/flashtool.py -d /dev/ttyAMA0 -b 250000

With a slightly different output:

biqu@serial-ttyAMA0:~/Katapult $ python3 ~/Katapult/scripts/flashtool.py -d /dev/ttyS0 -b 250000
ERROR:root:Flash Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 398, in _reconfigure_port
    orig_attr = termios.tcgetattr(self.fd)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/biqu/Katapult/scripts/flashtool.py", line 546, in run
    serial_dev.open()
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 332, in open
    self._reconfigure_port(force_update=True)
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 401, in _reconfigure_port
    raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/biqu/Katapult/scripts/flashtool.py", line 635, in main
    loop.run_until_complete(sock.run(args.device, args.baud, fpath))
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/biqu/Katapult/scripts/flashtool.py", line 548, in run
    raise FlashError("Unable to open serial port: %s" % (e,))
FlashError: Unable to open serial port: Could not configure port: (5, 'Input/output error')
biqu@serial-ttyAMA0:~/Katapult $

Note that the indication that Katapult Connected in the previous version doesn’t come up here.

Actually, when I compare the messages they are significantly different in what’s being reported.

Thoughts?

I’m going to guess that /dev/ttyS0 is not configured or does not exist. Did you mean to run on /dev/ttyAMA0?

Yes I do; as noted above, a number of people indicated that “ttyAMA0” worked better on different aps than “ttyS0”.

Now, I can go back easily to the “ttyS0”, I have the SD card with that image right here and I can swap them out, but I wasn’t getting anywhere with either flashtool or smt32flash.

“ttyAMA0” seems a lot more promising.

Ok. On the run posted above with the termios error /dev/ttyS0 is passed as the device on the commandline. Presumably if you use /dev/ttyAMA0 you won’t get that error.

1 Like

Like this:

biqu@serial-ttyAMA0:~/Katapult $ python3 ~/Katapult/scripts/flashtool.py -d /dev/ttyAMA0 -b 250000
Attempting to connect to bootloader
ERROR:root:Flash Error
Traceback (most recent call last):
  File "/home/biqu/Katapult/scripts/flashtool.py", line 553, in run
    await flasher.connect_btl()
  File "/home/biqu/Katapult/scripts/flashtool.py", line 90, in connect_btl
    ret = await self.send_command('CONNECT')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/biqu/Katapult/scripts/flashtool.py", line 196, in send_command
    raise FlashError("Error sending command [%s] to Device" % (cmdname))
FlashError: Error sending command [CONNECT] to Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/biqu/Katapult/scripts/flashtool.py", line 635, in main
    loop.run_until_complete(sock.run(args.device, args.baud, fpath))
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/biqu/Katapult/scripts/flashtool.py", line 560, in run
    await flasher.finish()
  File "/home/biqu/Katapult/scripts/flashtool.py", line 274, in finish
    await self.send_command("COMPLETE")
  File "/home/biqu/Katapult/scripts/flashtool.py", line 196, in send_command
    raise FlashError("Error sending command [%s] to Device" % (cmdname))
FlashError: Error sending command [COMPLETE] to Device
biqu@serial-ttyAMA0:~/Katapult $

or this:

biqu@serial-ttyAMA0:~/Katapult $ git log --pretty=oneline -3
4c3cca5420411e748d4ee071252e07a7bc53c90a (HEAD, origin/dev-sync-stm32-20240805) stm32: sync low level code with klipper
a3c766ec54208c3b621162006e320ea70e38adfe build: fix build on newer versions of gcc
9750680cdad01482b5ddf2abbef6fd951d1096e3 flashtool: update stale can errors
biqu@serial-ttyAMA0:~/Katapult $

@Arksine and I have taken this off line.

This has reached the point of diminishing returns so I am just going to use a USB connection between the host and main controller board.

Thanx to @Arksine for his patience with me.

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