Skip to content

Instantly share code, notes, and snippets.

@jfryman
Last active January 5, 2024 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfryman/0c3827079e23d7bc55f9677d2c6b8bec to your computer and use it in GitHub Desktop.
Save jfryman/0c3827079e23d7bc55f9677d2c6b8bec to your computer and use it in GitHub Desktop.
Setting up EBB36 + U2C on Klipper for Voron

Here's what's worked for me. As always, YMMV.

Writing this down for my own history just as much as it might help someone else. I've done two nine machines so far this way. Hope this helps someone!

  • Hardware used: EBB36 v1.1 + U2C v1.2
  • CAN wiring: Get FEP Wire. Used to recommend 18 Gauge for Power, reclaimed twisted pair from CAT-5 or CAT-6 cable for CAN-H, CAN-L, but I've also received failures eventually from my CAT-6 cable. It's not rated for the movement. Get better cables.

Ensure wiring is setup properly.

Easy way to remember: Ensure power is correctly wired on each end (it's different) and then pair CAN-L with GROUND below, and CAN-H with 24V below in each of the connectors. Image references below.

Plug in the EBB36 and U2C together. Double check continuity on each end and each wire before going further. Keep the cable plugged in for now

Add 120R resistors to each board.

Should be labeled on the silk screen.

  • Check to ensure resistance is 60 OHM on CAN-L and CAN-H lines on either end before moving on any further.
  • Once validated, unplug the harness you built.

Add 24V power and Ground to terminal connectors from PSU

The EBB36 draws 24v, and won't get this from only the USB connection. Wire this thing up to your PSU - best to use proper crimping and everything here.

Put U2C into DFU mode by holding down the boot0 button and plugging into your Raspberry Pi.

Check to ensure the node is in dfu mode with the following command:

dfu-util -l

If it's in DFU mode, you'll see a device. If not, you'll most likely get an error. Try again until you get this correct. Flash U2C with firmware from https://github.com/lab4450/u2c.

git clone https://github.com/lab4450/u2c
cd u2c
dfu-util -a 0 -D U2C_V2_STM32G0B1.bin -s 0x08000000:mass-erase:force

I tried compiling candlelight so many times, and for one reason or another it kept failing. I am determined to crack this nut eventually, but for those of you just looking for a solution this works.

Ensure can0 interface setup on your OS

sudo nano /etc/network/interfaces.d/can0
allow-hotplug can0
iface can0 can static
 bitrate 500000
 up ifconfig $IFACE txqueuelen 1024
 pre-up ip link set can0 type can bitrate 500000
 pre-up ip link set can0 txqueuelen 1024

Unplug and re-plugin your U2C and validate that the can0 interface is up and running

ifconfig can0

Should look something like this:

can0: flags=193<UP,RUNNING,NOARP>  mtu 16
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1024  (UNSPEC)
        RX packets 0  bytes 0 (0.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Setup canboot on your ebb36.

Ensure EBB36 has a jumper on the USB power jumper (closest to the actual USB port) and hold down the boot0 button to put in DFU mode. Check again to see if it's in DFU mode with:

dfu-util -l

Download the canboot repo:

cd ~/
git clone https://github.com/Arksine/CanBoot
cd CanBoot
make menuconfig

Settings

  • Micro-controller Architecture: STMicroelectronics STM32
  • Processor model: STM32G0B1
  • Build CanBoot deployment application: 8KiB bootloader
  • Clock Reference: 8 MHz crystal
  • Communication interface: CAN bus (on PB0/PB1)
  • Enable Status LED: check
  • Status LED GPIO Pin: PA13

Compile the firmware

make clean
make

Flash the boot loader to the EBB36

dfu-util -a 0 -D out/canboot.bin -s 0x08000000:mass-erase:force

Remove the USB power jumper, and plug back in your harness.

Ensure you can detect the EBB36 via CAN

Run the following command from the CanBoot directory:

python3 ~/CanBoot/scripts/flash_can.py -i can0 -q

If you don't see your EBB36 CAN ID, don't go further. Try again with Setup CANBoot on your ESP326. If you see your ID, then keep going.

Compile klipper for the EBB36

cd ~/klipper
make menuconfig

Settings:

  • Enable extra low-level configuration options: check
  • Micro-controller Architecture: STMicroelectronics STM32
  • Processor model: STM32G0B1
  • Bootloader offset: 8KiB bootloader
  • Clock Reference: 8 MHz crystal
  • Communication interface: CAN bus (on PB0/PB1)
  • CAN bus speed: 500000

Compile the firmware:

make clean
make

Flash the EBB36 with klipper

python3 ~/CanBoot/scripts/flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u <UUID from Step 6>

You should see a progress bar, and flashing commence. If this doesn't work, go back to Step 4.

Add the MCU to klipper, and configure:

In printer.cfg, add the following

[mcu EBB]
canbus_uuid: <UUID from Step 6>

Restart the klipper firmware.

Go to town configuring your actual CAN interface

Add the following sections to your printer.cfg

[board_pins EBB36_G0B1_v1.2]
mcu: EBB
aliases:
aliases_step:
    EXT_EN=PD2,EXT_STEP=PD0,EXT_DIR=PD1,EXT_UART=PA15
aliases_limitsw: # these are preferred for endstops (including klicky)
    LIMIT_1=PB7,LIMIT_2=PB5,LIMIT_3=PB6
aliases_bltouch: # these are the dupont connectors for bltouch
    PROBE_1=PB9,PROBE_2=PB8
aliases_fans:
    FAN0=PA1,FAN1=PA0
aliases_thermistors:
    TH0=PA3,PT100_CS=PA4,PT100_SCLK=PA5,PT100_MISO=PA6,PT100_MOSI=PA7
aliases_heaters:
    HE0=PA2
aliases_rgb:
    RGBLED=PD3
aliases_adxl:
    ADXL_CS=PB12,ADXL_SCLK=PB10,ADXL_MISO=PB2,ADXL_MOSI=PB11
aliases_i2c:
    AUX0=PB3,AUX1=PB4

And now, replace in your printer.cfg with the newly set alias pins where appropriate. For example, my [extruder] section looks like this:

[extruder]
step_pin: EBB:EXT_STEP
dir_pin: EBB:EXT_DIR
enable_pin: !EBB:EXT_EN

Reference the pinout for the EBB36 https://github.com/bigtreetech/EBB/blob/master/EBB%20CAN%20V1.1%20(STM32G0B1)/EBB36%20CAN%20V1.1/Hardware/EBB36%20CAN%20V1.1&V1.2-PIN.png, and replace sections in your config as appropriate. Good to test one thing at a time.

[include mainsail.cfg]
[include sensorless.cfg]
[include macros.cfg]
[exclude_object]
[adxl345]
cs_pin: EBB:ADXL_CS
spi_software_sclk_pin: EBB:ADXL_SCLK
spi_software_mosi_pin: EBB:ADXL_MOSI
spi_software_miso_pin: EBB:ADXL_MISO
axes_map: x,y,z
[resonance_tester]
accel_chip: adxl345
probe_points:
150, 150, 20 # an example
[mcu EBB]
canbus_uuid: 87f90e5842e2
[mcu]
## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify
##--------------------------------------------------------------------
serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_42001A000851303431333234-if00
restart_method: command
##--------------------------------------------------------------------
[save_variables]
filename: ~/klipper-configs/tafkap-variables.cfg ; variable storage file
[printer]
kinematics: corexy
max_velocity: 300
max_accel: 3000 #Max 4000
max_z_velocity: 15 #Max 15 for 12V TMC Drivers, can increase for 24V
max_z_accel: 350
square_corner_velocity: 5.0
[display_status]
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
max_temp: 100
[temperature_sensor octopus]
sensor_type: temperature_mcu
max_temp: 100
[temperature_sensor ebb36]
sensor_type: temperature_mcu
sensor_mcu: EBB
min_temp: 0
max_temp: 100
#####################################################################
# X/Y Stepper Settings
#####################################################################
## B Stepper - Left
## Connected to MOTOR_0
## Endstop connected to DIAG_0
[stepper_x]
step_pin: PF13
dir_pin: PF12
enable_pin: !PF14
rotation_distance: 40
microsteps: 32
full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_min: 0
position_endstop: 300
position_max: 300
homing_speed: 20
homing_retract_dist: 0
homing_positive_dir: true
[tmc2209 stepper_x]
uart_pin: PC4
diag_pin: ^PG6
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
driver_SGTHRS: 70
## A Stepper - Right
## Connected to MOTOR_1
## Endstop connected to DIAG_1
[stepper_y]
step_pin: PG0
dir_pin: PG1
enable_pin: !PF15
rotation_distance: 40
microsteps: 32
full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper
endstop_pin: tmc2209_stepper_y:virtual_endstop
position_min: 0
position_endstop: 300
position_max: 302
homing_speed: 20 #Max 100
homing_retract_dist: 0
homing_positive_dir: true
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_y]
uart_pin: PD11
diag_pin: ^PG9
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
driver_SGTHRS: 70
#####################################################################
# Z Stepper Settings
#####################################################################
## Z0 Stepper - Front Left
## Connected to MOTOR_2
## Endstop connected to DIAG_2
[stepper_z]
step_pin: PF11
dir_pin: PG3
enable_pin: !PG5
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
endstop_pin: probe:z_virtual_endstop
position_max: 280
position_min: -5
homing_speed: 3
second_homing_speed: 3
homing_retract_dist: 3
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z]
uart_pin: PC6
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
## Z1 Stepper - Rear Left
## Connected to MOTOR_3
[stepper_z1]
step_pin: PG4
dir_pin: !PC1
enable_pin: !PA0
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z1]
uart_pin: PC7
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
## Z2 Stepper - Rear Right
## Connected to MOTOR_4
[stepper_z2]
step_pin: PF9
dir_pin: PF10
enable_pin: !PG2
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z2]
uart_pin: PF2
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
## Z3 Stepper - Front Right
## Connected to MOTOR_5
[stepper_z3]
step_pin: PC13
dir_pin: !PF0
enable_pin: !PF1
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z3]
uart_pin: PE4
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
#####################################################################
# Extruder
#####################################################################
## Connected to MOTOR_6
[extruder]
step_pin: EBB:EXT_STEP
dir_pin: EBB:EXT_DIR
enable_pin: !EBB:EXT_EN
rotation_distance: 5.586
microsteps: 16
full_steps_per_rotation: 200
nozzle_diameter: 0.4
filament_diameter: 1.75
heater_pin: EBB:HE0
sensor_type: Generic 3950
sensor_pin: EBB:TH0
min_temp: 0
max_temp: 300
max_power: 1.0
min_extrude_temp: 170
max_extrude_only_distance: 150
max_extrude_cross_section: 0.8
pressure_advance: 0.042
pressure_advance_smooth_time: 0.040
## E0 on MOTOR6
[tmc2209 extruder]
uart_pin: EBB:EXT_UART
interpolate: false
run_current: 0.6
sense_resistor: 0.110
stealthchop_threshold: 0
#####################################################################
# Bed Heater
#####################################################################
[heater_bed]
heater_pin: PA3
sensor_type: Generic 3950
sensor_pin: PF3
max_power: 0.8
min_temp: 0
max_temp: 120
#####################################################################
# Probe w/ TAP
#####################################################################
[probe]
pin: EBB:LIMIT_3
x_offset: 0
y_offset: 0
speed: 3
samples: 3
samples_result: median
sample_retract_dist: 3.0
samples_tolerance: 0.006
samples_tolerance_retries: 3
activate_gcode:
{% set PROBE_TEMP = 150 %}
{% set MAX_TEMP = PROBE_TEMP + 5 %}
{% set ACTUAL_TEMP = printer.extruder.temperature %}
{% set TARGET_TEMP = printer.extruder.target %}
{% if TARGET_TEMP > PROBE_TEMP %}
{ action_respond_info('Extruder temperature target of %.1fC is too high, lowering to %.1fC' % (TARGET_TEMP, PROBE_TEMP)) }
M109 S{ PROBE_TEMP }
{% else %}
# Temperature target is already low enough, but nozzle may still be too hot.
{% if ACTUAL_TEMP > MAX_TEMP %}
{ action_respond_info('Extruder temperature %.1fC is still too high, waiting until below %.1fC' % (ACTUAL_TEMP, MAX_TEMP)) }
TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={ MAX_TEMP }
{% endif %}
{% endif %}
#####################################################################
# Fan Control
#####################################################################
[fan]
## Print Cooling Fan - FAN0
pin: EBB:FAN0
kick_start_time: 0.5
off_below: 0.10
[heater_fan hotend_fan]
## Hotend Fan - FAN1
pin: EBB:FAN1
max_power: 1.0
kick_start_time: 0.5
heater: extruder
heater_temp: 50.0
[controller_fan controller_fan]
## Controller fan - FAN2
pin: PD12
kick_start_time: 0.5
heater: heater_bed, extruder
stepper: stepper_x, stepper_y, stepper_z
[controller_fan psu_fan]
pin: PD13
kick_start_time: 0.5
heater: heater_bed, extruder
stepper: stepper_x, stepper_y, stepper_z
########################################
# EXP1 / EXP2 (display) pins
########################################
[board_pins]
aliases:
# EXP1 header
EXP1_1=PE8, EXP1_2=PE7,
EXP1_3=PE9, EXP1_4=PE10,
EXP1_5=PE12, EXP1_6=PE13, # Slot in the socket on this side
EXP1_7=PE14, EXP1_8=PE15,
EXP1_9=<GND>, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PA6, EXP2_2=PA5,
EXP2_3=PB1, EXP2_4=PA4,
EXP2_5=PB2, EXP2_6=PA7, # Slot in the socket on this side
EXP2_7=PC15, EXP2_8=<RST>,
EXP2_9=<GND>, EXP2_10=<5V>
[board_pins EBB36_G0B1_v1.2]
mcu: EBB
aliases:
aliases_step:
EXT_EN=PD2,EXT_STEP=PD0,EXT_DIR=PD1,EXT_UART=PA15
aliases_limitsw: # these are preferred for endstops (including klicky)
LIMIT_1=PB7,LIMIT_2=PB5,LIMIT_3=PB6
aliases_bltouch: # these are the dupont connectors for bltouch
PROBE_1=PB9,PROBE_2=PB8
aliases_fans:
FAN0=PA1,FAN1=PA0
aliases_thermistors:
TH0=PA3,PT100_CS=PA4,PT100_SCLK=PA5,PT100_MISO=PA6,PT100_MOSI=PA7
aliases_heaters:
HE0=PA2
aliases_rgb:
RGBLED=PD3
aliases_adxl:
ADXL_CS=PB12,ADXL_SCLK=PB10,ADXL_MISO=PB2,ADXL_MOSI=PB11
aliases_i2c:
AUX0=PB3,AUX1=PB4
@cdrjameson
Copy link

Really useful guide thanks. Just for clarity Step 5 is what?

"If you don't see your EBB36 CAN ID, don't go further. Try again with Step 5. If you see your ID, then keep going."

I assume it's the section "Ensure can0 interface setup on your OS".

@jfryman
Copy link
Author

jfryman commented Apr 5, 2023

Thanks for the feedback. Good luck if you give it a go!

Just for clarity Step 5 is what?

It's actually this: Setup CANBoot on your EBB36

I've updated the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment