How to enter into bootloader with serial connected MCU

Thanks, but you don’t need to do that. I know every little button on this PCB :slight_smile: They are not available while printer is assembled.

1 Like

Extension to the outside?

I’ve never used this option - is the MCU pin continually monitored by Katapult and, if it is, how is that done? Or does it require a power up/reset condition?

Also, I think you told me at one point that Katapult was only meant to be used when you are using Klipper in CAN (although USB and Serial are also options now) bridge mode. Is this correct?

1 Like

It checks the configured pin on boot. If its high (or low if inverted) then Katapult will enter flash mode. This requires a reset.

There was probably a miscommunication there. Katapult can be used with Klipper in any configuration. Generally speaking the Katapult build will be configured to match the Klipper build. CAN bridge mode is a bit unique as there is no matching Katapult configuration, instead it would be configured to use USB.

2 Likes

As I understood right then I can follow the next steps to flash my printer without an issues and needs to dissemble it.
Current bootloader offset is 32 KiB. There is no such option in menuconfig of Katapult, but I added it.

  1. Build Katapult deployer with 32 KiB setting for application and 32 KiB for bootloader offset. These settings will save me of losing control of the printer. As success I will have started klipper.
  2. Build Katapult deployer with 32 KiB application offset and 8KiB bootloader offset (this is only to change bootloader offset to 8 KiB as it is default for Katapult for this chip).
  3. Send command to klipper for entering in bootloader.
  4. Flash deployer through flashtool.py. Deployer will rewrite Katapult itself and new application offset become 8 KiB. After finishing it should stay in bootloader as I understood.
  5. Build new klipper firmware with 8KiB application offset and flash it with flashtool.py.

I checked this steps on development board. Looks like it is working.
The main thing I have not to do - restarting printer after deployer with 8 kib offset was flashed. Otherwise it will starts something and I loose the control.

After the deployer finishes flashing Katapult it should immediately set the magic key and reset the MCU, which should start Katapult in flash mode. If you reset again after that you will may trouble.

So the general steps for using the deployer should be:

  1. Bulild Katapult with 32KiB deployer offset and 8 KiB application offset
  2. Upload the deployer with stock bootloader. Device should be connected via USB, serial, or CAN (depending on config) so Katapult can start immediately after the upload is complete.
  3. Use flashtool.py to upload Klipper

With regard to step 2, if you are using the stock bootloader to upload the deployer on a bench (ie: not connected to USB, etc) then you will need to use your method with the extra flashing step, or you will need to use a method to manually enter the bootloader such as the double reset.

Thanks a lot @Arksine.
Everything worked as you said. I flashed the bootloader from the SD card using the Katapult deployer. To confirm that the bootloader was loaded, I set up the beeper pin as Status LED GPIO pin. After flashing, the printer beeped. Then I flashed the deployer again to adjust the offset, and after that, I flashed Klipper.
And yes I don’t need to flash deployer twice, but I read your answer little bit later :slight_smile:

Thank you all for your help. @Arksine I created a PR with changes for flashtool.py, and I hope they will be useful to someone if they are accepted.