Marlin 2.0 on the SKR 1.3 with TMC2209 and sensorless homing

In this video, I show you how to configure Marlin 2.0 for the SKR 1.3 mainboard with TMC2209 stepper drivers and sensorless homing.

Hello, my name is Daniel, welcome to the CrossLink channel. Our mission is to help 1 million people getting more successful with 3d printing and if you're here for the first time, subscribe and enable bell notifications so you don't miss anything.

This is part 2 of my SKR 1.3 build, just in case you've missed the first part where I talk about the hardware installation on my AM8 formerly known as Anet A8, I've linked that video up here.

Today, I'm going through all the Marlin 2.0 configuration steps before we can compile the firmware for the SKR 1.3 and then we'll have to do some fine tuning of the stepper motor settings to get sensorless homing to work on this printer as well.

All the steps I'm doing are not really specific to this AM8 but can be applied to almost any other printer that you might have.

So Let's start with the prerequisites.

You will need a computer with Visual Studio Code installed, and the PlatformIO and Auto Build Marlin Extensions for Vistual Studio Code.

You will also need a copy of the Marlin 2.0 sourcecodes on your computer, pre-configured for your printer model.

I've covered the required steps to get all this prepared in another video that I've linked up here, so you can set your environment up correctly using that guide and learn how to compile Marlin firmware 2.0 with those tools.

From here on, I will make the assumption that you have everything set up already and you know how to compile Marlin firmware with VSCode.

So let's start to modify Configuration.h for the SKR 1.3

So in the author string, I'm gonna put "Daniel's AM8 SKR 1.3 config" just for my reference

Then, scrolling down a bit, you have to change the Serial port settings.

The SKR 1.3 supports serial connection over USB as well as a secondary serial port that you could use to connect it to Octoprint directly using jumper wires. I want both serial ports to be available for the future.

The first one will be set to -1 to mark it as the USB connection.

The second serial port is set to 0 and we need to uncomment that line so it actually gets activated.

I also wanna make sure that my serial connection speed is set to 250000, so we have a higher speed.

Around line 130 there is the #define MOTHERBOARD statement.

Whatever is configured here currently, you need to change that to BOARD_BTT_SKR_V1_3. This changes everything required to build for 32bit and the specific processor on the board.

Then, you can give your printer a name that is going to be shown on the printer display later, I am using "AM8" for now.

Now, let's come down to the stepper driver settings, around line 686. I am changing the X, the Y, the Z and the E0 driver to TMC2209. And that also tells Marlin that it's used in UART mode, otherwise it would be standalone.

Just below those stepper motor settings, please disable ENDSTOP_INTERRUPTS_FEATURE around line 705 just in case if it was enabled for your previous mainboard.

At around line 1072 you will find the settings for the motor directions. It can absolutely be that you will have to change your motor directions after switching to TMC2209 drivers but this depends on what you were using before, so you can just leave it as it is for now and we're going to test the motor directions later to make any neccessary changes here.

As I've told you in the hardware installation video last time, I am currently using the Anet full graphics display, so I will make sure, I have enabled #define SPEAKER at around line 1772 so it gives me feedback for example when I save my settings.

And at around line 2031, I have enabled ANET_FULL_GRAPHICS_LCD

and at line 1842, I am disabling the original Anet A8 ZONESTAR_LCD

I will also make another video showing how to install and configure the Bigtreetech TFT35 Touchscreen Color display with the SKR mainboards, so make sure you're subscribed to the channel and have the bell notifications enabled so you don't miss it.

Ok, let's now open up Configuration_adv.h to make some more changes.

In about line 593, I'm changing X_HOME_BUMP and Y_HOME_BUMP to zero as we are going to configure sensorless homing for this printer and that won't work with home bump anymore.

And another change we need to make for the sensorless homing is at around line 662, where we have to set X_MIN_STOP_INVERTING and Y_MIN_STOP_INVERTING to false, because the sensorless homing does not require the endstop logic to be inverted anymore.

Now, let's scroll down to the tmc_smart section, around line 2024 and below.

Let's have a look at the default configuration for each stepper driver.

