Skip to content

Instantly share code, notes, and snippets.

@adelyser
Last active February 17, 2024 11:40
Show Gist options
  • Save adelyser/0b2123f1800155ef45aae392eecf097e to your computer and use it in GitHub Desktop.
Save adelyser/0b2123f1800155ef45aae392eecf097e to your computer and use it in GitHub Desktop.

Klipper on the BIQU BX

So you want to run Klipper on your BIQU BX? Well too bad it's not supported.... but I do have some good news. I have a preliminary branch ready to submit to Klipper to support the BIQU BX. Here's what you need to know in order to get started.

NOTE: If you have a V3 board, click here

_**UPDATE: The Biqu BX is now supported in mainstream klipper!

NOTE: CAN will not work on this board due to a hardware mis-configuration

NOTE: I2C is not quite working yet!

First, a few requirements:

  1. You need Klipper setup on your Raspberry PI with your favorite control interface (Octoprint, Fluidd, Mainsail, etc..).
  2. You need your favorite Touchscreen UI installed (unless you just want to run headless). There is more on the HDMI config for the RPI below.
    • For Octoprint, I recommend OctoDash
    • For Fluidd and Mainsail, I recomment KlipperScreen
  3. You MUST have removed the Z endstop physical switch. Not disconnected, but completely removed.

Ok, so let's get started.


Klipper firmware configuration

When configuring the klipper firmware to run on the BTT SKR SE BX board, there are a couple things to know about.

  1. Use the main klipper branch.
  2. In order for the toucscreen to work, you will need to set GPIO pins PB5 and PE5 to an initial state during the config
  3. Use the config/printer-biqu-bx-2021.cfg file for your intial printer.cfg
  4. Once you are setup, you will need to calibrate your sensorless homing: https://www.klipper3d.org/TMC_Drivers.html?h=sensorless+ho#sensorless-homing

Klipper Firmware Configuration

A note on connection methods:

There are 4 different connections you can make from the Raspberry Pi to the mainboard, 2 Serial and 2 USB.

Communication Interface

  • USB (on PA11/PA12) is the USB port on the front base of the machine.
  • USB (on PB14/PB15) is the USB port on the right side of the touchscreen.
  • Serial (on USART1 PA10/PA9) is the TFT connector on the mainboard.
  • Serial (on UART4 PA0/PA1) is the WiFi connector on the mainboard.

To use serial connections, you have to enable the serial port on the raspberry pi and compile the correct serial port for the BX mainboard. Once you have the serial port enabled on the raspberry pi, it will show up as /dev/ttyAMAx, with x being the port number.

Follow this guide for setting up the RPI serial connection: https://gist.github.com/looxonline/89e79b2554771eee8aa8b6492f30400d

Once you have it setup, your printer.cfg should then contain the following under the MCU section: serial: /dev/ttyAMAx, substituting the x for your port number.


HDMI configuration

For the HDMI to work properly with the Raspberry Pi, you need the following set in /boot/config.txt on the Raspberry Pi. If you are currently using the RPI touchscreen, this should already be setup.

config_hdmi_boost=7
hdmi_group=2
hdmi_mode=87
hdmi_drive=1
hdmi_cvt=1024 600 60 6 0 0 0

Slicer configuration

For your slicer, you need to call the PRINT_START macro instead of any preliminary gcode. The NOZZLE and BED temps get passed in as arguments. Some examples for the more popular slicers:

  • Cura: PRINT_START BED={material_bed_temperature_layer_0} NOZZLE={material_print_temperature_layer_0}
  • PrusaSlicer: PRINT_START NOZZLE=[first_layer_temperature] BED=[bed_temperature]
  • Ideamaker: PRINT_START NOZZLE={temperature_heatbed} BED={temperature_extruder1}
  • Simplify3D: PRINT_START NOZZLE=[extruder0_temperature] BED=[bed0_temperature]
  • Kiri:Moto: PRINT_START NOZZLE={temp} BED={bed_temp}

