BTT Octopus Max EZ and EZ5160 SPI problems

Describe your issue:

Hi. So I am having an issue with my Octopus Max EZ and trying to get the EZ5160 drivers to work. I have the printer config correct as far as I can see but I get continual “Unable to write tmc spi ‘stepper_x’ register GLOBALSCALER” errors. I have tried using the SPI config from the BTT github, and a different one using software SPI and nothing works.
I’m hoping someone can tell me I’m doing something wrong because this is getting absurdly frustrating.

klippy.log (313.4 KB)

Have you checked the jumper settings?

There are no normal jumpers with the EZ drivers. The only jumpers are for using the standard voltage input or the high voltage input. I am just trying to get these to work on 24V first so the jumpers haven’t been changed from the ones that worked just fine with 2209.

1 Like

There are reports of abysmal quality of these EZ5160 driver. I propose to configure only one and try to get it working one at a time.
IIRC hardware SPI is problematic, you need to use software SPI

Yeah I have tried doing one at a time and swapping which motor port they are connected to. It makes no difference. I just get the same error on whichever stepper is using the 5160.
That was why I hoped someone could tell me I’m doing something wrong. I don’t want to go through buying these things again just to have the same problem. I’ve already done that with the EZ31865’s that I gave up on after buying from two different sources.
Yes, I’m using the software SPI config

cs_pin: PG14
spi_software_miso_pin: PE13
spi_software_mosi_pin: PE14
spi_software_sclk_pin: PE12

Your settings seem right. Sorry, no further ideas.
Generally, likely following topics do play a role:

  • Potentially defective drivers
  • Wrong wiring, e.g. coil / phase and polarity mixed up
  • Wiring defects, e.g. broken cable, dislodged connector pins etc.

Yeah I finally found someone who has gotten them to work and confimed the settings.
Its nothing wiring related. I’m adding these drivers to an already working Voron 2.4 and can swap in the 2209’s and have it work perfectly

Does anyone have any experience with this? From the Klipper config docs

I keep getting “Unable to write tmc spi ‘stepper_x’ register …” errors?

This occurs when Klipper is unable to communicate with a tmc2130 or tmc5160 driver.

Make sure that the motor power is enabled, as the stepper motor driver generally needs motor power before it can communicate with the micro-controller.

Otherwise, this error is typically the result of incorrect SPI wiring, an incorrect Klipper configuration of the SPI settings, or an incomplete configuration of devices on an SPI bus.

Note that if the driver is on a shared SPI bus with multiple devices then be sure to fully configure every device on that shared SPI bus in Klipper. If a device on a shared SPI bus is not configured, then it may incorrectly respond to commands not intended for it and corrupt the communication to the intended device. If there is a device on a shared SPI bus that can not be configured in Klipper, then use a static_digital_output config section to set the CS pin of the unused device high (so that it will not attempt to use the SPI bus). The board’s schematic is often a useful reference for finding which devices are on an SPI bus and their associated pins.

In the github BTT says that the LCD, SD card, SPI expansion headers and SPI drivers are all multiplexed. I’m using klipperscreen through a Rasp pi so have no LCD connected and nothing connected to the SPI expansion headers. Is there something I’m missing that I need to configure with a static output? This is over my experience and knowledge level.

Could it be your SPI SCK frequency?

Your klippy.log indicates you used
spi_speed = 1500000
and
spi_speed = 500000

I would give

spi_speed: 4000000

a try here Configuration reference - Klipper documentation.

Good luck, hcet14

I’m not familiar with the BTT Octopus line, but looking at the board docs and spec’s, I see that there are no jumpers for the drivers to for CONFIG or SPI. BTT stats that you just config SPI in firmware.

Can you start by disabling all of your stepper configs except for: [stepper_x] and [tmc5160 stepper_x]? With 10 stepper locations, let’s zoom in and get one working.

Following: GitHub - bigtreetech/Octopus-Max-EZ, stepper_x = Motor 1, your config looks good for step_pin, dir_pin, and enable_pin.

under [tmc5160 stepper_x], the cs_pin is also good, but let’s configure under hardware SPI using these settings:

[tmc5160 stepper_x]]
cs_pin: PG14
spi_bus: spi4
##diag1_pin: PF0
run_current: 0.800
stealthchop_threshold: 999999

If this doesn’t work, add in, under the [tmc5160 stepper_x] section the following:

spi_speed: 4000000

This will force the SPI bus to 4Mhz clock speed, which is the maximum TMC 5160 internal clock speed. Reference Page 25:
5160: https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5160A_Datasheet_Rev1.14.pdf

I have some more testing to perform in the post @hcet14 posted above as I’m seeing some similar issues with multiple devices configured on the SPI bus.

You might also have to add in the following to your Klipper printer.cfg:

#Might prevent communication issues with SPI.
#PE11 = EXP2_4 for SPI Display
#PB12 = SD-CS
#PF14 = SPI4-CS (expansion header)
[static_digital_output disable_display_sdcard_expdhdr]
pins: PE11, PB12, PF14

spi4 on this board is shared between the following devices: TMC Drivers, onboard SD, LCD-FPC (EXP1/EXP2) and SPI Expansion Header.

spi3 is dedicated for WiFi.

Comment from BTT GitHub:
LCD-FPC SPI, Onboard SD card, expansion SPI pin header and TMC driver SPI, 4 features multiplexing the same hardware SPI4, and is converted to 5V to TMC driver

Hope this helps, but keep an eye on my issue as there may be some some changes in Klipper SPI and/or documentation in the near future.

-James

No problem, you got much more experience.

@crashdown might be good to post a DUMP_TMC

It certainly can’t hurt to try. Thanks