Each stepper driver can be configured to have it's own Current setting. That means how much current in milliampere is provided on average to the stepper motor. If you know the maximum peak current of your stepper motors, you just need to divide that value by 1.414 to get the RMS value that needs to be entered here in this configuration.

I will give you an example. I am using the Hemera extrusion system and the stepper motor for it is rated for a maximum peak current of 1.33 amps. That's 1330 milliamps divided by 1.414 gets me an RMS value of 940 milliampere, so I am entering this value here in the E0 settings.

For the other motors on this printer, I actually don't know the peak current values, so I'm gonna leave it on 800, which is the default. If I would see my motors becoming very hot, I would probably take down these values a bit to see whether that gets rid of the problem. On the other hand, if my printer would start skipping layers, I would know that this value is too low or that my carriage system has such a high resistance that I would need to fix that physically.

Every stepper driver also has it's own microsteps setting. Currently that's set to 16 and you can increase it to a maximum of 256 on the TMC drivers. If you wanna know, what microstepping is, I've put a link up here that explains it a bit more in depth for you.

I am going to leave microsteps on 16 for now.

Make sure you also have #define INTERPOLATE to true, so any microstep values you might have configured elsewhere get correctly interpolated for example the steps per millimeter settings for any of your axis'

Here around line 2236, make sure STEALTHCHOP is enabled for all stepper motors. This will make sure, you are getting the least motor noise possible with these TMC drivers.

Since I have my printer running on 24V, I am also changing the CHOPPER_TIMING to 24V, so check what voltage your printer is running on and have it set accordingly.

Next, I'm enabling MONITOR_DRIVER_STATUS. This adds some more GCODE commands to get and set the motor currents. It also enables monitoring of the drivers for overtemperature. Marlin can use this to automatically reduce the driver current if your steppers overheat for some reason.

Now, a bit below that, around line 2324, I'm enabling SENSORLESS_HOMING. Don't confuse that with Sensorless probing. That's a completely different story, not recommended on this kind of printer setup.

Then, a bit below you see two values, the X_STALL_SENSITIVITY and Y_STALL_SENSITIVITY.

Those sensitivity values determine the amount of sudden resistance on an axis so the TMC driver will think it's hitting the end-stop.

So it's really important to set this value just high enough that it detects the endstop, not higher, otherwise it might detect little resistence of the printer nozzle scratching the build surface during a print as hitting the endstop and this might stop your print.

And this value can be totally different for every printer, even for two printers of the same model.

As soon as we've installed the firmware for the first time, I'm going to show you how to approach the right value quite fast.

A bit below those settings, I'm also enabling TMC_DEBUG, just in case I would like to see some debug output of the drivers if I run into issues later. I might not need it but we have 32bit and enough space.

So, I think we're good to go, let's open up the Auto Build Marlin extension and hit compile to see, if we have any issues.

I get a compilation error, which reminds me friendly that I need to change the pin wiring to use the Anet full graphics lcd on the SKR 1.3. That's really nice. If we follow that link, it takes us to the explanation. And that's actually really nice. There's a little guide what you need to do, which pins to swap etc.

So to get rid of this compiler error, I need to comment out that error message here and save the file.

Let's try again to compile.

Looks good, everything is compiling and we have a new firmware file.

Now, the easiest way to flash the firmware to the SKR 1.3 is to plug in the USB cable to the PC and hit the upload button in Auto Build Marlin. You could also just copy the firmware.bin file to the sd card and then insert it back into the printer.

The upload function of Auto Build Marlin copies the firmware.bin file to the virtual USB drive that you will see once you connect the mainboard to the PC. In the end, it also just lands on the SD Card.

Now, either switch the printer off and on or hit the reset button on the mainboard. In my case, I can actually trigger a reset directly from the display with this button.

What happens now is, the firmware gets flashed from the SD Card to the mainboard.

As soon as the board boots up again, you will see that on the SD Card, the file has been renamed to firmware.cur.

That is the confirmation that your new firmware.bin has been flashed and you can also use this file as a backup and rename it so you can keep your old firmware files somewhere.

Good, the new firmware is flashed, it's running and the display is also working. Also using the push dial works fine to navigate the menu.

