bdring / FluidNC

The next generation of motion control firmware
Other
1.63k stars 387 forks source link

FluidNC 3.4.7 fails to init motors. Hardware configuration works fine in ESP32_Grbl #493

Closed bDuthieDev closed 2 years ago

bDuthieDev commented 2 years ago

Controller Board

6-pack V1p5 6/2020

Help From Board Vendor

Machine Description

XYYZA configuration with no motor connected to A at this time

Configuration file

name: 6-pack 2130sg XYYZA 4xIn 4x5v 10vCNC (v6)
board: 6-pack

kinematics:
  Cartesian:

stepping:
  engine: I2S_static
  idle_ms: 255
  dir_delay_us: 0
  pulse_us: 4
  disable_delay_us: 0

axes:
  x:
    steps_per_mm: 100.000
    max_rate_mm_per_min: 1000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 600.000
    soft_limits: true
    homing:
      cycle: 2
      mpos_mm: 0.000
      positive_direction: true
      settle_ms: 250.000
      seek_mm_per_min: 2000.000
      feed_mm_per_min: 200.000
      seek_scaler: 1.100
      feed_scaler: 5.000
    motor0:
      limit_all_pin: gpio.33:low
      hard_limits: false
      tmc_2130:
        direction_pin: i2so.1
        step_pin: i2so.2
        disable_pin: i2so.0
        run_amps: 1.250
        hold_amps: 0.250
        microsteps: 16
        stallguard: 16
        stallguard_debug: false
        run_mode: CoolStep
        homing_mode: Stallguard
        use_enable: false
        r_sense_ohms: 0.110
        cs_pin: i2so.3:low
    motor1:
      null_motor:
  y:
    steps_per_mm: 100.000
    max_rate_mm_per_min: 1000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 640.000
    soft_limits: true
    homing:
      cycle: 2
      mpos_mm: 0.000
      positive_direction: true
      settle_ms: 250.000
      seek_mm_per_min: 2000.000
      feed_mm_per_min: 200.000
      seek_scaler: 1.100
      feed_scaler: 5.000
    motor0:
      limit_all_pin: gpio.32:low
      hard_limits: false
      tmc_2130:
        direction_pin: i2so.4
        step_pin: i2so.5
        disable_pin: i2so.7
        run_amps: 0.950
        hold_amps: 0.250
        microsteps: 8
        stallguard: 4
        stallguard_debug: false
        run_mode: CoolStep
        homing_mode: Stallguard
        use_enable: false
        r_sense_ohms: 0.110
        cs_pin: i2so.6:low
    motor1:
      limit_all_pin: gpio.35:low
      hard_limits: false
      tmc_2130:
        direction_pin: i2so.9
        step_pin: i2so.10
        disable_pin: i2so.8
        run_amps: 0.950
        hold_amps: 0.250
        microsteps: 8
        stallguard: 4
        stallguard_debug: false
        run_mode: CoolStep
        homing_mode: Stallguard
        use_enable: false
        r_sense_ohms: 0.110
        cs_pin: i2so.11:low
  z:
    steps_per_mm: 100.000
    max_rate_mm_per_min: 1000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 75.000
    soft_limits: true
    homing:
      cycle: 1
      mpos_mm: 0.000
      positive_direction: false
      settle_ms: 250.000
      seek_mm_per_min: 2000.000
      feed_mm_per_min: 200.000
      seek_scaler: 1.100
      feed_scaler: 5.000
    motor0:
      limit_all_pin: gpio.34:low
      hard_limits: false
      tmc_2130:
        direction_pin: i2so.12
        step_pin: i2so.13
        disable_pin: i2so.15
        run_amps: 0.950
        hold_amps: 0.500
        microsteps: 8
        stallguard: 4
        stallguard_debug: false
        run_mode: CoolStep
        homing_mode: Stallguard
        use_enable: false
        r_sense_ohms: 0.110
        cs_pin: i2so.14:low
    motor1:
      null_motor:
  a:
    steps_per_mm: 100.000
    max_rate_mm_per_min: 1000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 300.000
    soft_limits: false
    motor0:
      tmc_2130:
        direction_pin: i2so.17
        step_pin: i2so.18
        disable_pin: i2so.16
        run_amps: 0.250
        hold_amps: 0.125
        microsteps: 16
        stallguard: 16
        stallguard_debug: false
        run_mode: CoolStep
        homing_mode: Stallguard
        use_enable: false
        r_sense_ohms: 0.110
        cs_pin: i2so.19:low
    motor1:
      null_motor:

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:
  cs_pin: gpio.5