Though I have been in contact with a few people using the same board and drivers now and their working configs don’t work in my board so I believe I have defective hardware.

Ok. One question.

Did you also tried different slots on your Octopus Max EZ and of course different drivers in different slots? Maybe you got some bad connection on some slots and bad drivers? I know, that would take some time, but you may find the root cause.

OK so,
I tried everything suggested to the best of my ability. I ## out all stepper configs except the stepper_x

configs tried;
[tmc5160 stepper_x]
cs_pin: PG14
spi_bus: spi4
##diag1_pin: PF0
run_current: 0.800
stealthchop_threshold: 999999

[tmc5160 stepper_x]
cs_pin: PG14
spi_speed: 4000000
spi_bus: spi4
##diag1_pin: PF0
run_current: 0.800
stealthchop_threshold: 999999

[tmc5160 stepper_x]
cs_pin: PG14
spi_speed: 4000000
spi_software_sclk_pin: PE12
spi_software_mosi_pin: PE14
spi_software_miso_pin: PE13
#diag1_pin: PF0
interpolate: False
run_current: 1.0000
sense_resistor: 0.075
stealthchop_threshold: 999999

I added the static pins config and the results never changed at all. Always the Unable to write tmc spi ‘stepper_x’ register GLOBALSCALER

I also have as methodically as I can moved a single 5160 driver from Motor1 to Motor2 and Motor4 and the same fault follows with stepper_y and stepper_z. I tried it with one 5160 driver, then the other being careful to keep them well seperated so they could not be mixed up. Nothing changed.
Always as soon as I swap the 2209 back in it works just as flawlessly as always.

Thankyou everyone for giving your time and suggestions. I’m pretty happy that its a hardware problem, and well, if its not then its more trouble than its worth.

Because it was suggested though;
appologies for the format, The TMC dump is inverted

TSTEP: 0007ffff tstep=524287
PWM_AUTO: 0000000c pwm_ofs_auto=12
PWM_SCALE: 00000000
OTP_READ: 00000006 otp_fclktrim=6
MSCURACT: 00730000 cur_b=115
MSCNT: 00000000
LOST_STEPS: 00000000
IOIN: 10000000 version=0x10
FACTORY_CONF: 00000006 factory_conf=6
DRV_STATUS: 80000000 stst=1
GSTAT: 00000000
CHOPCONF: 00000000 mres=0(256usteps)
GCONF: 00000000
========== Queried registers =========
TPOWERDOWN: 0000000a tpowerdown=10
PWMCONF: c40c001e pwm_ofs=30 pwm_autoscale=1 pwm_autograd=1 pwm_reg=4 pwm_lim=12
DRV_CONF: 00000400 bbmclks=4
COOLCONF: 00000000
TPWMTHRS: 00000000
MSLUTSTART: 00f70000 start_sin90=247
MSLUTSEL: ffff8056 w0=2 w1=1 w2=1 w3=1 x1=128 x2=255 x3=255
MSLUT7: 00404222 mslut7=4211234
MSLUT6: 49295556 mslut6=1227445590
MSLUT5: b5bb777d mslut5=3048961917
MSLUT4: fbffffff mslut4=4227858431
MSLUT3: 10104222 mslut3=269500962
MSLUT2: 24492929 mslut2=608774441
MSLUT1: 4a9554aa mslut1=1251300522
MSLUT0: aaaab554 mslut0=2863314260
IHOLD_IRUN: 00061f1f ihold=31 irun=31 iholddelay=6
GLOBALSCALER: 00000043 globalscaler=67
========== Write-only registers ==========
DUMP_TMC STEPPER=stepper_x

Being that your stepper_x is setup with:

microsteps = 64

And the DUMP_TMC is reporting:

CHOPCONF: 00000000 mres=0(256usteps)

Is defiantly showing me that SPI communications is not working.

If you have a logic analyzer, you could capture some data there and it may help to tell what is going on.

My guess hardware, but is it the Octopus or driver is the next question?

TMC2209 do not use SPI, so it could still be the board.

To which configuration fits your posted TMC dump? 1st, 2nd, or 3rd?

Ok, yeah that was what I assumed but I have never read these things before. All the zero’s didn’t look right straight away.

I don’t have anything like an analyser I’m afraid or the experience to use one, and yeah, I really just wanted to know is it the board or the drivers.

The TMC dump is from the third config listed. I tried it last and then did the dump.

So I guess what I might do is buy one more ez5160 just to give it a go and if that doesn’t work I’ll have to think if I want to replace the board or just move on to something different. The Mellow external 5160’s look good, I just didn’t want to have to deal with more wiring and more space taken up in the electronics area.

Thanks again for everyones input.

Hello @crashdown

I have the Octopus Max EZ working fine im my voron 0.2 (that i was planning to transform in a fzero, that´s why this board). I have this problem with spi when commissioning, and figure out to solve.
First, connecting the adxl like the datasheet says, broken the spi communication.
The way i solved was looking at the jumpers and setting then strictly according to board´s datasheet, even in the slots that you´re not using (without drivers i mean).
If you could send a photo of you board setup, I can compare with mine (i´m new here, and in the learning curve).
And sorry for any english errors…

Cheers from Brazil

OK, so after buying a third 5160 driver and inserting it … it didn’t work.
:frowning_face:

But I found someone who was having problems getting their ez31865 to work and they had fixed it with a static output just on the sd card slot pin.
I tried that and the thing worked.
I then slotted in the two original 5160 drivers and they worked too.

I can’t believe it but we were on the right track, just narrowly missing it.

[static_digital_output my_output_pins]
pins:!PB12

A stupid exclamation point was all that stopped it working before with the static output suggested by jjarosz. I didn’t think to try that with it at the time.

Thankyou again everyone for helping.

6 Likes