alnwlsn's Voron 2.4 3D printer notes and mishaps
2024-04-12 | [3d-printing]
Getting CAN bus toolhead to work at 1000000
I replaced my toolhead PCB with a CAN bus version some time ago (this one, the EBB SB2240_2209 CAN), but it always had some problem with it because despite having a built in accelerometer, it will fail while doing TEST_RESONANCES
with the error "Timer too close". My best guess is that this is what happens when too much data is trying to be sent down the can bus, so I need to up the baud rate so it doesn't pile up.
-
manufacturer seems to recommend 1000000 baud, and I think I was at 500000 before. 3 places need to be updated:
- the toolhead PCB itself, with new klipper firmware
-
the base BTT Octopus (I was using it as the CAN interface to the Pi, took a long time to figure out this needed to be updated too), with new klipper firmware
- if you don't update this, then when you scan for CAN devices, you'll only be able to see ones at the lower baud rate. I kept flashing the toolhead PCB and was really confused why I could only see it when I set the firmware to 500000.
- network interface for CAN configuration in raspberry pi
- also the configuration within the printer - printer.cfg, etc. but you probably knew that already.
firmware update (EBB):
- Refer to klipper's official installation to download klipper source code to host
-
Building the micro-controller
with the configuration shown below.
- [*] Enable extra low-level configuration options
- Micro-controller Architecture =
STMicroelectronics STM32
- Processor model =
STM32G0B1
-
IF USE CanBoot
- Bootloader offset =
8KiB bootloader
-
ELSE
- Bootloader offset =
No bootloader
- Clock Reference =
8 MHz crystal
-
IF USE USB
- Communication interface =
USB (on PA11/PA12)
-
ElSE IF USE CAN bus
- Communication interface =
CAN bus (on PB0/PB1)
- (1000000) CAN bus speed
BTT octopus firmware update
-
similar process, but harder to search for for some reason. Do
make menuconfig
again
- [*] Enable extra low-level configuration options
- Processor model (
STM32F446
)
- Bootloader offset (
No bootloader
)
- Clock Reference (
12 MHz crystal
)
- Communication interface (
USB to CAN bus bridge (USB on PA11/PA12)
)
- CAN bus interface (
CAN bus (on PD0/PD1)
)
- (
1000000
) CAN bus speed
- compiled formware goes to
~/klipper/out/klipper.bin
- I didn't use a bootloader. Most tutorials will have an extra step to install the CanBoot bootloader, which will allow you to update the firmware in the future over the can bus (ie, without taking anything apart), but when that happens I'll probably have forgotten what to do and will have gone back to uploading the firmware in DFU mode over USB instead
-
put device in DFU mode
- BTT octopus has a jumper you set, then press the reset button
- toolhead has a button you hold down, then connect the USB cable (after unplugging the CAN/power plug)
make flash FLASH_DEVICE=0483:df11
will upload the firmware.bin onto the device from the raspberry pi itself. The FLASH_DEVICE is the USB Id from lsusb
- you can also just copy the .bin elsewhere and install dfu-util, then run the command
make flash
runs, which is sudo dfu-util -d ,0483:df11 -R -a 0 -s 0x8000000:leave -D out/klipper.bin
contents of /etc/network/interfaces.d/can0:
allow-hotplug can0
iface can0 can static
bitrate 1000000
up ifconfig $IFACE txqueuelen 1024
- txqueuelen needs to be much higher than the 128 I saw everywhere, because if you set it to that you get "No buffer space available" when trying
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
scan command.
other pitfalls
-
the BTT octopus board does have the 120 ohm CAN terminating resistor (well, 2x 59 ohm).
- when trying to measure the resistor to see if it was there, I forgot that the CAN lines put out voltage, which messed with my voltmeter and made it say 6.6 Meg, suggesting no resistors. Took a while to figure that out, but measuring with power turned off yields the correct 120 ohm measurement.
For what it's worth, after the 1000000 upgrade, the accelerometer does work properly.
comments | Alnwlsn 2024