Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem using Katapult with a serial connection #125

Closed
mykepredko opened this issue Aug 1, 2024 · 3 comments
Closed

Problem using Katapult with a serial connection #125

mykepredko opened this issue Aug 1, 2024 · 3 comments

Comments

@mykepredko
Copy link

I don't know if you've seen this post on the Klipper Discourse group:

Trying to use Katapult with a serial connection

I've loaded up Katapult on my SKR Mini E3 V3.1 with a serial connection from an Orange Pi Zero 2W but when I try to load Klipper using flashtool.py, I get a strange error that's listed in the link above.

Can you comment? I suspect I'm doing something wrong but I can't find any reference to doing this.

Thanx!

@lktop7
Copy link

lktop7 commented Aug 13, 2024

It seems way too simple but could it be that you selected the wrong processor. Afaik the board exists in two versions, the v3 with the stm32g0b1 and the version v3.0.1 stm32f401. Which version are you using?

@lktop7
Copy link

lktop7 commented Aug 14, 2024

After finding an old STM 32 demo board with an integrated ST-LINK programmer in my magic box as a backup plan, I mustered up the courage to compile and flash Katapult with UART for the STM32G0 version of the board. It worked despite a small pitfall, the klipper host process interfered with the flashing of klipper on the MCU.

Wiring:
Host = Orange Pi Zero 3
MCU = SKR Mini e3 V3
Host:UART5 TX -> MCU: PA10
MCU: PA9 -> Host:UART5 RX
Host:GND -> MCU: GND

cd ../../katapult/
make menuconfig
image
make
-> flash uart deployer with the previous USB Katapult
./scripts/flashtool.py -d /dev/serial/by-id/usb-katapult_stm32g0b1xx_0C004A0014504B5735313920-if00 -v -f out/deployer.bin
/home/[my_username]/katapult/./scripts/flashtool.py:619: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Flashing Serial Device /dev/serial/by-id/usb-katapult_stm32g0b1xx_0C004A0014504B5735313920-if00, baud 250000
Attempting to connect to bootloader
INFO:root:Response for command CONNECT timed out, 4 tries remaining
Katapult Connected
Software Version: v0.0.1-69-g562fc2f
Protocol Version: 1.1.0
Block Size: 64 bytes
Application Start: 0x8002000
MCU type: stm32g0b1xx
Flashing '/home/[my_username]/katapult/out/deployer.bin'...

[INFO:root:Command 'SEND_BLOCK': Acknowledged wrong command, expected: 12, received: 11
##################################################]

Write complete: 3 pages
Verifying (block count = 70)...

[#################################################]

Verification Complete: SHA = 432485BAB7DB5514C8D38E03C8E6B8697255CB7E
Flash Success

-> First try to flash klipper over UART failed
cd ../klipper
../katapult/scripts/flashtool.py -d /dev/ttyS1 -v -f out/klipper.bin
/home/[my_username]/klipper/../katapult/scripts/flashtool.py:619: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Flashing Serial Device /dev/ttyS1, baud 250000
ERROR:root:Flash Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 385, in _reconfigure_port
fcntl.flock(self.fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
BlockingIOError: [Errno 11] Resource temporarily unavailable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/[my_username]/klipper/../katapult/scripts/flashtool.py", line 555, 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 387, in _reconfigure_port
raise SerialException(msg.errno, "Could not exclusively lock port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 11] Could not exclusively lock port /dev/ttyS1: [Errno 11] Resource temporarily unavailable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/[my_username]/klipper/../katapult/scripts/flashtool.py", line 643, in main
loop.run_until_complete(sock.run(args.device, args.baud, fpath))
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/[my_username]/klipper/../katapult/scripts/flashtool.py", line 557, in run
raise FlashError("Unable to open serial port: %s" % (e,))
FlashError: Unable to open serial port: [Errno 11] Could not exclusively lock port /dev/ttyS1: [Errno 11] Resource temporarily unavailable

-> Second try to flash klipper over UART , after stopping the klipper process on the host, was successful
sudo systemctl stop klipper
./katapult/scripts/flashtool.py -d /dev/ttyS1 -v -f out/klipper.bin
/home/[my_username]/klipper/../katapult/scripts/flashtool.py:619: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Flashing Serial Device /dev/ttyS1, baud 250000
Attempting to connect to bootloader
Katapult Connected
Software Version: v0.0.1-69-g562fc2f
Protocol Version: 1.1.0
Block Size: 64 bytes
Application Start: 0x8002000
MCU type: stm32g0b1xx
Flashing '/home/[my_username]/klipper/out/klipper.bin'...

[##################################################]

Write complete: 18 pages
Verifying (block count = 550)...

[##################################################]

Verification Complete: SHA = DF82346A46344D25670267236E6BECB129335FB0
Flash Success

@Arksine
Copy link
Owner

Arksine commented Sep 3, 2024

I'm going to close this as it has been resolved.

@Arksine Arksine closed this as completed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants