Jump to content

The Mystery that is Mellow Sky CANbus


Recommended Posts


After dealing with the 3rd broken wire inside the cable chain of my Ender-3 MAX Switchwire conversion and creating the 4th broken wire during that repair I made the decision to upgrade to a canbus for the Toolhead.  Since I’m running a Stealthburner with the Hartk Toolhead PCB the choice of the Mellow Fly SB2040 seemed a no brainer since it should be a drop-in replacement to what I already had.  I’m happy to say that I was 99% correct (more on that later) in that regard.  From there, however, things became very interesting.

Firstly, there is a TON of information out there on using the SB2040 with an Octopus board as a can bridge.  When I get around to my Trident build with the Octopus 1.1 board I’ve got laying around I’ll know where to find the info for the umbilical setup.  But for setting up the SB2040 with the Mellow Fly UTOC-3 USB-Can adapter, well, information is a little lacking or is outdated.

Now the brand of this board is “Mellow Fly” making one think that it is one company that would have one source of providing customers with support info for their products.  Well guess again, sort of:  The story as I found it in an “about” section of a Mellow site gives it like this.  In the beginning there was a lady name Mellow who started a 3D printing Accessories Company specializing in expansion.  Sometime later she met a guy named Sky with a somewhat similar company and they eventually got together (the companies not sure if the guy and gal actually hooked-up) to form Mellow Sky, one company.  Both entities maintain a support website:

                Mellow Products Documentation:  https://mellow-3d.github.io/index.html

                Sky Klipper Docs: https://mellow.klipper.cn/#/board/fly_sb2040/README

And if you’re thinking these are probably duplicate sites…naahhh that would be too easy.  While the Sky site makes reference to CanBoot in its firmware info the Mellow site makes reference to the now current Katapult (formerly CanBoot) for firmware.  The info, however, provided on the Sky site despite being non-current in regards to Katapult is much more relevant to getting the canbus up and running as regards the mysteries of CANbus.  Unfortunately neither site advises as Arksine points out at the very first on his github page for Katapult, you must stop the Klipper Service before flashing Klipper to the SB2040.  IF you do not stop Klipper Service you cannot query the canbus for device uuid’s needed to flash Klipper.

Now with all of this and throw in a couple of stupid mistakes on my part (I’m sure I mentioned that most everyone here is likely a hell of lot smarter than me) and you get an easy 5 days, including 2 all-nighters, to setup this simple upgrade and get it to work.  I should mention that I did change from a Pi3 to a Pi4 requiring migrating my mainsail printer setup, which was no big deal.

Now since I have all this experience I’m gonna give a little advice for anyone else looking to setup a canbus system using a RPI-4, SB2040 and UTOC-3 setup. Use 1000000 for canbus speed when you get to it.  I used a standalone adjustable power supply during this process, using 24V from your printers power supply when needed should work just as well.

And as always you follow my advice strictly at your own peril, you are the master of your own fate.

1.       First isolate the RPI4 from all connections other than power, SSH into RPI4.  Connect nothing but the RPI4 and 24V to the UTOC-3 when called to do so.  Connect nothing but the UTOC-3 to the SB2040 while setting things up and flashing.  Go ahead and install the jumper for the terminating resistor on the SB2040 (it’s located by the weird plug and capacitor on the PCB).  The UTOC_3 is already terminated and requires no jumper.


2.       Using the instructions on the Mellow site for “Katapult with CANbus” git katapult (skip any edits mentioned to mainsail files or creating any new files until flashes are done)  Again following instructions on the Mellow site compile, make and Flash the SB2040 with Katapult being sure to connect the SB2040 via usb to the RPI (SB2040 LOED's should light) while holding the boot button on the SB2040, release the button at least 5 seconds after plugging in (NO OTHER CONNECTIONS as the 2040 gets power over usb during this flash)  Once the flash is verified POWER EVERYTHING DOWN and wire the actual CANbus connections as follows


3.       24V in to the input side of the UTOC-3 board (terminals on the long side), connect the included canbus wire harness to the UTOC-3 out terminals (short side of board) L=White / H=Yellow / Neg pwr / 12V+.  Plug the other end (the one with the weird plug) into the SB2040. (just a quick note the only place you will find the color codes for the L/H wires is on the Sky Klipper Docs site)

At this point things get a little tricky and weird. The Sky site specifically points out that the Pi may not turn on the Can0 canbus on boot up or if the usb connection to the UTOC-3 is unplugged and plugged back in.  This is in fact how my setup is working to this day.  When I 1st power-up my printer I get the blue Klippy is trying to start page, please wait... followed shortly after a couple of minutes with this lovely this red/orange page.


The “Underlying” issue is the can0 bus did not start.  Within 30-60 seconds of powering up I can SSH into the Pi (I do not have to wait for the above screen) to do a little voodoo issuing the command “sudo can-enable –d can0 –b 1000000 –t 1024” to initiate start of the canbus.


Most of you (because most of you are smarter than me) will be thinking “You haven’t set up the can0 in the Pi yet and this is correct and it will make no difference.  There is a procedure outlined on the Sky site that seems to say it will fix this problem but it did not for me.  Anyway you need to keep this info in your pocket to complete the next flash.  Now it is time to flash Klipper to the SB2040 which can only be done over the can0 network not via usb plugged into the Pi.

4.        First we need to setup the Host Can0 file in the RPI.  Follow the instructions on the Mellow site for “Klipper Host”.  Remember to use a bitrate of 1000000 (not 500000).  All you are doing here is creating a file on the RPI that specifies the canbus parameters.  Once you finish this issue the following command “sudo stop service Klipper”.  If you do not you may never get the uuid info in the next step.  This info is only found on the Katapult github page…thank you Arksine, don’t know how I would have figured that out.


5.       Again on the Mellow site follow the instructions for “Klipper on CANbus” to compile and flash Klipper.  Be sure to change the bitrate to 1000000.  If no uuid’s are returned when queried try the sudo command shown above to start the can0 network.  Additionally on the Sky site there is a slightly different command used for finding uuid’s that may work.  At any rate you must have the uuid for the SB2040 as discovered on can0 in order to flash Klipper to it.  It is this part that gave me the most trouble for several reasons.  The can0 bus not started, Klipper Service not stopped, the x-endstop plug being reversed from the Hartk PCB to the SB2040 not to mention the first SB2040 PCB I got was DOA.  Big shout out to Kris at KB3D for getting a new one out to me, no questions asked, with the order processed 0.00 due email notice received before I got off the phone with him.


6.       At any rate, once the SB2040 is successfully flashed with Klipper, power everything down and install in the printer as follows: (you are almost there)


UTOC-3 24V from printer power supply to input (terminals on long side of board) connect UTOC-3 to Pi via usb, run 4-wire wire-harness from UTOC-3 to SB2040 from the out terminals locate on the short side of UTOC-3 then plug into the SB2040 with the weird plug.  I would recommend only connecting the HE0 Thermistor to begin with while setting up the printer config file.  Once you get a good boot up (remember you may need to start can0, as a rule if you see MCU “SB2040” not connected you need to start can0.  This is not required when doing a firmware restart.)  Go on to printer.cfg edits before connecting anything else to the SB2040.


7.         As for printer.cfg edits any of the sites Mellow, Sky and KB3D’s wiki page have excellent pinout information for the SB2040.  There is a reference on the Mellow site for a link to a Sample.cfg file, it’s a dead link.  The Sky site has a working one, there is no need to have an SB2040 config file as all setup info is done in the printer.cfg file by changing the pin designations.  The Mellow site specifically wants you to use an Alias file which I did then I didn’t, it is not really needed.  Given that I named the SB2040 MCU “SB2040” (Mellow site wanted SB2040v2) whatever you name it pins are for me as an example:

Add to the top of printer file:

[mcu SB2040]

uuid: e51d5c…….  (Your uuid here) then onto the pins:



Step_pin: SB2040:gpio9

Dir_pin: !SB2040:gpio10   (needed to reverse the direction)

Enable_pin: !SB2040:gpio7  (This pin was inverted prior so I left it that way, everything worked fine.  I treated all pins in this manner)


The adxl345 onboard chip gave me fits setting up (just me being stupid as I had previously connected to the Pi and had the temp Klipper host thing and thought I needed to edit it somehow) until I finally realized the MCU this chip is on is already referenced at the beginning of the printer file so it’s just:


Cs_pin: SB2040:gpio1

Spi_sftware_sclk_pin: SB2040:gpio0

Spi_software_mosi_pin: SB2040:gpio3

Spi_Software_miso_pin: SB2040:gpio2


Once you get the printer.cfg setup and a good start of the printer config you should be golden except for the weird can0 not starting on power-up until you issue the sudo command to start can0.  At this point start plugging in your Toolhead items, fans, extruder motor, etc. looking out for one of the blue leds on the SB2040 going out.  That’s an indication something is wrong, most likely with the wiring of that item.  This is how I found another wiring mistake I made.

In closing would I do it again, for sure, I know how and will not soon forget.  If there had been one concise place to find the relevant information it would have been a half day thing.  And it is working marvelously!  Tried sneaking in a 20 second Video of it running all pretty and back together but it was one to many, maybe next time.


Good Printing and Good Day

  • Like 4
Link to comment
Share on other sites


Figured out how to get can0 CANbus started on power up.  This requires editing one file and a few commands but has worked for me and my setup.

Instructions are found on the Sky Klipper Docs site https://mellow.klipper.cn/#/board/fly_sb2040/README

Via the menu on the left side of page select item 3.2 “Non-FLY host computer configuration”.  Skip items 1 & 2 and continue down the page to item 1 (yes, a second item 1 just below the “Tip” window) labeled “CAN is automatically enabled at boot” there are three commands to be issued via SSH.

1st Command:  (begins with sudo wget) This gets what I’m gonna call a batch file (I’m not a Linux guy, sorry) named “can-enable” putting it in the usr/bin directory of the Pi.  For whatever reason this command issues “The operation failed” after it completes; it did not fail and the file is there to be edited.  You will need the uuid of the SB2040 for the file edit.  Issue the following command:

Sudo nano /usr/bin/can-enable (I found it easiest to view and edit the file in full screen)

At the top of the file you’ll see:




Edit these as:

DEVICE=uuid: “123fjXXXXXX” (your SB2040 uuid here with the quote marks)

BITRATE: 1000000


Save the file and continue to the next command (this one begins with “sudo cat”) All that’s needed with this one is copy, paste and execute.  Continue on to the last command (this one begins with “sudo sed”).  Copy and paste to the command window then edit for a 1000000 bitrate then execute.

Issue sudo reboot to reboot the pi.  Power the printer down for a 10 count and power up.  It takes my printer about 1 minute 45 endless seconds to boot up, but boot up is does and working without having to go through the SSH thing and manually start the can0.

I’m sure there is a cleaner, faster way of getting this done but as I pointed out I’m not a Linux guy and I’m sure not the sharpest pencil in the room.  Any input would be greatly appreciated.

Thanks all, Stay Safe



  • Like 3
  • Haha 1
Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...