Klipper on a BTT SKR v1.4 Turbo with TMC2240 drivers

Too late, I got to got to bed and check it next weekend.

I didn’t know you hibernated.

2 Likes

Hi @nefelim4ag,

That’s quite the write up and the patch is something I’d be happy to attempt. I have no idea on how to apply it though. Can you point me towards the doco on how to?

Regards,
Liveitnerd

I think, then, the simpler way for you would be to just replace the file with patched one:

Or:

git remote add nefelim4ag https://github.com/nefelim4ag/klipper.git
git fetch --all
git cherry-pick 30d63ea9873ec65b588f74e377431286c0bf76f0

Or possibly Testing Klipper Pull Requests (It should work, but I never try that).

git fetch origin pull/6856/head
git cherry-pick 30d63ea9873ec65b588f74e377431286c0bf76f0

Hey @nefelim4ag ,

I replaced my local spi_software.c with the one you referenced. I then ran ‘make clean’, ‘make menuconfig’ to verify all the settings were correct, then ‘make’ to get the klippy.bin. I renamed that to firmware.bin and put it on a micro SD card and put that in the printer. I switched the printer on with the USB cable unplugged. I went back about an hour later when I remembered (oops) and powered the printer off, removed the SD card, and switched it back on.

The SD card contains firmware.cur now which seems to indicate it flashed correctly. I have also restarted firmware on the fluidd interface and it still shows the error of being unable to connect to the drivers via SPI.

From klippy.log:-

TMC stepper_x failed to init: Unable to write tmc spi ‘stepper_x’ register DRV_CONF
TMC stepper_y failed to init: Unable to write tmc spi ‘stepper_y’ register DRV_CONF
TMC stepper_z failed to init: Unable to write tmc spi ‘stepper_z’ register GLOBALSCALER
TMC extruder failed to init: Unable to write tmc spi ‘extruder’ register DRV_CONF

At this stage I’m up for trying almost anything to get this working if I can.

Was there anything I was meant to add to the printer.cfg file with the change to the firmware and spi_software.c?

Regards,
LiveItNerd

1 Like

No, it is self-contained.

In your logs, you should be able to see that your MCU now has a dirty flag in the version.

DUMP_TMC STEPPER=stepper_x should be enough to check out, I think. As I mentioned in case of unconnected SPI there will be a lot of ff. In case of too fast SCK, I would expect to see garbage here.

Possibly, you can simplify your update by doing:
make; make flash FLASH_DEVICE=/dev/serial/by-id/usb-Klipper_lpc1769_18E0FF1668944BAF71BD7D5DC12000F5-if00


That’s an issue, I don’t know. You may want to try:

  • Flash it with slower lpc1768 firmware, not sure if it helps.
  • TMC2240 supports UART mode, so you can configure it in this mode. (cs_pin → uart_pin, and maybe change jumpers, you can try without touching them).

Generally, it would be helpful, to have someone with this board and SPI drivers, to get the idea if it is already working for someone.
Hmm, looks like there was at least one: Help needed with SKR1.4, TMC5160 and BL Touch Klipper setup

Hi @nefelim4ag ,

Thank you for persisting with me on this! I really appreciate your help.

I’ve attached the DUMP_TMC command output to see if that helps understand what’s going on.
DMP_TMC Log.txt (1.6 KB)

I will give flashing via USB a try tomorrow as the board needs to be put in boot loader mode and I’m tired and don’t want to stuff it up! :slight_smile: As soon as I have results from that I’ll post back here.

Kind Regards,
LiveItNerd

1 Like
22:09:36  // GCONF:      00000000
22:09:36  // GSTAT:      00000000
22:09:36  // IOIN:       00000000 version=0x0
22:09:36  // DRV_CONF:   00000000
22:09:36  // GLOBALSCALER: 00000000
22:09:36  // IHOLD_IRUN: 00000000
22:09:36  // TPOWERDOWN: 00000000
22:09:36  // TSTEP:      00000000
22:09:36  // TPWMTHRS:   00000000
22:09:36  // TCOOLTHRS:  00000000
22:09:36  // THIGH:      00000000
22:09:36  // ADC_VSUPPLY_AIN: 000000

Something is really wrong here, it looks like they are connected and tied to GND.
I have no idea how that can happen.

About UART/SPI:

So, this is a thing to check for SPI and solder for UART.

@nefelim4ag ,

Thank you for all of the help so far. I’ve had a chance to go over everything again and I’m still getting no communications from the TMC2240’s via SPI. As I don’t have a microscope (or 20/20 vision) I will be able to solder the jumper at R4 but am unsure if I can de-solder it if it doesn’t work. Is it possible to run one with UART mode to see if it works before converting them all?

Warm Regards,
LiveItNerd

Yes, of course. You can test just one initially.

Not so fast in saying this - the board will have to be modified to get the TMC2240 in UART communications mode.

SPI/UART mode is controlled by the UART_EN pin on the TMC2240. According to the datasheet, if the pin is low then the chip is in SPI mode. The pin must be pulled high to operate in UART mode.

This was taken from the datasheet which can be found here:

Note that the pin has an internal pull down which means that if there is nothing attached to the pin, it will automatically run in SPI mode.

When I look at the schematic for the board, there is a pull up resistor (R4) defined for the UART_EN pin, but it is not populated:

So, to test a TMC2240 in UART mode, you will have to solder a 4.7k resistor (sorry, I can’t tell you the size) to the R4 pads. Not hard to do but you need to get the right size part and have the soldering tools to attach it to the module.


Honestly, I think you’ve reached the point where you should simply buy a new main controller board - and make sure that the schematics match the pinout diagram. You might want to do a search to see boards that people have gotten the TMC2240 running on to maximize your chances of running without problems.

Based on all the exhaustive analysis above, it seems to me that there is an error somewhere in the SKR V1.4 design and/or documentation.

Hi all,

Thank you for your notes on where to go from here. I hadn’t thought that a resistor would be required and it makes complete sense that it would. There’s no way I’ll be able to install one in this driver as they are maybe 1mm end to end which I think is smaller than the tip of my soldering iron! Yikes!

I’ll take a look at what options I have from here with the main board and motor drivers. I have friends who tinker with their 3D printers so might be able to swap some pieces between us.

Thank you everyone who has contributed to this thread. I have learnt a lot about klipper in the process and have not been scared off by this experience, only emboldened to continue forward.

Warm Regards,
LiveItNerd

2 Likes