But, we will have to reset the EEPROM because the default settings that are configured in our firmware are not yet in the EEPROM, so we should make sure the EEPROM gets a reset to default values. There might also be an EEPROM related error on your display, that's also an indication to reset the EEPROM.

Do this by entering the configuration menu and then go to the advanced settings menu.

There, scroll to the end and select the initialize EEPROM item. Confirm to init the EEPROM, so everything is reset to the default values.

Let's now check if the motor directions are correct and make changes if needed.

Please don't do any Auto-Home right now, because we don't know yet if the motors move in the right direction. Let's check and fix that first and then take care of the sensorless homing settings.

First, I'm trying to move the X-Axis to the right from the printer's Motion - Move Axis - Move X menu. I will select 10 millimeter.

And now. If I turn the knob to increase the value, it should move to the right.

Yes, it's going to the right.

Now, let's check the Y-Axis. And here it's important to not confuse the direction.

When I send the printer a command to move the Y-Axis to a higher value, it should actually move the bed to the front because we're trying to move the nozzle to the back, alright?

So, it's actually moving in the wrong direction. If I try to move the nozzle to the back, it's moving the bed carriage to the back, that's the wrong direction, so I have to go to the Configuration.h and invert the Y-direction to fix this.

Finally, checking the Z-Movement.

If I try to move it up, it's moving up. That is correct.

The only motor left to test is the extruder motor. To test that, we need to heat up the nozzle first with some filament inserted.

And once the temperature has been reached, I am starting to extrude some filament. Is it moving the filament out?

Yes, it's moving in the right direction.

Very good. All motor directions are correct. Let's upload a new build to the mainboard now, to fix the motor direction changes.

Ok, We can now take care of tuning in sensorless homing.

To do this, there is a configuration section in the printer's menus. Quite deep inside. We have to go to Configuration - Advanced Settings - TMC Drivers - Sensorless Homing.

And here you can see that for axis, the default value of 8 has been set and we could now try to do an auto home and try if these default values are anywhere reasonable. But have your hand on the reset button or the power switch because the motors will most probably just continue to run and not stop.

So let's reset the printer and try some new values for the sensorless homing. and since we have a range from 0 to 256 in the case of the TMC2209 drivers, we should start in the middle and use 128 as a starting point to see if that works.

Now, let's do an auto home using the Motion - Auto Home menu.

So, in my case, sensorless homing worked fine for X and Y but as I said in the beginning, we wanna have this value as low as possible for both axis so we don't get any false positives during printing.

So what I'm going to do is reducing the sensorless homing sensitivity to 64, that's again in the middle of 0 and 128. And before doing the next auto home, I am disabling the steppers

and then I push my carriages to some distance from the endstops.

Now doing an Auto Home again.

And we're crashing into both axis, so we are way too low with our values.

Now, I am going to a value of around 96 and after doing this kind of trial and error, I actually landed at values of 120 for X and 128 for Y, so I was actually quite close in the beginning but that's how it is, you cannot know the values upfront, you have to approximate the right values by trial and error.

So, now we know the values, we should save them to the EEPROM. If you ever recycled power or reset the printer during this process, you will have seen that the values you have set have been lost. So, after having set the final values, go to the configuration menu again and then use "Store Settings" to save your current settings.

I am also copying my final values to the Configuration_adv.h section into the stepper driver X_STALL_SENSITIVITY and Y_STALL_SENSITIVITY settings.

So if at any time, the EEPROM values get lost, these are the future default values.

So, the question is - how does it print? Well, actually, it printed this test benchy and this masterspool, because I needed another one - pretty well.

And because this is the Hemera extrusion system on the AM8, I still owe you a final review on the print quality and the overall usage, so this is coming soon.

On the SKR 1.3, I can say - it just works. I had no issues during this 20 plus hour print of the master spool. And I now can have all the features I ever wanted bcause it has more memory, more ports, more anything.

Next up in this series, I'm gonna cover the BLTouch installation, so make sure you don't miss that video, and I've also linked two other videos here in these two cards for you.

See you soon back on the channel. Bye bye.