bdring / FluidNC

The next generation of motion control firmware
Other
1.61k stars 385 forks source link

Wrong-step-size/step-timing issue persists #739

Open daxliniere opened 1 year ago

daxliniere commented 1 year ago

Controller Board

DLC32

Machine Description

SWOLE CNC

Input Circuits

No response

Configuration file

board: MKS-DLC32
name: SWOLE-CNC
meta: V2.6.8 (2202.11.09) Dax Liniere

kinematics:
  Cartesian:

stepping:
  engine: I2S_STATIC
  idle_ms: 150
  pulse_us: 4
  dir_delay_us: 1
  disable_delay_us: 0

axes:
  shared_stepper_disable_pin: I2SO.0
  x:
    steps_per_mm: 804.065
#was 802.341
    max_rate_mm_per_min: 1600.000
#was 1500.000
    acceleration_mm_per_sec2: 80.000
    max_travel_mm: 301.000
#was 302.000    
    soft_limits: true
    homing:
      cycle: 2
      positive_direction: false
      mpos_mm: 0.000
      feed_mm_per_min: 20.000
      seek_mm_per_min: 300.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: gpio.36
      limit_pos_pin: gpio.34
      limit_all_pin: NO_PIN
      hard_limits: true
      pulloff_mm: 1.000
      stepstick:
        step_pin: I2SO.1
        direction_pin: I2SO.2:low
        disable_pin: NO_PIN
        ms1_pin: NO_PIN
        ms2_pin: NO_PIN
        ms3_pin: NO_PIN
        reset_pin: NO_PIN

  y:
    steps_per_mm: 804.636
#was 802.322
    max_rate_mm_per_min: 1600.000
    acceleration_mm_per_sec2: 80.000
# was 300.000
    max_travel_mm: 186.000
    soft_limits: true
    homing:
      cycle: 2
      positive_direction: false
      mpos_mm: 0.000
      feed_mm_per_min: 20.000
      seek_mm_per_min: 300.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: gpio.35
      limit_pos_pin: gpio.23
#this pin doesn't have the same input circuitry as the 3 dedicated on-board limit switch inputs
      limit_all_pin: NO_PIN
      hard_limits: true
      pulloff_mm: 1.000
      stepstick:
        step_pin: I2SO.5
        direction_pin: I2SO.6:low
        disable_pin: NO_PIN
        ms1_pin: NO_PIN
        ms2_pin: NO_PIN
        ms3_pin: NO_PIN
        reset_pin: NO_PIN
  z:
    steps_per_mm: 802.497
    max_rate_mm_per_min: 1000.000
    acceleration_mm_per_sec2: 50.000
# was 500.000
    max_travel_mm: 100
#46.000
    soft_limits: true
    homing:
      cycle: 1
      positive_direction: true
      mpos_mm: 0.000
      feed_mm_per_min: 20.000
      seek_mm_per_min: 100.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_pos_pin: gpio.18
#this pin doesn't have the same input circuitry as the 3 dedicated on-board limit switch inputs
      hard_limits: true
      pulloff_mm: 1.000
      stepstick:
        step_pin: I2SO.3
        direction_pin: I2SO.4:low
        disable_pin: NO_PIN
        ms1_pin: NO_PIN
        ms2_pin: NO_PIN
        ms3_pin: NO_PIN
        reset_pin: NO_PIN

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

spi:
  miso_pin: gpio.12
  mosi_pin: gpio.13
  sck_pin: gpio.14

sdcard:
  cs_pin: gpio.15
  card_detect_pin: NO_PIN
# This could be GPIO.39, but Card Detect has no supported functions in FluidNC

control:
  safety_door_pin: gpio.33:low:pu
  cycle_start_pin: NO_PIN
  feed_hold_pin: NO_PIN
  reset_pin: NO_PIN
  macro0_pin: gpio.19:low:pu
  macro1_pin: NO_PIN
  macro2_pin: NO_PIN
  macro3_pin: NO_PIN

parking:
  enable: true
  axis: Z
  pullout_distance_mm: 5.000
  pullout_rate_mm_per_min: 250.000
  target_mpos_mm: 0.000
  rate_mm_per_min: 800.000

macros:
  startup_line0:
  startup_line1:
  macro0: $H
#unlock and home XYZ
  macro1: G38.2 G91 Z-46 F100&G0 Z1&G38.2 G91 Z-2 F50&G10 L20 P1 Z4.985&G10 L20 P2 Z4.985&G10 L20 P3 Z4.985&G10 L20 P4 Z4.985&G10 L20 P5 Z4.985&G10 L20 P6 Z4.985&G53 G0 Z0&G90
#z-probe
  macro2:
  macro3: $SD/Run=lasertest.gcode

coolant:
  flood_pin: gpio.0
# continuous air
  mist_pin:  gpio.4
# pulsed air 
  delay_ms: 0

probe:
  pin: gpio.22:low
  check_mode_start: true

10V:
# Spindle
  direction_pin: NO_PIN
  forward_pin: NO_PIN
  reverse_pin: NO_PIN
  output_pin: gpio.32
  enable_pin: gpio.5:low
  pwm_hz: 5000
  disable_with_s0: false
  s0_with_disable: false
  off_on_alarm: true
