xbst

Untitled

Feb 26th, 2021
4,210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. STM32F103 Klipper Flashing Guide
  2.  
  3. This guide is for flashing the Klipper Firmware to a STM32F103 based mcu.
  4. Some examples of STM32F103 based MCUs:
  5.  
  6. Maple Mini (Clone):
  7. https://s.click.aliexpress.com/e/_AY2erS
  8. https://amzn.to/3dJc721
  9.  
  10. Blue Pill:
  11. https://s.click.aliexpress.com/e/_AaxXRq
  12. https://amzn.to/3qWu2WN
  13.  
  14. My ADXL345 MCU:
  15. https://github.com/xbst/Random-PCBs (Will be live here soon TM)
  16.  
  17. You will need a USB UART programmer. I recommend using a CP2012 programmer, because it is cheap, easy to source, and it works.
  18. Programmer:
  19. https://s.click.aliexpress.com/e/_ATLZwG
  20. https://amzn.to/2O2aLol
  21.  
  22. You will also need some FF dupont cables:
  23. https://s.click.aliexpress.com/e/_9GgrhS
  24. https://amzn.to/3uAZU5E
  25.  
  26. GUIDE
  27.  
  28. 1. Download & install the drivers from: https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers
  29.  
  30. 2. Download & install the flasher from: https://www.st.com/en/development-tools/flasher-stm32.html
  31.  
  32. 3. Download the appropriate bootloader from: https://github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries
  33. !!! Important, download the correct version! For a Maple Mini (& ADXL345 MCU) it is "maple_mini_boot20.bin". For blue pill, you need to use the info here (https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/README.md) to find the correct .bin.
  34.  
  35. 4. Jump the boot pins:
  36. BOOT0 > 3.3V
  37. BOOT1 > GND
  38.  
  39. 5. Wire power from UART programmer
  40. 3V3 > VIN/5V
  41. GND > GND
  42.  
  43. 6. Wire the UART pins:
  44. TX > RX (RX1/A10)
  45. RX > TX (TX1/A9)
  46.  
  47. 7. Plug in the UART programmer to your Windows PC.
  48.  
  49. 8. Launch the Demonstratior GUI (STM32 Flasher Software).
  50.  
  51. 9. Choose the coorect COM port, hit next, and next agian.
  52.  
  53. 10. Make sure the chip detected in this step is correct, hit next again.
  54.  
  55. 11. Choose "Download to device", click "..." to select the bin file. You will need to change the file type from .s19 to .bin in the lower left corner. Chech "Verify after download", and hit next.
  56.  
  57. 12. The bootloader will now be flashed. One it is complete you can exit the program. Unplug the programmer, and remove all wires and jumps from the MCU.
  58.  
  59. 13. Connect the MCU to your Raspbery Pi that's running Klipper. The LED on the PCB should be flashing. If not you likely choose the wrong bootloader, try again.
  60.  
  61. 14. SSH into your Raspberry Pi.
  62.  
  63. 15. Go to the Klipper directory using "cd Klipper".
  64.  
  65. 16. Clean remaining files from previous build "make clean".
  66.  
  67. 17. Choose the options for the build "make menuconfig"
  68. Micro-controller Architecture: STMicroelectronics STM32
  69. Processor Model: STM32F103
  70. Bootloader Offset: 8KiB Bootloader (stm32duino)
  71.  
  72. 18. Build the firmware "make".
  73.  
  74. 19. Verify that the MCU is connected by using "lsusb". There should be a leaf:0003 device connected.
  75. If there is no leaf:0003 but there is a leaf:0004: Sometimes the bootloader runs for only a short period after boot (if it thinks there is already a program, so it boots to it). If you unplug & replug in the mcu, and run the "lsusb" quickly enough, you will see a leaf:0003. If this is the case, you will need to time the next step well.
  76.  
  77. 20. Flash the firmware "dfu-util -d 1eaf:0003 -a 2 -R -D out/klipper.bin".
  78.  
  79. 21. Reset or unplug and replug in the MCU
  80.  
  81. 22. "ls /dev/serial/by-id/*" to find the MCU, copy the path.
  82.  
  83. 23. "sudo nano printer.cfg" to edit the printer.cfg, add the mcu to the file.
Advertisement
Add Comment
Please, Sign In to add comment