control:
  reset_pin: gpio.39
  feed_hold_pin: gpio.36
  cycle_start_pin: gpio.25:pu

coolant:
  delay_ms: 1000.000

probe:
  pin: gpio.2:pu
  check_mode_start: false

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

start:
  must_home: true
  check_limits: true
  deactivate_parking: false

user_outputs:

10V:
  tool_num: 0
  speed_map: 0=0.0% 12000=100.000%
  forward_pin: NO_PIN
  reverse_pin: NO_PIN
  output_pin: gpio.14
  enable_pin: gpio.26
  direction_pin: NO_PIN
  disable_with_s0: false
  s0_with_disable: true
  spinup_ms: 1000
  spindown_ms: 1000
  pwm_hz: 5000

laser:
  tool_num: 100
  speed_map: 0=0.0% 100=100.0%
  output_pin: gpio.27
  enable_pin: gpio.16
  disable_with_s0: false
  s0_with_disable: false
  pwm_hz: 5000

arc_tolerance_mm: 0.002
junction_deviation_mm: 0.010
verbose_errors: false
report_inches: false
enable_parking_override_control: false
use_line_numbers: false

Startup Messages

FluidNC

[MSG:INFO: FluidNC v3.4.7]
[MSG:INFO: Compiled with ESP32 SDK:v4.4.1-1-gb8050b365e]
[MSG:INFO: Local filesystem type is SPIFFS]
[MSG:INFO: Configuration file:config.yaml]
[MSG:INFO: Machine 6-pack 2130sg XYYZA 4xIn 4x5v 10vCNC (v6)]
[MSG:INFO: Board 6-pack]
[MSG:INFO: I2SO BCK:gpio.22 WS:gpio.17 DATA:gpio.21]
[MSG:INFO: SPI SCK:gpio.18 MOSI:gpio.23 MISO:gpio.19]
[MSG:INFO: SD Card cs_pin:gpio.5 detect:NO_PIN]
[MSG:INFO: Stepping:I2S_static Pulse:4us Dsbl Delay:0us Dir Delay:0us Idle Delay:255ms]
[MSG:INFO: Axis count 4]
[MSG:INFO: Axis X (-600.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2130 Step:I2SO.2 Dir:I2SO.1 CS:I2SO.3:low Disable:I2SO.0 Index:-1 R:0.110]
[MSG:INFO:     All Limit gpio.33:low]
[MSG:INFO:   Motor1]
[MSG:INFO: Axis Y (-640.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2130 Step:I2SO.5 Dir:I2SO.4 CS:I2SO.6:low Disable:I2SO.7 Index:-1 R:0.110]
[MSG:INFO:     All Limit gpio.32:low]
[MSG:INFO:   Motor1]
[MSG:INFO:     tmc_2130 Step:I2SO.10 Dir:I2SO.9 CS:I2SO.11:low Disable:I2SO.8 Index:-1 R:0.110]
[MSG:INFO:     All Limit gpio.35:low]
[MSG:INFO: Axis Z (0.000,75.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2130 Step:I2SO.13 Dir:I2SO.12 CS:I2SO.14:low Disable:I2SO.15 Index:-1 R:0.110]
[MSG:INFO:     All Limit gpio.34:low]
[MSG:INFO:   Motor1]
[MSG:INFO: Axis A (-300.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2130 Step:I2SO.18 Dir:I2SO.17 CS:I2SO.19:low Disable:I2SO.16 Index:-1 R:0.110]
[MSG:INFO:   Motor1]
[MSG:ERR: X Axis driver test failed. Check connection]
[MSG:INFO: Y Axis driver test passed]
[MSG:ERR: Y2 Axis driver test failed. Check connection]
[MSG:INFO: Z Axis driver test passed]
[MSG:ERR: A Axis driver test failed. Check motor power]
[MSG:INFO: Reset gpio.39]
[MSG:INFO: FeedHold gpio.36]
[MSG:INFO: CycleStart gpio.25:pu]
[MSG:INFO: Kinematic system: Cartesian]
[MSG:INFO: 10V Spindle Ena:gpio.26 Out:gpio.14 Dir:NO_PIN Fwd:NO_PIN Rev:NO_PIN Freq:5000Hz Res:13bits]
[MSG:INFO: Laser Spindle Ena:gpio.16 Out:gpio.27 Freq:5000Hz Res:13bits Laser mode:On]
[MSG:INFO: Using spindle 10V]
[MSG:INFO: Probe Pin: gpio.2:pu]
[MSG:INFO: Connecting to STA SSID:At_Home]
[MSG:INFO: Connecting.]
[MSG:INFO: Connected - IP is 192.168.99.81]
[MSG:INFO: WiFi on]
[MSG:INFO: Start mDNS with hostname:http://fluidnc.local/]
[MSG:INFO: SSDP Started]
[MSG:INFO: HTTP started on port 80]
[MSG:INFO: Telnet started on port 23]

Grbl 3.4 [FluidNC v3.4.7 (wifi) '$' for help]
[MSG:INFO: '$H'|'$X' to unlock]

[MSG:Grbl_ESP32 Ver 1.3a Date 20211103]
[MSG:Compiled with ESP32 SDK:v3.2.3-14-gd3e562907]
[MSG:Using machine:6-pack 2130sg XYYZA 4xIn 4x5v 10vCNC (v6)]
[MSG:Axis count 4]
[MSG:I2S Steps, Stream]
[MSG:Reset switch on pin GPIO(39)]
[MSG:Hold switch on pin GPIO(36)]
[MSG:Start switch on pin GPIO(25)]
[MSG:Init Motors]
[MSG:TMCStepper Library Ver. 0x000703]
[MSG:X  Axis Trinamic TMC2130 Step:I2SO(2) Dir:I2SO(1) CS:I2SO(3) Disable:I2SO(0) Index:-1 R:0.110 Limits(0.000,600.000)]
[MSG:X  Axis Trinamic driver test passed]
[MSG:Y  Axis Trinamic TMC2130 Step:I2SO(5) Dir:I2SO(4) CS:I2SO(6) Disable:I2SO(7) Index:-1 R:0.110 Limits(0.000,640.000)]
[MSG:Y  Axis Trinamic driver test passed]
[MSG:Y2 Axis Trinamic TMC2130 Step:I2SO(10) Dir:I2SO(9) CS:I2SO(11) Disable:I2SO(8) Index:-1 R:0.110 Limits(0.000,640.000)]
[MSG:Y2 Axis Trinamic driver test passed]
[MSG:Z  Axis Trinamic TMC2130 Step:I2SO(13) Dir:I2SO(12) CS:I2SO(14) Disable:I2SO(15) Index:-1 R:0.110 Limits(-75.000,0.000)]
[MSG:Z  Axis Trinamic driver test passed]
[MSG:A  Axis Trinamic TMC2130 Step:I2SO(18) Dir:I2SO(17) CS:I2SO(19) Disable:I2SO(16) Index:-1 R:0.110 Limits(-300.000,0.000)]
[MSG:A  Axis Trinamic driver test failed. Check connection]
[MSG:Laser spindle on Pin:GPIO(27), Enbl:GPIO(16), Freq:5000Hz, Res:13bits Laser mode:On]

[MSG:Client Started]
[MSG:Connecting At_Home]
[MSG:Connecting.]
[MSG:Connecting..]
[MSG:Connecting...]
[MSG:Connecting....]
[MSG:Connected with 192.168.99.81]
[MSG:Connected with 192.168.99.81]
[MSG:Start mDNS with hostname:http://CNC-Live.local/]
[MSG:SSDP Started]
[MSG:HTTP Started]
[MSG:TELNET Started 23]
[MSG:X  Axis limit switch on pin GPIO(33)]
[MSG:Y  Axis limit switch on pin GPIO(32)]
[MSG:Y2 Axis limit switch on pin GPIO(35)]
[MSG:Z  Axis limit switch on pin GPIO(34)]
[MSG:Probe on pin GPIO(2)]

Grbl 1.3a ['$' for help]
[MSG:'$H'|'$X' to unlock]
#pragma once
/*
    myEsp32_2130v6.h
*/
#define MACHINE_NAME  "6-pack 2130sg XYYZA 4xIn 4x5v 10vCNC (v6)"
#define N_AXIS 4

// I2S (steppers & other output-only pins)
#define USE_I2S_OUT
#define USE_I2S_STEPS

#define I2S_OUT_BCK      GPIO_NUM_22
#define I2S_OUT_WS       GPIO_NUM_17
#define I2S_OUT_DATA     GPIO_NUM_21

#define TRINAMIC_RUN_MODE      Motors::TrinamicMode::CoolStep
#define TRINAMIC_HOMING_MODE   Motors::TrinamicMode::StallGuard

#define X_TRINAMIC_DRIVER       2130
#define X_DISABLE_PIN           I2SO(0)
#define X_DIRECTION_PIN         I2SO(1)
#define X_STEP_PIN              I2SO(2)
#define X_CS_PIN                I2SO(3)
#define X_RSENSE                TMC2130_RSENSE_DEFAULT

#define Y_TRINAMIC_DRIVER       2130
#define Y_DIRECTION_PIN         I2SO(4)
#define Y_STEP_PIN              I2SO(5)
#define Y_DISABLE_PIN           I2SO(7)
#define Y_CS_PIN                I2SO(6)
#define Y_RSENSE                X_RSENSE

#define Y2_TRINAMIC_DRIVER      2130
#define Y2_DISABLE_PIN          I2SO(8)
#define Y2_DIRECTION_PIN        I2SO(9)
#define Y2_STEP_PIN             I2SO(10)
#define Y2_CS_PIN               I2SO(11)
#define Y2_RSENSE               X_RSENSE

#define Z_TRINAMIC_DRIVER       2130
#define Z_DIRECTION_PIN         I2SO(12)
#define Z_STEP_PIN              I2SO(13)
#define Z_DISABLE_PIN           I2SO(15)
#define Z_CS_PIN                I2SO(14)
#define Z_RSENSE                X_RSENSE

#define A_TRINAMIC_DRIVER       2130
#define A_DISABLE_PIN           I2SO(16)
#define A_DIRECTION_PIN         I2SO(17)
#define A_STEP_PIN              I2SO(18)
#define A_CS_PIN                I2SO(19)
#define A_RSENSE                X_RSENSE

// Socket #1 (Empty)
// Install StallGuard Jumpers
#define X_LIMIT_PIN     GPIO_NUM_33     // Sg1
#define Y_LIMIT_PIN     GPIO_NUM_32     // Sg2
#define Y2_LIMIT_PIN    GPIO_NUM_35     // Sg3
#define Z_LIMIT_PIN     GPIO_NUM_34     // Sg4

// If some of the control pin switches are normally closed
// (the default is normally open), you can invert some of them
// with INVERT_CONTROL_PIN_MASK.  The bits in the mask are
// Cycle Start, Feed Hold, Reset, Safety Door.  To use a
// normally open switch on Reset, you would say
// #define INVERT_CONTROL_PIN_MASK B1101
#ifdef INVERT_CONTROL_PIN_MASK
#    undef INVERT_CONTROL_PIN_MASK
#endif
#define INVERT_CONTROL_PIN_MASK B0001

// Socket #2
// 4x Switch Input module
#define PROBE_PIN               GPIO_NUM_2
#define CONTROL_CYCLE_START_PIN GPIO_NUM_25
#define CONTROL_RESET_PIN       GPIO_NUM_39
#define CONTROL_FEED_HOLD_PIN   GPIO_NUM_36

#define SPINDLE_TYPE        SpindleType::LASER

// Socket #3 - 5v Output Module
#define SPINDLE_ENABLE_PIN  GPIO_NUM_26  // Pin #1 - 
//#define UNUSED_FOR_NOW    GPIO_NUM_4   // Pin #2
#define LASER_ENABLE_PIN    GPIO_NUM_16  // Pin #3 
#define LASER_OUTPUT_PIN    GPIO_NUM_27  // Pin #4 - Laser PWM

// Socket #4 - 0-10v CNC Module
#define SPINDLE_OUTPUT_PIN  GPIO_NUM_14 // (0-10v) SPINDLE_OUTPUT
//#define UNUSED_OUT1       GPIO_NUM_13 // (Out1) 
//#define UNUSED_OUT2       GPIO_NUM_15 // (Out2) 

// Socket #5
// #1 I2SO(24)  (output only)
// #2 I2SO(25)  (output only)
// #3 I2SO(26)  (output only)
// #4 I2SO(27)  (output only)

// === Default settings
#define DEFAULT_STEP_PULSE_MICROSECONDS I2S_OUT_USEC_PER_PULSE
$Sta/SSID=At_Home
$Sta/Password=******
$Sta/IPMode=Static
$Sta/IP=192.168.99.81
$Sta/Gateway=192.168.99.1
$Sta/Netmask=255.255.255.0
$AP/SSID=GRBL_ESP2
$AP/Password=******
$AP/IP=192.168.0.1
$AP/Channel=1
$System/Hostname=CNC-Live
$Http/Enable=ON
$Http/Port=80
$Telnet/Enable=ON
$Telnet/Port=23
$Radio/Mode=STA
$Bluetooth/Name=btgrblesplive
$Notification/Type=NONE
$Notification/T1=
$Notification/T2=
$Notification/TS=
$Message/Level=Info
$User/Macro0=
$User/Macro1=
$User/Macro2=
$User/Macro3=
$Homing/Cycle0=Z
$Homing/Cycle1=X
$Homing/Cycle2=Y
$Homing/Cycle3=
$Homing/Cycle4=
$Homing/Cycle5=
$Report/StallGuard=
$Stepper/Enable/Delay=0
$Stepper/Direction/Delay=0
$Stepper/Pulse=4
$Stepper/IdleTime=255
$Stepper/StepInvert=
$Stepper/DirInvert=Y
$Stepper/EnableInvert=Off
$Limits/Invert=On
$Probe/Invert=Off
$Report/Status=1
$GCode/JunctionDeviation=0.010
$GCode/ArcTolerance=0.002
$Report/Inches=Off
$Firmware/Build=Main:7b24e57:myEsp32_2130v6
$Limits/Soft=On
$Limits/Hard=Off
$Homing/Enable=On
$Homing/DirInvert=XY
$Homing/Squared=Y
$Homing/Feed=200.000
$Homing/Seek=800.000
$Homing/Debounce=250.000
$Homing/Pulloff=2.000
$GCode/MaxS=12000.000
$GCode/MinS=0.000
$Laser/FullPower=100
$GCode/LaserMode=On
$GCode/Line1=
$GCode/Line0=
$Spindle/Enable/Invert=Off
$Spindle/Enable/OffWithSpeed=Off
$Coolant/Delay/TurnOn=1.000
$Spindle/Delay/SpinDown=5.000
$Spindle/Delay/SpinUp=5.000
$Spindle/PWM/Invert=Off
$Spindle/PWM/Frequency=5000.000
$Spindle/PWM/Off=0.000
$Spindle/PWM/Min=0.000
$Spindle/PWM/Max=100.000
$Spindle/Type=LASER
$X/StepsPerMm=400.000
$Y/StepsPerMm=400.000
$Z/StepsPerMm=800.000
$A/StepsPerMm=100.000
$B/StepsPerMm=100.000
$C/StepsPerMm=100.000
$X/MaxRate=2500.000
$Y/MaxRate=2500.000
$Z/MaxRate=1000.000
$A/MaxRate=1000.000
$B/MaxRate=1000.000
$C/MaxRate=1000.000
$X/Acceleration=200.000
$Y/Acceleration=200.000
$Z/Acceleration=200.000
$A/Acceleration=200.000
$B/Acceleration=200.000
$C/Acceleration=200.000
$X/Home/Mpos=0.000
$Y/Home/Mpos=0.000
$Z/Home/Mpos=0.000
$A/Home/Mpos=0.000
$B/Home/Mpos=0.000
$C/Home/Mpos=0.000
$X/MaxTravel=600.000
$Y/MaxTravel=640.000
$Z/MaxTravel=75.000
$A/MaxTravel=300.000
$B/MaxTravel=300.000
$C/MaxTravel=300.000
$X/Current/Run=1.250
$Y/Current/Run=0.950
$Z/Current/Run=0.950
$A/Current/Run=0.800
$B/Current/Run=0.800
$C/Current/Run=0.800
$X/Current/Hold=0.250
$Y/Current/Hold=0.250
$Z/Current/Hold=0.500
$A/Current/Hold=0.400
$B/Current/Hold=0.400
$C/Current/Hold=0.400
$X/Microsteps=8
$Y/Microsteps=8
$Z/Microsteps=8
$A/Microsteps=16
$B/Microsteps=16
$C/Microsteps=16
$X/StallGuard=4
$Y/StallGuard=4
$Z/StallGuard=4
$A/StallGuard=16
$B/StallGuard=16
$C/StallGuard=16
$Errors/Verbose=Off


### User Interface Software

Using WebUI and FluidTerm .

### What happened?

Updated to FluidNC from GRBL_Esp32. Created config.yaml use the tool, then edited to conform to machine settings.. The motors init correctly in GRBL_Esp32, and the machine runs correctly. The motors fail to init in FluidNC. 

 Seems as if I must have created some error in config.yaml. I just can't find it myself.

This is with the downloaded version of FluidNC 3.4.7.

### Other Information

_No response_
MitchBradley commented 2 years ago

Try with version 3.4.4. At version 3.4.5 we switched to the latest version of Arduino framework code, which has some changes in the way that GPIOs are handled. It is possible that those changes are breaking something in the Trinamic setup code.

bdring commented 2 years ago

I don't think the CS pins for the motors should have the :low attribute.

There are a lot of Trinamic SPI examples for the 6 pack here.

https://github.com/bdring/6-Pack_CNC_Controller/tree/main/FluidNC_configs

also see

https://github.com/bdring/FluidNC/wiki/FluidNC-Motor-Setup#tmc_2130

bDuthieDev commented 2 years ago

tried 3.4.6 - no luck reloaded 3.4.7, removed :low on cs pins - motors now init, and are live some issue with soft limits cause errors on X,Y. Z does not have the issue I should be able to solve that myself, but it is over 100 in the workshop, so will chase it later

bdring commented 2 years ago

Closing....subject issue was resolved.