Klipper Functionality

Here are some notes on how I have Klipper setup and working quite well for my machine.

Touchscreen Sleep

The Touchscreen will go dark when the printer idle timeout occurs. This happens when there is not a print job in action and currently set for 5 minutes. Pressing the Menu Knob on the display will wake up the Touchscreen.

LEDS

The Neopixels are setup and will cycle through colors on bootup. I have the idle timeout set to shut off the LEDS when the printer is inactive. The LEDs automatically come on when a print is started or when the LCD is wakened.

Homing Routine

I have programmed a reliable homing routine that works well for me, however you can adjust or setup your own to taste. My routine will do the following:

  1. Raise the Z axis
  2. Home the X axis
  3. Home the Y axis
  4. Move the probe to the center of the bed (different than the nozzle at center)
  5. Home the Z with the probe.
  • When starting a print, additionally:
  1. After the bed reaches temp, the printer waits for 90 seconds with the probe close to the bed to warm up the probe.
  2. Steps 1-5 are repeated with a warm probe
  3. Move to the origin to start the print.

OctoDash custom buttons

I wanted some custom configs for OctoDash to control the LEDs and the extruder from the control screen. Here are my entries to make that happen. Edit /config/octodash/config.json from the home directory on the Raspberry Pi with the icons you want from below.

		"octodash": {
			"customActions": [
				{
					"icon": "home",
					"command": "G28 X Y Z",
					"color": "#dcdde1",
					"confirm": false,
					"exit": true
				},
				{
					"icon": "snowflake",
					"command": "M140 S0; M104 S0",
					"color": "#0097e6",
					"confirm": false,
					"exit": true
				},
				{
					"icon": "long-arrow-alt-down",
					"command": "M83; G1 E5 F100",
					"color": "#00ff00",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "long-arrow-alt-up",
					"command": "M83; G1 E-5 F100",
					"color": "#800080",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "sun",
					"command": "SET_LED LED=led RED=1.0 BLUE=1.0 GREEN=1.0; SET_LED LED=knob RED=1.0 BLUE=1.0 GREEN=1.0",
					"color": "#ffff00",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "moon",
					"command": "SET_LED LED=led RED=0.0 BLUE=0.0 GREEN=0.0; SET_LED LED=knob RED=0.0 BLUE=0.0 GREEN=0.0",
					"color": "#bc8f8f",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "redo-alt",
					"command": "[!RELOAD]",
					"color": "#7f8fa6",
					"confirm": true,
					"exit": false
				},
				{
					"icon": "power-off",
					"command": "[!SHUTDOWN]",
					"color": "#e84118",
					"confirm": true,
					"exit": false
				}
@mackna
Copy link

mackna commented Jan 27, 2022

Yes i did, can see the new code in klippy.log

@mackna
Copy link

mackna commented Jan 27, 2022

Hmm with IdeaMaker Slicer I got it to work almost, 2 layers then it stops,

Extrude below minimum temp,

21:48:23
Unknown command:"M205"
21:47:50
Unknown command:"T0"

@Killajoedotcom
Copy link

I haven't been successful with Klipper on the BX thus far. Had it working for short while. Then it just decided to not work at all. Not sure what happened. Willl need to start from scratch all over again. FML

@adelyser
Copy link
Author

@mackna What slicer were you using when it failed with the max_extrude_cross_section error?

@mackna
Copy link

mackna commented Jan 28, 2022

@adelyser diffrent version of Cura and S3D - I also had to remove the M190 S and M109 S command because Klipper reporting "Error on 'M190 S': unable to parse"
Skärmbild 2022-01-28 081614
Skärmbild 2022-01-28 081701
Skärmbild 2022-01-28 081734

@rak500
Copy link

rak500 commented Jan 28, 2022

@mackna
I had the same issue, which I solved by defining a varialbe after gcdoe start:

gcode:
{% set BED_TEMP = params.BED|default(60)|float %}
{% set EXTRUDER_TEMP = params.NOZZLE|default(190)|float %}
...
M117 Getting the extruder up to temp
M140 S{BED_TEMP} ; Set Heat Bed temperature
M104 S{EXTRUDER_TEMP} ; Set Extruder temperature
M109 S{EXTRUDER_TEMP} ; Wait for Extruder temperature
M190 S{BED_TEMP} ; Wait for Heat Bed temperature

My Start GCode in Cura is as follows:

START_PRINT BED={material_bed_temperature_layer_0} NOZZLE={material_print_temperature_layer_0}

@mackna
Copy link

mackna commented Jan 28, 2022

@rak500 Thx, works perfect :)

@JackyL-HK
Copy link

Hi everyone, I've been following this gist since last December, but I have no luck in getting it to work...
My BX shutdown every time when I try to home any of the axis. It managed to move a little bit, then the board reboots.
I've attached the logs, can't find any similar issues on Klipper's Github, and the "Transition to shutdown state: Unhandled exception during run" is not helpful at all :(
(Everything's been updated to the latest version from the main Klipper Branch)
klippy.log.config0002.cfg
klippy.log.shutdown09660

@corneliu68
Copy link

Hi everybody,

I just tried to install klipper through Mainsail.

With octopi I can see may USB ID in /dev/serial/
But as soon as I install the klipper firmware on the board I can see only 2 empty folders /dev/serial0 and /dev/serial1

I tried all the cable connections and compiled the firmware several times with the settings described above but none would work.

Please help

@Musicdad12
Copy link

This is a great project, Please don't give up on us. I have it installed and working ALMOST perfectly.

Almost means, I am currently forced to use the USB cable from the PI to the front of the BX. I have the wiring in place connecting the screen to the BX via the wifi connection, BUT I cannot get klipper to connect through that connection. Please help me get rid of this USB cable.

@Musicdad12
Copy link

Hi everybody,

I just tried to install klipper through Mainsail.

With octopi I can see may USB ID in /dev/serial/ But as soon as I install the klipper firmware on the board I can see only 2 empty folders /dev/serial0 and /dev/serial1

I tried all the cable connections and compiled the firmware several times with the settings described above but none would work.

Please help

How do you have the pi connected to the printer? If you use the USB on the front of the BX, then in Make Menuconfig choose First option USB and everything should then connect.

@adelyser
Copy link
Author

To use serial connections, you have to enable the serial port on the raspberry pi and compile the correct serial port for the BX mainboard. Once you have the serial port enabled on the raspberry pi, it will show up as /dev/ttyAMAx, with x being the port number.

Follow this guide for setting up the RPI serial connection: https://gist.github.com/looxonline/89e79b2554771eee8aa8b6492f30400d

Once you have it setup, your printer.cfg should then contain the following under the MCU section: serial: /dev/ttyAMAx, substituting the x for your port number.

Hope this helps!

@predy3dprint
Copy link

Hi,
thank you for this wonderful gist. Without it, i wouldn´t be able to setup my BX.
But there is a little mistake in the Slicer Configuration for the IdeaMaker START_MACRO :
Ideamaker: PRINT_START NOZZLE={temperature_heatbed} BED={temperature_extruder1}
It must be:
PRINT_START NOZZLE={temperature_extruder1} BED={temperature_heatbed}

@thehans
Copy link

thehans commented Oct 23, 2022

I think my display is defective or there is some connection / wiring issue with it.

Before even trying klipper, I kept getting garbled screen with semi-visible image, and lines of static vertically and horizontally randomly all around. Occasionally it would turn on fine though, or the lines would randomly go away after being on for some time. Eventually I tried re-seating the display cable on the main board side and it seemed like things were fixed, where the image was consistently coming up when powering on.
Shortly after that, I started looking for firmware alternatives, since the Z stop switch would cause ABL probing to fail, and I couldn't get anywhere with stock firmware.

So I found this gist and tried to follow it as well as I could.
I went with MainsailOS on the RPi4, and then added klipperscreen by cloning that git repo and running the provided script.
AFAIK I did all the right steps like set the PB5 and PE5 pins when building the firmware, wrote the correct hdmi settings in boot/config.txt, etc, but not having much luck.

Basically now I can't get the screen to do anything. After power on, I see a black screen (but backlight on) then after a few seconds an oddly splotchy light gray appears across the whole screen which gradually brightens until the whole thing is 100% white and the splotches vanish.

I haven't even been able to connect to my RPi4 when powered through the supplied adapter board. Seems like it just never connects to WiFi.
On the other hand, if I power the Pi over a separate USB-C cable. then I am able to SSH in and even use the mainsail web interface. With the PI connecting to the micro USB port on the front of the printer, I can verify that klipper seems successfully installed on the mainboard, and can move the axes around etc.

I have no idea what's going on at this point, just hoping maybe someone else experienced something similar any could provide advice.

I'm sort of guessing that the Pi is getting unreliable power and/or the TFT is getting unreliable signal from main board.
OR that for some reason connecting the TFT to the Pi causes it to fail to boot up to the point where it connects to my WiFi.
I noticed the TFT board has a 2-pin connector specifically labeled "Power", which is unused. Not sure if that's meant as an alternate power IN to the TFT or, if its a power OUT for something like a spare fan etc.
Is there any chance I could power the TFT+Pi through that Power connector and have the Pi output to the display without needing the 40Pin connector between main board and TFT? (i'm suspicious there is some bad wiring connection there)

Also, just to clarify, the only connections needed with the Pi4 should be that little USB-C + micro-HDMI adapter board, AND that one USB Type A (on Pi) to micro usb (on TFT70) cable, right?
The "Pi-Power" USB Type-A on the middle HDMI board is only relevant for RPi3 AFAICT? There are just so many poorly documented ports on this thing.

Which reminds me, I don't suppose anyone knows what the jumper pins on the TFT70 do? No clue if moving that might help my issues, or if it might fry something, so I haven't tried moving it from the position it came as delivered.

I might also see if I can try an RPi3 in case its that little adapter board which is causing the problems. It was a tight fit onto the Pi 4, and I was worried that the ports were going to crack a solder joint since they were seemingly slightly misaligned.

I really wish the official support was not a private facebook group... I deleted my FB account many years ago and will not be creating another.

@predy3dprint
Copy link

I followed this gist:
https://gist.github.com/looxonline/89e79b2554771eee8aa8b6492f30400d
And both the Raspberry and the screen work perfectly.

@Jelle-Tigchelaar
Copy link

Hi everyone, I've been following this gist since last December, but I have no luck in getting it to work... My BX shutdown every time when I try to home any of the axis. It managed to move a little bit, then the board reboots. I've attached the logs, can't find any similar issues on Klipper's Github, and the "Transition to shutdown state: Unhandled exception during run" is not helpful at all :( (Everything's been updated to the latest version from the main Klipper Branch) klippy.log.config0002.cfg klippy.log.shutdown09660

I am very sorry to necro an older discussion. I have put my Biqu BX aside for a couple of months during remodelling of my house. I wanted to use it a while back and out of habit and to check if everything moved smoothly I pressed 'home all', it then moves the Z and when it gets to the X it moves a little and stops. Since then I have been debugging the issue, but to no avail. I also can't seem to find any related issues aside from this one comment I quoted. Could anyone point me in the right direction?

@Jelle-Tigchelaar
Copy link

Hi everyone, I've been following this gist since last December, but I have no luck in getting it to work... My BX shutdown every time when I try to home any of the axis. It managed to move a little bit, then the board reboots. I've attached the logs, can't find any similar issues on Klipper's Github, and the "Transition to shutdown state: Unhandled exception during run" is not helpful at all :( (Everything's been updated to the latest version from the main Klipper Branch) klippy.log.config0002.cfg klippy.log.shutdown09660

I am very sorry to necro an older discussion. I have put my Biqu BX aside for a couple of months during remodelling of my house. I wanted to use it a while back and out of habit and to check if everything moved smoothly I pressed 'home all', it then moves the Z and when it gets to the X it moves a little and stops. Since then I have been debugging the issue, but to no avail. I also can't seem to find any related issues aside from this one comment I quoted. Could anyone point me in the right direction?

Just replying to my own comment here in case anyone else has the same issue. In the end it turned out to be this block in the default printer.cfg file:

[gcode_button lcd_button]
pin: PH8
press_gcode:
    SET_PIN PIN=screen VALUE=1
    SET_LED LED=led BLUE=1.0 RED=1.0 GREEN=1.0

During moves the gcode_button.py would throw an error, so that's why I tried removing that config block. After that, the printer has been running fine... Maybe this issue only exists for me, but on the off chance someone else runs into this I have posted it here.

@janstanka
Copy link

Realized serial connection - used TFT connector: on USART1 PA10/PA9

BiquBX_TFT_serial

@bboybattlemage
Copy link

bboybattlemage commented Mar 28, 2023

I think my display is defective or there is some connection / wiring issue with it.

Before even trying klipper, I kept getting garbled screen with semi-visible image, and lines of static vertically and horizontally randomly all around. Occasionally it would turn on fine though, or the lines would randomly go away after being on for some time. Eventually I tried re-seating the display cable on the main board side and it seemed like things were fixed, where the image was consistently coming up when powering on. Shortly after that, I started looking for firmware alternatives, since the Z stop switch would cause ABL probing to fail, and I couldn't get anywhere with stock firmware.

So I found this gist and tried to follow it as well as I could. I went with MainsailOS on the RPi4, and then added klipperscreen by cloning that git repo and running the provided script. AFAIK I did all the right steps like set the PB5 and PE5 pins when building the firmware, wrote the correct hdmi settings in boot/config.txt, etc, but not having much luck.

Basically now I can't get the screen to do anything. After power on, I see a black screen (but backlight on) then after a few seconds an oddly splotchy light gray appears across the whole screen which gradually brightens until the whole thing is 100% white and the splotches vanish.

I haven't even been able to connect to my RPi4 when powered through the supplied adapter board. Seems like it just never connects to WiFi. On the other hand, if I power the Pi over a separate USB-C cable. then I am able to SSH in and even use the mainsail web interface. With the PI connecting to the micro USB port on the front of the printer, I can verify that klipper seems successfully installed on the mainboard, and can move the axes around etc.

I have no idea what's going on at this point, just hoping maybe someone else experienced something similar any could provide advice.

I'm sort of guessing that the Pi is getting unreliable power and/or the TFT is getting unreliable signal from main board. OR that for some reason connecting the TFT to the Pi causes it to fail to boot up to the point where it connects to my WiFi. I noticed the TFT board has a 2-pin connector specifically labeled "Power", which is unused. Not sure if that's meant as an alternate power IN to the TFT or, if its a power OUT for something like a spare fan etc. Is there any chance I could power the TFT+Pi through that Power connector and have the Pi output to the display without needing the 40Pin connector between main board and TFT? (i'm suspicious there is some bad wiring connection there)

Also, just to clarify, the only connections needed with the Pi4 should be that little USB-C + micro-HDMI adapter board, AND that one USB Type A (on Pi) to micro usb (on TFT70) cable, right? The "Pi-Power" USB Type-A on the middle HDMI board is only relevant for RPi3 AFAICT? There are just so many poorly documented ports on this thing.

Which reminds me, I don't suppose anyone knows what the jumper pins on the TFT70 do? No clue if moving that might help my issues, or if it might fry something, so I haven't tried moving it from the position it came as delivered.

I might also see if I can try an RPi3 in case its that little adapter board which is causing the problems. It was a tight fit onto the Pi 4, and I was worried that the ports were going to crack a solder joint since they were seemingly slightly misaligned.

I really wish the official support was not a private facebook group... I deleted my FB account many years ago and will not be creating another.

Didi you have anymore luck with this? Currently have Klipper installed and working (yay) but my screen is having similar issues to you.
IMG20230327231356
IMG20230327231330
I'm trying to get KlipperScreen to work, but the display resolution looks wrong/some other related issue when klipperscreen boots (but the display line interface upon boot and accessing it if rebooting klipperscreen/during startup and shutdown looks fine). I'm currently using a BTT CB1 and PI4B adaptor board, and think it might be something to do with these items configuration.

I've noticed (despite the crappy display) that the touchscreen works and I can initiate commands, but pushing the Macro button causes the printer to reboot..

I'm so close yet so far! Might try it with another hardware configuration (genuine raspberry Pi 2/3 to see if that changes anything).

Anyone have any suggestions, I'm all ears!

@varazir
Copy link

varazir commented May 7, 2023

Do you have a v3 screen and controller board ?

@bboybattlemage
Copy link

Do you have a v3 screen and controller board ?

No it is V2.0!

I did manage to study this out (of sorts). I switched the CB1 for a raspberry pi; there was just something wrong/strange about the kernel in the BTT CB1 image that prevent proper setup. Using a pi I was able to get the proper resolution and screen output without issue.

Thanks for the reply!

@varazir
Copy link

varazir commented May 7, 2023

Do you have a v3 screen and controller board ?

No it is V2.0!

I did manage to study this out (of sorts). I switched the CB1 for a raspberry pi; there was just something wrong/strange about the kernel in the BTT CB1 image that prevent proper setup. Using a pi I was able to get the proper resolution and screen output without issue.

Thanks for the reply!

Okay, I have the v3 and I can't get it to work :(

@bboybattlemage
Copy link

With a raspberry Pi?

Are you using a separate power supply for the screen or powering it off the raspberry pi?

What exactly are your issues?

@varazir
Copy link

varazir commented May 7, 2023

With a raspberry Pi?

Are you using a separate power supply for the screen or powering it off the raspberry pi?

What exactly are your issues?

I have a RPI3b+
Have connected it as shown here https://github.com/bigtreetech/BIQU-BX/blob/master/BIQU-BX-manual.pdf

Issue I have all the time is the screen looks like this https://i.imgur.com/cvIyzjO.jpg
I have tried different images and settings. If I add the 1024x600 mode and force the screen to use it, it goes white/blank.

Right now is the problem with Klipper can't connect to the MCU. It times out
My settings https://i.imgur.com/bR66AFR.png

[mcu]
serial: /dev/ttyAMA0
restart_method: command

@varazir
Copy link

varazir commented May 8, 2023

I got Klipper to work with using the UART4 PA0/PA1 port in Klipper setup.

@TMOD3D
Copy link

TMOD3D commented Nov 11, 2023

Hi All, thx for the post helps alot, have successfully installed klipper and klipperscreen on V2 screen but touch is not working on my screen, can it be because i am using a pi zero

@adelyser
Copy link
Author

Hi All, thx for the post helps alot, have successfully installed klipper and klipperscreen on V2 screen but touch is not working on my screen, can it be because i am using a pi zero

Did you plug in the usb cable to the screen for touch? That’s required for touch to work.

Also, you shouldn’t be using a Pi Zero to run Klipper with a touchscreen, it’s a bit underpowered to handle a UI or a webcam. A Pi Zero 2 would be fine though.

@TMOD3D
Copy link

TMOD3D commented Nov 11, 2023

no the usb on the side of the screen to the pi's usb

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