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

MIPS support for flash_can.py? #137

Open
pellcorp opened this issue Nov 28, 2024 · 3 comments
Open

MIPS support for flash_can.py? #137

pellcorp opened this issue Nov 28, 2024 · 3 comments

Comments

@pellcorp
Copy link

pellcorp commented Nov 28, 2024

So I am using a cartographer on a K1, and so far we have never managed to figure out how to flash the cartographer on the K1. I suspect something needs to change in serialposix.py but I am unsure where to start looking.

So I know that Creality actually patched serialposix.py for the K1 build root already, and I am wondering if what they changed might provide some guidance?

image

I would appreciate any suggestions you might have, because this is what I am getting at the moment and its now locked up:

root@K1-0753 /usr/data/klipper/scripts [#] /usr/share/klippy-env/bin/python /usr/data/katapult/scripts/flash_can.py -f /usr/data/cartographer-klipper/firmware/v2-v3/survey/5.0.0/Survey_Cartographer_K1_USB
_8kib_offset.bin -d $CATAPULT_DEV -v
Flashing Serial Device /dev/serial/by-id/usb-katapult_stm32f042x6_16000C000F43304253373820-if00, baud 250000
Attempting to connect to bootloader
INFO:root:Response for command CONNECT timed out, 4 tries remaining
INFO:root:Response for command CONNECT timed out, 3 tries remaining
INFO:root:Response for command CONNECT timed out, 2 tries remaining
INFO:root:Response for command CONNECT timed out, 1 tries remaining
INFO:root:Response for command CONNECT timed out, 0 tries remaining
INFO:root:Response for command COMPLETE timed out, 4 tries remaining
INFO:root:Response for command COMPLETE timed out, 3 tries remaining
INFO:root:Response for command COMPLETE timed out, 2 tries remaining
INFO:root:Response for command COMPLETE timed out, 1 tries remaining
@pellcorp
Copy link
Author

When I finally cancelled the flash, I got this stack trace:

root@K1-0753 /usr/data/klipper/scripts [#] /usr/share/klippy-env/bin/python /usr/data/katapult/scripts/flash_can.py -f /usr/data/cartographer-klipper/firmware/v2-v3/survey/5.0.0/Survey_Cartographer_K1_USB
_8kib_offset.bin -d $CATAPULT_DEV -v
Flashing Serial Device /dev/serial/by-id/usb-katapult_stm32f042x6_16000C000F43304253373820-if00, baud 250000
Attempting to connect to bootloader
INFO:root:Response for command CONNECT timed out, 4 tries remaining
INFO:root:Response for command CONNECT timed out, 3 tries remaining
INFO:root:Response for command CONNECT timed out, 2 tries remaining
INFO:root:Response for command CONNECT timed out, 1 tries remaining
INFO:root:Response for command CONNECT timed out, 0 tries remaining
INFO:root:Response for command COMPLETE timed out, 4 tries remaining
INFO:root:Response for command COMPLETE timed out, 3 tries remaining
INFO:root:Response for command COMPLETE timed out, 2 tries remaining
INFO:root:Response for command COMPLETE timed out, 1 tries remaining
^CTraceback (most recent call last):
  File "/usr/data/katapult/scripts/flash_can.py", line 624, in run
    await flasher.connect_btl()
  File "/usr/data/katapult/scripts/flash_can.py", line 99, in connect_btl
    ret = await self.send_command('CONNECT')
  File "/usr/data/katapult/scripts/flash_can.py", line 216, in send_command
    raise FlashError("Error sending command [%s] to Device" % (cmdname))
__main__.FlashError: Error sending command [CONNECT] to Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/data/katapult/scripts/flash_can.py", line 729, in <module>
    exit(asyncio.run(main(args)))
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
    handle._run()
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/data/katapult/scripts/flash_can.py", line 678, in main
    await sock.run(args.device, args.baud, fpath)
  File "/usr/data/katapult/scripts/flash_can.py", line 631, in run
    await flasher.finish()
  File "/usr/data/katapult/scripts/flash_can.py", line 295, in finish
    await self.send_command("COMPLETE")
  File "/usr/data/katapult/scripts/flash_can.py", line 154, in send_command
    self.node.write(out_cmd)
  File "/usr/data/katapult/scripts/flash_can.py", line 322, in write
    self._cansocket.send(self.node_id, payload)
  File "/usr/data/katapult/scripts/flash_can.py", line 550, in send
    self.serial.write(payload)
  File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 556, in write
    abort, ready, _ = select.select([self.pipe_abort_write_r], [self.fd], [], None)
KeyboardInterrupt

@pellcorp
Copy link
Author

Oh and cancelling corrupted katapult boot loader and I had to use DFU to reflash.

@pellcorp
Copy link
Author

This is the commit creality back ported in a creality way

pyserial/pyserial@5ce1773

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

1 participant