[FluidNC Issue#1446] Problem: TMC Driver not detected

未分类 bolang 4个月前 (10-14) 44次浏览

Issue #1446 | 状态: 已关闭 | 作者: NEWTech-Creative | 创建时间: 2025-02-04


Wiki Search Terms

TMC Driver not detected, TMC5160, rsenseohms

Controller Board

Experimental board: Root Controller Pro (6axis TMC5160 board).

Machine Description

6 motors attached for testing- no machine

Input Circuits

No inputs at this stage

Configuration file

board: Root Controller STEP
name: TMC5160 XYZABC
stepping:
  engine: I2S_STREAM
  idle_ms: 255
  pulse_us: 4
  dirdelayus: 0
  disabledelayus: 0

axes: sharedstepperdisable_pin: I2SO.4:low x: stepspermm: 400 maxratemmpermin: 5000.000 accelerationmmper_sec2: 50.000 maxtravelmm: 800 soft_limits: true homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 500.000 seekmmper_min: 200.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.39 hard_limits: false pulloff_mm: 1.500 tmc_5160: cs_pin: i2so.2 rsenseohms: 0.05 run_amps: 1.0 hold_amps: 0.5 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: StealthChop homing_mode: StealthChop use_enable: false step_pin: I2SO.1 direction_pin: I2SO.0:low disable_pin: I2SO.15

a: stepspermm: 80.000 maxratemmpermin: 8000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 9999 soft_limits: false homing: cycle: 0 positive_direction: false mpos_mm: 150.000 feedmmper_min: 100.000 seekmmper_min: 200.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: NO_PIN hard_limits: false pulloff_mm: 1.000 tmc_5160: cs_pin: i2so.14 rsenseohms: 0.05 run_amps: 2.5 hold_amps: 0.50 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: StealthChop homing_mode: StealthChop use_enable: false step_pin: I2SO.13 direction_pin: I2SO.12 disable_pin: I2SO.11

b: stepspermm: 200.000 maxratemmpermin: 5000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 9999 soft_limits: false homing: cycle: 0 positive_direction: false mpos_mm: 150.000 feedmmper_min: 100.000 seekmmper_min: 200.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: NO_PIN hard_limits: false pulloff_mm: 1.000 tmc_5160: cs_pin: i2so.10 rsenseohms: 0.05 run_amps: 2.5 hold_amps: 1.2 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: StealthChop homing_mode: StealthChop use_enable: false step_pin: I2SO.9 direction_pin: I2SO.8 disable_pin: I2SO.23

y: stepspermm: 40 maxratemmpermin: 5000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 9999 soft_limits: false homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 500.000 seekmmper_min: 200.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.32:pu hard_limits: false pulloff_mm: 1.50 tmc_5160: cs_pin: i2so.22 rsenseohms: 0.05 run_amps: 2.5 hold_amps: 1.2 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: StealthChop homing_mode: StealthChop use_enable: false step_pin: I2SO.21 direction_pin: I2SO.20:low disable_pin: I2SO.19

c: stepspermm: 200.000 maxratemmpermin: 5000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 9999 soft_limits: false homing: cycle: 0 positive_direction: false mpos_mm: 150.000 feedmmper_min: 300.000 seekmmper_min: 500.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: NO_PIN hard_limits: false pulloff_mm: 1.000 tmc_5160: cs_pin: i2so.18 rsenseohms: 0.05 run_amps: 1.75 hold_amps: 0.50 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: StealthChop homing_mode: StealthChop use_enable: false step_pin: I2SO.17 direction_pin: I2SO.16 disable_pin: I2SO.31 z: stepspermm: 40 maxratemmpermin: 5000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 9999 soft_limits: false homing: cycle: 1 positive_direction: true mpos_mm: 0.000 feedmmper_min: 500.000 seekmmper_min: 200.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.36 hard_limits: false pulloff_mm: 1.500 tmc_5160: cs_pin: i2so.30 rsenseohms: 0.05 run_amps: 2.5 hold_amps: 1.2 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: StealthChop homing_mode: StealthChop use_enable: false step_pin: I2SO.29 direction_pin: I2SO.28:low disable_pin: I2SO.27

i2so: bck_pin: gpio.22 data_pin: gpio.12 ws_pin: gpio.21

spi: miso_pin: gpio.19 mosi_pin: gpio.23 sck_pin: gpio.18

sdcard: carddetectpin: NO_PIN cs_pin: gpio.5

control: safetydoorpin: NO_PIN resetpin: NOPIN feedholdpin: NO_PIN cyclestartpin: gpio.26 macro0pin: NOPIN macro1pin: NOPIN macro2pin: NOPIN macro3pin: NOPIN

probe: pin: gpio.15 checkmodestart: true

macros: startup_line0: startup_line1: macro0: macro1: macro2: macro3:

user_outputs: analog0pin: NOPIN analog1pin: NOPIN analog2pin: NOPIN analog3pin: NOPIN analog0_hz: 5000 analog1_hz: 5000 analog2_hz: 5000 analog3_hz: 5000 digital0_pin: gpio.33 digital1_pin: I2SO.5:low digital2_pin: I2SO.6 digital3_pin: I2SO.7 digital4_pin: I2SO.3 digital5_pin: gpio.13

start: must_home: false

i2c0: sda_pin: gpio.14 scl_pin: gpio.27 oled: i2c_num: 0 i2c_address: 60 width: 128 height: 64 Huanyang: uart: txd_pin: gpio.17 rxd_pin: gpio.16 rts_pin: gpio.4 baud: 9600 mode: 8N1 modbus_id: 1 tool_num: 0 speed_map: 0=0% 0=25% 6000=25% 24000=100% offonalarm: false parking: enable: true axis: Z pulloutdistancemm: 10.000 pulloutratemmpermin: 250.000 targetmposmm: -5.000 ratemmper_min: 800.000

Startup Messages

[MSG: ERR: X Axis TMC driver not detected - expected 0x30 got 0x0]
[MSG: INFO: Y Axis driver test passed]
[MSG: ERR: Z Axis TMC driver not detected - expected 0x30 got 0xff]
[MSG: ERR: A Axis TMC driver not detected - expected 0x30 got 0xfe]
[MSG: INFO: B Axis driver test passed]
[MSG: INFO: C Axis driver test passed]

User Interface Software

WebUI 2 and 3

What happened?

I recently updated firmware on an experimental control board using TMC5160 drivers to the latest version of fluidnc and started experiencing issues where the TMC drivers were not being detected. The error was inconsistent—different axes would randomly fail to be detected on each restart.

After troubleshooting, I rolled back to previous versions of FluidNC and found that v3.8.2 was the last working version where all 6 of the TMC5160 drivers functioned correctly. I’m using a 6-axis setup.

I’ve tried several solutions, including:
• Erasing and reinstalling FluidNC
• Running $MI
• Testing different variations of the YAML configuration file

However, none of these attempts have resolved the issue.

Example error:

[MSG: ERR: X Axis TMC driver not detected – expected 0x30 got 0x0]
[MSG: INFO: Y Axis driver test passed]
[MSG: ERR: Z Axis TMC driver not detected – expected 0x30 got 0xff]
[MSG: ERR: A Axis TMC driver not detected – expected 0x30 got 0xfe]
[MSG: INFO: B Axis driver test passed]
[MSG: INFO: C Axis driver test passed]

I’ve had the board for a year and no issues until updated to newer firmware.

Any suggestions on what might be causing this?

GCode File

N/A

Other Information

No response


评论 (26)

#1 – bdring 于 2025-02-04

Have you contacted the supplier of the controller?


#2 – bdring 于 2025-02-04

Try changing your minpulseus is2o setting.

http://wiki.fluidnc.com/en/config/config_IO#i2so-section


#3 – NEWTech-Creative 于 2025-02-05

Thank you for your guidance, Bart.

I have already discussed this issue with RootCNC and suggested posting here since the board has been working reliably for the past year but started encountering issues with the later versions.

To troubleshoot, I updated my YAML configuration to include the following:

i2so:
bck_pin: gpio.22
data_pin: gpio.12
ws_pin: gpio.21
minpulseus: 4

However, after adding this configuration, all TMC drivers were reported as non-responsive, returning the following errors:

[MSG:ERR: X Axis TMC driver not detected – expected 0x30, got 0xff]
[MSG:ERR: Y Axis TMC driver not detected – expected 0x30, got 0xff]
[MSG:ERR: Z Axis TMC driver not detected – expected 0x30, got 0x0]
[MSG:ERR: A Axis TMC driver not detected – expected 0x30, got 0x0]
[MSG:ERR: B Axis TMC driver not detected – expected 0x30, got 0xff]
[MSG:ERR: C Axis TMC driver not detected – expected 0x30, got 0xff]

I then experimented with different minpulseus values:
– 4 and 2 µs: The X-axis motor driver seemed to function, but the other axes only moved slightly before becoming unresponsive.
– 1 µs: All TMC driver tests passed, but there was no motor movement at all.

Finally, I rolled back to v3.8.2, and everything returned to normal—all TMC drivers passed successfully, and movement was restored without errors.

This board uses the same SN74HCS595DR shift registers as the Root Controller ISO, so I suspect the issue might be related to firmware changes affecting the driver communication.

Let me know if I’ve missed anything in testing or require more information?


#4 – bdring 于 2025-02-05

Try sending $Motors/Init

http://wiki.fluidnc.com/en/features/commandsandsettings#motorsinit-or-mi

If that works it could be related to a timing problem. Also try I2SSTATIC instead of I2SSTREAM


#5 – MitchBradley 于 2025-02-05

We don’t have access to a Root Controller so debugging it is going to be very difficult. I for one do not have time to debug by remote control with a human intermediary. If I had a Root Controller and they sponsored the project that they make money from, I would be happy to try and figure out what is going wrong.


#6 – NEWTech-Creative 于 2025-02-07

Thank you for your response, Bart.

I have tested using I2S_STATIC as suggested, but unfortunately, it did not resolve the issue. I agree that this appears to be a timing-related problem, possibly linked to changes in TMC behavior in FluidNC 3.9.x and beyond.

As you know, I have always supported and promoted FluidNC purely out of passion and have never sought direct assistance beyond community discussions. I truly appreciate the time and effort you and the team dedicate to its development.

I understand that debugging hardware remotely can be challenging. Given the circumstances, I will continue using an older version of FluidNC that remains stable for my setup.

Thank you again for your help.


#7 – 3404gerber 于 2025-02-07

Hi all,

It’s been a couple of months now that I switched to Linuxcnc with my TMC5160 drivers, but I spent many hours reading the FluidNC source code last years. I was wondering: could it be a timing problem? I know from the datasheet that the CS pin has to be low for a given time before you can start to send data on the SPI bus. If you use a “slow” I2S pin as chip select, maybe there should be a short wait time in the code before you start to send the SPI message.


#8 – MitchBradley 于 2025-02-07

It is probably something like that, but I for one don’t have time to try stuff without access to hardware to test on a short debug cycle. If I had the hardware I could just scope it and see what is wrong. But making code changes and having someone else tell me if it worked, whenever they can get around to it, takes more time than I can spare given all the other things I am working on.


#9 – 3404gerber 于 2025-02-08

I understand, I was rather thinking that NEWTech could give it a try.


#10 – msetilley 于 2025-02-13

I have the same issue with a 6-Pack controller board. Upgraded from 3.7.10 to 3.9.4 and started seeing the same problem with TMC2130 drivers. My 6-pack controller is a bit older (V1P5). I have a set of 5160 drivers I can try to see if they also have the same issue, but this machine worked fine (I used it just prior to the update in case I screwed something up).

Initial config

board: 6 Pack
name: TMC2130 XYZ
meta: 
stepping:
  engine: I2S_STATIC
  idle_ms: 250
  pulse_us: 4
  dirdelayus: 0
  disabledelayus: 0
  segments: 12

spi: miso_pin: gpio.19 mosi_pin: gpio.23 sck_pin: gpio.18

axes: sharedstepperdisablepin: NOPIN x: stepspermm: 1600.000 maxratemmpermin: 1500.000 accelerationmmper_sec2: 100.000 maxtravelmm: 374.000 soft_limits: true homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 100.000 seekmmper_min: 200.000 seek_scaler: 1.100 feed_scaler: 1.100 motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.33:low hard_limits: true pulloff_mm: 2.000 tmc_2130: cs_pin: i2so.3 rsenseohms: 0.110 run_amps: 1.00 hold_amps: 0.750 microsteps: 16 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false step_pin: I2SO.2 direction_pin: I2SO.1 disable_pin: I2SO.0

y: stepspermm: 1600.000 maxratemmpermin: 1500.000 accelerationmmper_sec2: 100.000 maxtravelmm: 392.000 soft_limits: true homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 100.000 seekmmper_min: 200.000 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.32:low hard_limits: true pulloff_mm: 2.000 tmc_2130: cs_pin: i2so.6 rsenseohms: 0.110 run_amps: 1.00 hold_amps: 0.750 microsteps: 16 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false step_pin: I2SO.5 direction_pin: I2SO.4 disable_pin: I2SO.7

z: stepspermm: 1600.000 maxratemmpermin: 1500.000 accelerationmmper_sec2: 100.000 maxtravelmm: 100.000 soft_limits: true homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 100.000 seekmmper_min: 200.000 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.35:low hard_limits: false pulloff_mm: 2.000 tmc_2130: cs_pin: i2so.11 rsenseohms: 0.110 run_amps: 1.00 hold_amps: 0.750 microsteps: 16 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false step_pin: I2SO.10 direction_pin: I2SO.9 disable_pin: I2SO.8

i2so: bck_pin: gpio.22 data_pin: gpio.21 ws_pin: gpio.17 minpulseus: 2

sdcard: cspin: NOPIN carddetectpin: NO_PIN frequency_hz: 8000000

kinematics: Cartesian:

control: safetydoorpin: NO_PIN resetpin: NOPIN feedholdpin: NO_PIN cyclestartpin: NO_PIN macro0pin: NOPIN macro1pin: NOPIN macro2pin: NOPIN macro3pin: NOPIN faultpin: NOPIN estoppin: NOPIN

coolant: floodpin: NOPIN mistpin: NOPIN delay_ms: 0

probe: pin: gpio.34 checkmodestart: true

macros: startup_line0: startup_line1: Macro0: Macro1: Macro2: Macro3: after_homing: after_reset: after_unlock:

start: must_home: true

YL620: uart: txd_pin: gpio.26 rxd_pin: gpio.16 rts_pin: gpio.4 baud: 9600 mode: 8N1 modbus_id: 1 tool_num: 0 speed_map: 0=0% 0=25% 6000=25% 24000=100%

parking: enable: false axis: Z targetmposmm: -5.000000 ratemmper_min: 800.000000 pulloutdistancemm: 5.000000 pulloutratemmpermin: 250.000000

user_outputs: analog0pin: NOPIN analog1pin: NOPIN analog2pin: NOPIN analog3pin: NOPIN analog0_hz: 5000 analog1_hz: 5000 analog2_hz: 5000 analog3_hz: 5000 digital0pin: NOPIN digital1pin: NOPIN digital2pin: NOPIN digital3pin: NOPIN digital4pin: NOPIN digital5pin: NOPIN digital6pin: NOPIN digital7pin: NOPIN

user_inputs: analog0pin: NOPIN analog1pin: NOPIN analog2pin: NOPIN analog3pin: NOPIN digital0pin: NOPIN digital1pin: NOPIN digital2pin: NOPIN digital3pin: NOPIN digital4pin: NOPIN digital5pin: NOPIN digital6pin: NOPIN digital7pin: NOPIN

arctolerancemm: 0.002000 junctiondeviationmm: 0.010000 verbose_errors: true report_inches: false enableparkingoverride_control: false uselinenumbers: false planner_blocks: 16

I have tried

i2so:
  bck_pin: gpio.22
  data_pin: gpio.21
  ws_pin: gpio.17
  minpulseus: 4

This didn’t help either, it seemed worse since it was no longer random and no drivers passed at all no matter how many times I repeated it.

Issue is the same, drivers randomly fail their test, although I have had all three pass and work for long enough to home / jog the machine around but its uncommon.

$MI
[MSG:INFO: X Axis driver test passed]
[MSG:ERR: Y Axis TMC driver not detected - expected 0x11 got 0xfc]
[MSG:ERR: Z Axis TMC driver not detected - expected 0x11 got 0xff]
ok
$MI
[MSG:ERR: X Axis TMC driver not detected - expected 0x11 got 0xfe]
[MSG:INFO: Y Axis driver test passed]
[MSG:ERR: Z Axis TMC driver not detected - expected 0x11 got 0xff]
ok
$MI
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
ok


#11 – msetilley 于 2025-02-14

I installed v3.8.3 to verify the original post and confirmed TMC2130 drivers all pass and everything works as expected.

The v3.8.3 config had minpulseus removed and some other config that caused a startup error, config used is below.

board: 6 Pack
name: TMC2130 XYZ
meta: 
stepping:
  engine: I2S_STATIC
  idle_ms: 250
  pulse_us: 4
  dirdelayus: 0
  disabledelayus: 0
  segments: 12

spi: miso_pin: gpio.19 mosi_pin: gpio.23 sck_pin: gpio.18

axes: sharedstepperdisablepin: NOPIN x: stepspermm: 1600.000 maxratemmpermin: 1500.000 accelerationmmper_sec2: 100.000 maxtravelmm: 374.000 soft_limits: true homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 100.000 seekmmper_min: 200.000 seek_scaler: 1.100 feed_scaler: 1.100 motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.33:low hard_limits: true pulloff_mm: 2.000 tmc_2130: cs_pin: i2so.3 rsenseohms: 0.110 run_amps: 1.00 hold_amps: 0.750 microsteps: 16 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false step_pin: I2SO.2 direction_pin: I2SO.1 disable_pin: I2SO.0

y: stepspermm: 1600.000 maxratemmpermin: 1500.000 accelerationmmper_sec2: 100.000 maxtravelmm: 392.000 soft_limits: true homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 100.000 seekmmper_min: 200.000 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.32:low hard_limits: true pulloff_mm: 2.000 tmc_2130: cs_pin: i2so.6 rsenseohms: 0.110 run_amps: 1.00 hold_amps: 0.750 microsteps: 16 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false step_pin: I2SO.5 direction_pin: I2SO.4 disable_pin: I2SO.7

z: stepspermm: 1600.000 maxratemmpermin: 1500.000 accelerationmmper_sec2: 100.000 maxtravelmm: 100.000 soft_limits: true homing: cycle: 2 positive_direction: true mpos_mm: 0.000 feedmmper_min: 100.000 seekmmper_min: 200.000 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: gpio.35:low hard_limits: false pulloff_mm: 2.000 tmc_2130: cs_pin: i2so.11 rsenseohms: 0.110 run_amps: 1.00 hold_amps: 0.750 microsteps: 16 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false step_pin: I2SO.10 direction_pin: I2SO.9 disable_pin: I2SO.8

i2so: bck_pin: gpio.22 data_pin: gpio.21 ws_pin: gpio.17

sdcard: cspin: NOPIN carddetectpin: NO_PIN frequency_hz: 8000000

kinematics: Cartesian:

control: safetydoorpin: NO_PIN resetpin: NOPIN feedholdpin: NO_PIN cyclestartpin: NO_PIN macro0pin: NOPIN macro1pin: NOPIN macro2pin: NOPIN macro3pin: NOPIN faultpin: NOPIN estoppin: NOPIN

coolant: floodpin: NOPIN mistpin: NOPIN delay_ms: 0

probe: pin: gpio.34 checkmodestart: true

macros: startup_line0: startup_line1: Macro0: Macro1: Macro2: Macro3: after_homing: after_reset: after_unlock:

start: must_home: true

YL620: uart: txd_pin: gpio.26 rxd_pin: gpio.16 rts_pin: gpio.4 baud: 9600 mode: 8N1 modbus_id: 1 tool_num: 0 speed_map: 0=0% 0=25% 6000=25% 24000=100%

parking: enable: false

arctolerancemm: 0.002000 junctiondeviationmm: 0.010000 verbose_errors: true report_inches: false enableparkingoverride_control: false uselinenumbers: false planner_blocks: 16


#12 – bdring 于 2025-02-14

I think I have enough TMC2130s to try some experiments on a 6 pack. I’ll look at the timing on a logic analyzer.

My desk is covered in other setups right now. This may take a few days.


#13 – bdring 于 2025-02-14

I created a 5x 2130 setup on a 6 pack. On the latest release I get similar results to you. Sometimes all work and sometimes 1 or 2 don’t pass.

3.8.3 works fine. I will put it on a logic analyzer when I get time.


#14 – bdring 于 2025-02-14

As a complete hack to test the timing I added a delay when enabling the CS.

TMC2130Stepper.cpp in the TMCStepper library.

attribute((weak))
void TMC2130Stepper::switchCSpin(bool state) {
  digitalWrite(_pinCS, state);
  if (!state) {
      delayMicroseconds(10);
  }
}

Now it works every time.

$mi
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: A Axis driver test passed]
[MSG:INFO: B Axis driver test passed]
ok
$mi
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: A Axis driver test passed]
[MSG:INFO: B Axis driver test passed]
ok
$mi
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: A Axis driver test passed]
[MSG:INFO: B Axis driver test passed]
ok
$mi
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: A Axis driver test passed]
[MSG:INFO: B Axis driver test passed]
ok
$mi
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: A Axis driver test passed]
[MSG:INFO: B Axis driver test passed]
ok
$mi
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: A Axis driver test passed]
[MSG:INFO: B Axis driver test passed]
ok

Ideally we don’t modify the library and only add the delay if it is a i2so pin. The function is weak, so there probably better ways to do it.


#15 – MitchBradley 于 2025-02-14

The override is in src/Pins/PinMapper.cpp:
c++
void IRAMATTR digitalWrite(pinnumt pin, uint8_t val) {
...
thePin->synchronousWrite(val);

For I2SO, that delegates to src/Pins/I2SOPinDetail.cpp:

c++
void IRAM_ATTR I2SOPinDetail::synchronousWrite(int high) {
...
i2soutwrite(index, inverted ^ (bool)high);
i2soutdelay();

which invokes esp32/i2s_engine.c:

c
void i2soutdelay() {
// Depending on the timing, it may not be reflected immediately,
// so wait twice as long just in case.
uint32t waitcounts = timerrunning ? FIFOTHRESHOLD + FIFO_RELOAD : 2;
delayus(i2sframeus * waitcounts);
}

I tried to calculate the delay based on the depth of the FIFO but maybe I made a mistake, or maybe a little extra slop is needed. It would be nice to know, based on logic analyzer measurements, whether the existing delay is sufficient for the write to clear the FIFO.


#16 – bdring 于 2025-02-14

With 3.8.3 the timing does not change much.

!Image

With 3.9.4 it is all over the place. This was a particularly bad one.

$MI
[MSG:ERR: X Axis TMC driver not detected - expected 0x11 got 0xff]
[MSG:ERR: Y Axis TMC driver not detected - expected 0x11 got 0xfc]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: A Axis driver test passed]
[MSG:ERR: B Axis TMC driver not detected - expected 0x11 got 0xff]
ok

!Image


#17 – MitchBradley 于 2025-02-14

It is hard to compare those two with their differing time bases.


#18 – MitchBradley 于 2025-02-14

Also why is the clock not toggling consistently? Too slow sampling?


#19 – MitchBradley 于 2025-02-14

If it is missing clocks due to slow sampling, I wonder if it is also missing data, in which case the measurements are questionable.


#20 – bdring 于 2025-02-14

I was capturing on the CS of the first chip. This one is the least likely to fail. I moved it to the second chip for this plot and set the rate at 20MHz. It is obviously out of sync here.

!Image


#21 – bdring 于 2025-02-14

I can attach the capture file if you want to load it in DS Scope.


#22 – MitchBradley 于 2025-02-14

What happens if you change the 2 in the next line to, say, 6? (esp32/i2s_engine.c) ?

   uint32t waitcounts = timerrunning ? FIFOTHRESHOLD + FIFO_RELOAD : 2;


#23 – 3404gerber 于 2025-02-22

> As a complete hack to test the timing I added a delay when enabling the CS.
>
> TMC2130Stepper.cpp in the TMCStepper library.
>
> attribute((weak))
> void TMC2130Stepper::switchCSpin(bool state) {
> digitalWrite(_pinCS, state);
> if (!state) {
> delayMicroseconds(10);
> }
> }
>
> Now it works every time.
> …

>
> Ideally we don’t modify the library and only add the delay if it is a i2so pin. The function is weak, so there probably better ways to do it.

Why not simply add a delay in esp32/tmc_spi.cpp, after each switchCSpin? Maybe not the most elegant way to do it, but bullet proof.

>void TMC2130Stepper::write(uint8t reg, uint32t data) {
> logverbose(“TMC reg ” << tohex(reg) << " write " << to_hex(data)); > tmcspibus_setup();
>
> switchCSpin(0);
> add a short delay here?
> tmcspirwreg(reg | 0x80, data, linkindex);
> and here?
> switchCSpin(1);
}

Another question: do I understand it correctly, if I read in the file esp32/tmcspisupport.c that the spi bus is initialised each time with 2MHz frequency? Here is the code:

>if (clkregval == 0) {
> spillmastercalclock(SPILLPERIPHCLKFREQ, 2000000, 128, &clkregval);
> }

Because on the other side, in theTMC5160Driver.cpp file, there is a part of code “saying” that in case we use a I2S CS pin, the SPI speed should be only 100kHz:

> // use slower speed if I2S
> if (cspin.capabilities().has(Pin::Capabilities::I2S)) {
> tmc5160->setSPISpeed(spifreq);
> }

I remember that I also had communication issues in the beginning, but it was with increased number of daisy chained drivers, and I ended up overwritting the value in the tmcspisupport.c file.


#24 – abcpibot 于 2025-04-05

Hello everyone, I’m glad to see this discussion thread. I’m also encountering the same issue. (my board layout like X6)When using version 3.9.4, sometimes the TMC5160 is detected and sometimes it isn’t. After reverting to version 3.8.3, the TMC5160 works normally, but I still ran into another problem: after using the TMC5160 driver, my SD card stops responding(3.9.4 and 3.8.3 same). If I switch back to the original en, dir, clk, and gnd setup, everything works fine again. Below is my YAML test file.

board: PiBotV49PB
name: TMC5160_Test
stepping:
  engine: I2S_STATIC
  idle_ms: 254
  pulse_us: 8
  dirdelayus: 1
  disabledelayus: 0

axes: sharedstepperdisablepin: NOPIN x: stepspermm: 800.000 maxratemmpermin: 5000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 300.000 soft_limits: false homing: cycle: 2 positive_direction: false mpos_mm: 150.000 feedmmper_min: 100.000 seekmmper_min: 200.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: gpio.33:low limitpospin: gpio.32:low limitallpin: NO_PIN hard_limits: false pulloff_mm: 1.000 tmc_5160: rsenseohms: 0.1 run_amps: 0.75 hold_amps: 0.1 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false cs_pin: i2so.16 step_pin: I2SO.2 direction_pin: I2SO.1 disable_pin: I2SO.0

#####ms1 ms2 use the board capnut y: stepspermm: 800.000 maxratemmpermin: 5000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 300.000 soft_limits: false homing: cycle: 2 positive_direction: true mpos_mm: 150.000 feedmmper_min: 100.000 seekmmper_min: 200.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: gpio.35:low limitpospin: gpio.34:low limitallpin: NO_PIN hard_limits: false pulloff_mm: 1.000 tmc_5160: rsenseohms: 0.1 run_amps: 0.75 hold_amps: 0.1 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: StealthChop homing_mode: StealthChop use_enable: false cs_pin: i2so.18 step_pin: I2SO.5 direction_pin: I2SO.4 disable_pin: I2SO.7

z: stepspermm: 800.000 maxratemmpermin: 5000.000 accelerationmmper_sec2: 100.000 maxtravelmm: 300.000 soft_limits: false homing: cycle: 1 positive_direction: true mpos_mm: 150.000 feedmmper_min: 100.000 seekmmper_min: 800.000 settle_ms: 500 seek_scaler: 1.100 feed_scaler: 1.100

motor0: limitnegpin: NO_PIN limitpospin: NO_PIN limitallpin: NO_PIN hard_limits: false pulloff_mm: 1.000 tmc_5160: rsenseohms: 0.075 run_amps: 0.75 hold_amps: 0.1 microsteps: 32 stallguard: 0 stallguard_debug: false toff_disable: 0 toff_stealthchop: 5 toff_coolstep: 3 run_mode: CoolStep homing_mode: CoolStep use_enable: false cs_pin: I2SO.17 step_pin: I2SO.10 direction_pin: I2SO.9 disable_pin: I2SO.8

i2so: bck_pin: gpio.22 data_pin: gpio.21 ws_pin: gpio.17

spi: miso_pin: gpio.19 mosi_pin: gpio.23 sck_pin: gpio.18

sdcard: carddetectpin: NO_PIN cs_pin: gpio.5 frequency_hz: 1000000

probe: pin: gpio.2:pu toolsetterpin: NOPIN checkmodestart: true hard_stop: false

start: must_home: false

Begin relay

relay: directionpin: NOPIN output_pin: gpio.26 enablepin: NOPIN disablewiths0: false s0withdisable: true spinup_ms: 0 spindown_ms: 0 tool_num: 0 speed_map: 0=0.000% 0=100.000% 1=100.000% offonalarm: false

Begin PWM

pwm: pwm_hz: 5000 directionpin: NOPIN output_pin: gpio.4 enablepin: NOPIN disablewiths0: false s0withdisable: true spinup_ms: 0 spindown_ms: 0 tool_num: 1 speed_map: 0=0.000% 10000=100.000% offonalarm: false

Begin Laser

Laser: pwm_hz: 5000 output_pin: gpio.12 enablepin: NOPIN disablewiths0: false s0withdisable: true tool_num: 2 speed_map: 0=0.000% 255=100.000% offonalarm: true

Begin 10V

10V: forwardpin: NOPIN reversepin: NOPIN pwm_hz: 5000 output_pin: gpio.13 enablepin: NOPIN directionpin: NOPIN disablewiths0: false s0withdisable: true spinup_ms: 0 spindown_ms: 0 tool_num: 3 speed_map: 0=0.000% 1000=0.000% 24000=100.000% offonalarm: false

Begin mpg

uart1: txd_pin: gpio.27 rxd_pin: gpio.25 rtspin: NOPIN ctspin: NOPIN baud: 115200 mode: 8N1

uart_channel1: reportintervalms: 75 uart_num: 1


#25 – abcpibot 于 2025-04-05

Grbl 3.8 [FluidNC v3.8.3 (wifi) ‘$’ for help]
$SD/LIST
[MSG:ERR: sdmmccardinit failed code 0x107]
[MSG:ERR: filesystem error: SD card is inaccessible: ESPERRTIMEOUT]
error:60
[MSG:ERR: Failed to mount device]


#26 – abcpibot 于 2025-04-05

I change the frequency_hz for SDCARD, but still not works, thanks


原始Issue: https://github.com/bdring/FluidNC/issues/1446

喜欢 (0)