From 95d06c95e3fd1e83048dde55523ccde606b4f728 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Thu, 14 Apr 2022 15:45:48 -0400 Subject: [PATCH] docs: add CanBoot documentation to bootloaders.md Signed-off-by: Eric Callahan --- docs/Bootloaders.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/Bootloaders.md b/docs/Bootloaders.md index 6933c47b..9020b3ac 100644 --- a/docs/Bootloaders.md +++ b/docs/Bootloaders.md @@ -408,6 +408,44 @@ The bootloader can be activated by pressing the reset button of the board twice. As soon as the bootloader is activated, the board appears as a USB flash drive onto which the klipper.bin file can be copied. +### STM32F103/STM32F0x2 with CanBoot bootloader + +The [CanBoot](https://github.com/Arksine/CanBoot) bootloader provides an option +for uploading Klipper firmware over the CANBUS. The bootloader itself is +derived from Klipper's source code. Currently CanBoot supports the STM32F103, +STM32F042, and STM32F072 models. + +It is recommended to use a ST-Link Programmer to flash CanBoot, however it +should be possible to flash using `stm32flash` on STM32F103 devices, and +`dfu-util` on STM32F042/STM32F072 devices. See the previous sections in this +document for instructions on these flashing methods, substituting `canboot.bin` +for the file name where appropriate. The CanBoot repo linked above provides +instructions for building the bootloader. + +The first time CanBoot has been flashed it should detect that no application +is present and enter the bootloader. If this doesn't occur it is possible to +enter the bootloader by pressing the reset button twice in succession. + +The `flash_can.py` utility supplied in the `lib/canboot` folder may be used to +upload Klipper firmware. The device UUID is necessary to flash. If you do not +have a UUID it is possible to query nodes in currently running the bootloader: +``` +python3 flash_can.py -q +``` +This will return UUIDs for all connected nodes not currently assigned a UUID. +This should include all nodes currently in the bootloader. + +Once you have a UUID, you may upload firmware with following command: +``` +python3 flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u aabbccddeeff +``` + +Where `aabbccddeeff` is replaced by your UUID. Note that the `-i` and `-f` +options may be omitted, they default to `can0` and `~/klipper/out/klipper.bin` +respectively. + +When building Klipper for use with CanBoot, select the 8 KiB Bootloader option. + ## STM32F4 micro-controllers (SKR Pro 1.1) STM32F4 microcontrollers come equipped with a built-in system bootloader