#switch off spindle when in alarm state
  spinup_ms: 10000
  spindown_ms: 12000
  tool_num: 0
  speed_map: 0=0% 0=25% 5868=25% 23237=99% 24000=100%
#DLC32 Spindle TTL max output voltage is 4.89v, so it can never reach 24000rpm/400Hz

user_outputs:
  analog0_pin: NO_PIN
  analog1_pin: NO_PIN
  analog2_pin: NO_PIN
  analog3_pin: NO_PIN
  analog0_hz: 5000
  analog1_hz: 5000
  analog2_hz: 5000
  analog3_hz: 5000
  digital0_pin: NO_PIN
  digital1_pin: NO_PIN
  digital2_pin: NO_PIN
  digital3_pin: NO_PIN

start:
  must_home: false
# Pins that could be used: 0(SDA), 4(SCL), 5, 18, 19, 22, 23, 25, 26, 27, 32 (TTL spindle control), 33, 39, I2SO.7
# Pins not currently in use: 25 (TMC_CS_Y), 26 (TMC_CS_X), 27 (TMC_CS_Z), (39 SD card detect), I2SO.7

Startup Messages

Not to hand right now, but no different to normal.

User Interface Software

UGS

What happened?

fluidnc-v3.6.5-pre4-win64 Mid-way through a jog, I heard a clunk sound then jogging axes became very slow. I tried it with a rapid (g0 x150 y150) and get the same slow movement. I can't jog all the way back to physical x0y0 because soft limits kick in, thinking that it has moved further than it actually has. Restarted with CTRL+R and tried again. Same thing happened shortly after. Also during jogging.

Roll back to 3.6.4-local1 installed without power cycling my controller (which conatins the stepper drivers) and it was still stuck in the wrong-step-size state. Is it possible that the stepper controllers themselves might be getting into a funky state because of a signal they've received? Or is it more likely that when the ESP32 goes into that wrong timing state, it requires a full power cycle rather than just a CTRL+R reset? Tested again after a full power-cycle: happened again, part-way through this: G53 G0 Z0 $J=G53 X0 Y0 F1800

There's one other thing that springs to mind.. my PS4 joypad has noisy analog pots, so occasionally I get a tiny unwanted jog. UGS has a deadband control, so I've increased that. I have an inkling that maybe 'jogging while jogging' triggers the problem.

Another power-cycle later...

Fired up the machine again, jogged around and it got stuck in a weird state of jogging Z-axis up at an excrutiatingly slow rate. It was stuck in this slow-moving state and wouldn't accept new commands, including when I pressed my door switch button. This is obviously a larger concern. I have video if it helps.

More interestingly, After I turned off the main power switch of my controller, I got about a thousand INFO: Check door messages https://pastebin.com/q1pivsuC

I had no idea if it was related, but I don't recall having this issue between when the original issue was suspected solved and when Mitch(?) suggested disabling the motor-disable by changing idle_ms to 255. So for now, I am on the latest released firmware and idle_ms is 150.

Let me know if you need any more info or want me to run some tests.

Other Information

No response

MitchBradley commented 1 year ago

I wrote a python script to blast the jog commands from your pastebin log, using the line oriented ok ack flow control. With your config file on a DLC32 V1.1, everything worked fine so long as the motors were being run within their limits. One of the motors that I had attached would not go as fast as your config and jog commands specified, and it would stall when the speed got too high. When I dialed back the max_rate to something that motor could handle, your jog sequence ran with no apparent problems.

I cannot duplicate your driver/motor/machine setup, so I cannot prove this, but my best guess is that you might be pushing something harder than it can go and it is getting into a weird state.

I know that the controller is not dropping out because I hooked up my new MKS SERVO57 motor and set steps_per to 804, max_rate to 9000 for a step rate of 120K and it went like gangbusters.

daxliniere commented 1 year ago

Hey Mitch, thanks for testing that. I'm not 100% certain how exceeding the motor/system limits would cause the steps/mm to increase, but I'll take your more experienced word for it.

Those Servo57 boards look really interesting! And it seems they can be retrofitted to other steppers, so I'm thinking of adding them to my X and Y motors. Is there anything different I need to do in my FNC config?

MitchBradley commented 1 year ago

The config is just like any other standard_stepper config. You can set the microstepping level via the button menu.

One consideration is that the MKS SERVO57 is rated at 24V so if you have a higher voltage power supply that would be a problem. The capacitors on the servo board are 35V types so I wouldn't want to try overvolting beyond 24V; you need some margin. It is possible/likely that there are other components with voltage limits too.

The MKS TMC2160_57 - not a servo - that I put on the other motor is rated for 36V which is what I have on that machine. That board has 50V capacitors.

daxliniere commented 1 year ago

SWOLE runs at 24v, so that seems fine to me. The SERVO57 boards are so cheap, it seems crazy not to add closed-loop facilities. Thanks for putting them on my radar.

MitchBradley commented 1 year ago

I see this as a crossover point in what I expect is a market shift. ST506 disk drives with outboard controllers gave way to SCSI and IDE drives where the electronics is integrated, matched and tuned to the mechanical components. That opened up so many possibilities for improvement. In a very short time, outboard controllers were just a bad memory.