From f42f6c50908ebb921c6457b8a74b7aa55bd8a5c6 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Wed, 13 Apr 2022 19:30:07 -0400 Subject: [PATCH] readme: update can docs Signed-off-by: Eric Callahan --- README.md | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index afbd53e..3bf19a1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [Klipper](https://github.com/KevinOConnor/klipper). The bootloader itself makes use of Klipper's hardware abstraction layer, stripped down to keep the footprint minimal. Currently the bootloader - reserves 8 KiB of space, however it occupies less than 4 KiB. + reserves 8 KiB of space. ## Building @@ -20,46 +20,39 @@ make ``` The menuconfig will present the following options: -- `Processor model`: Currently only STM32F203 is supported +- `Processor model`: Currently only STM32F103 is supported +- `Disable SWD at startup`: This is an option for GigaDevice STM32F103 + clones. Note that these untested on this bootloader. This option only + present for "STM32F103" models, - `Clock Reference`: Choose the appropriate setting for your board's crystal +- `CAN pins`: Allows the user to choose which pins are wired to CAN. - `Flash Page Size`: The STM32F103 comes in multiple variants. The low density models have a 1 KiB page size, others a 2KiB page size. Choose - the appropriate selection for your model -- `CAN bus speed`: Select the appropriate speed for your setup -- `Enable Status Led`: If enabled, the option to set the Status LED Pin is - made available + the appropriate selection for your model. This option only present for + "STM32F103" models, +- `CAN bus speed`: Select the appropriate speed for your canbus. +- `Enable Status Led`: Enables the option to select a status LED gpio. - `Status LED GPIO Pin`: The pin name for your LED. The Pin can be inverted if the LED is on when the pin is low. For example, the status LED Pin for a "blue pill" is !PC13. -Once configured and built flash with a programmer such as an ST-Link +Once configured and built flash with a programmer such as an ST-Link. ## Uploading a Program - -1) Make sure [CanSerial](https://github.com/bondus/CanSerial) is installed and - enabled. Alternatively one can use the `pycanserial.py` script in this repo, - however it requries Python 3.7+. It also lacks the "reset" feature of - CanSerial, so for the moment I recommend using C version linked. +1) Build Klipper with CAN support and with the "8KiB" bootloader setting enabled. 2) Enter the bootloader. This may be accomplished through "double tapping" the Reset button. The second reset should be within 1.5 seconds of the first. If the Status LED is set it will blink every second when the device has - entered the bootloader. The bootloader should connect to CanSerial, and - CanSerial should create a PTY for it in the `/tmp` directory. -3) Build Klipper with CAN support and with the "8KiB" bootloader setting enabled. -4) Run the flash script: + entered the bootloader. A future patch to Klipper should make it possible + for `flash_can.py` to direct the device to enter the bootloader. +3) Run the flash script: ``` cd ~/CanBoot - ~/klippy-env/bin/python flash_can.py /tmp/ttyCANxxxxxxxx ~/klipper/out/klipper.bin + python3 flash_can.py -i can0 -f ~/klipper/out/klipper.bin ``` - Replace `/tmp/CANxxxxxxxx` with the appropriate symlink for your device. + Replace with the appropriate uuid for your can device. ## Notes -- This is preview code and will almost certainly change. Specifically, it is - anticipated that the flash_can script will not use CanSerial in the future, - but instead connect directly to the CAN socket and issue commands to the - bootloader. Likewise it is expected that it will be possible to enter the - booltoader via command from Klipper. The IDs used to communicate with the - bootloader may also change (0x321, 0x322, 0x323). - If using a MCP2515 Can Device it is likely that packets will be dropped when reading flash back from the node during the verification process. Reducing SPI speed may help with this, in my testing the process could not complete