bdring / FluidNC

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

Problem: 3.9.0 Start a file causes reboot. #1363

Closed V1EngineeringInc closed 2 weeks ago

V1EngineeringInc commented 2 weeks ago

Wiki Search Terms

None

Controller Board

JAckpot

Machine Description

Known good Lowrider, board, config, and file. All previously tested through all the 3.8-PreX

Input Circuits

No response

Configuration file

board: Jackpot TMC2209
name: LowRider
meta: 03-15-2024 RyanZ

planner_blocks: 32

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

uart1:
  txd_pin: gpio.0
  rxd_pin: gpio.4
  rts_pin: NO_PIN
  baud: 115200
  mode: 8N1

axes:
  shared_stepper_disable_pin: NO_PIN

  x:
    steps_per_mm: 50.000
    max_rate_mm_per_min: 9000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 1220
    soft_limits: false
    homing:
      cycle: 3
      positive_direction: false
      mpos_mm: 0
      feed_mm_per_min: 300.000
      seek_mm_per_min: 1500.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100
    #X
    motor0:
      limit_neg_pin: gpio.25:high
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 4.000
      tmc_2209:
        uart_num: 1
        addr: 0
        cs_pin: NO_PIN
        r_sense_ohms: 0.110
        run_amps: 0.800
        homing_amps: 0.800
        hold_amps: 0.500
        microsteps: 8
        stallguard: 0
        stallguard_debug: false
        toff_disable: 0
        toff_stealthchop: 5
        toff_coolstep: 3
        run_mode: StealthChop
        homing_mode: StealthChop
        use_enable: false
        direction_pin: I2SO.1
        step_pin: I2SO.2
        disable_pin: I2SO.0

  y:
    steps_per_mm: 50.000
    max_rate_mm_per_min: 9000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 2440
    soft_limits: false
    homing:
      cycle: 2
      positive_direction: false
      mpos_mm: 0
      feed_mm_per_min: 300.000
      seek_mm_per_min: 1500.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100
    #Y
    motor0:
      limit_neg_pin: gpio.33:high
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 4.000
      tmc_2209:
        uart_num: 1
        addr: 1
        cs_pin: NO_PIN
        r_sense_ohms: 0.110
        run_amps: 0.800
        homing_amps: 0.800
        hold_amps: 0.500
        microsteps: 8
        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.5
        direction_pin: I2SO.4
        disable_pin: I2SO.7

    #A
    motor1:
      limit_neg_pin: gpio.35:high
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 4.000
      tmc_2209:
        uart_num: 1
        addr: 3
        cs_pin: i2so.14
        r_sense_ohms: 0.110
        run_amps: 0.800
        homing_amps: 0.800
        hold_amps: 0.500
        microsteps: 8
        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.15

  z:
    steps_per_mm: 200.000
    max_rate_mm_per_min: 1200.000
    acceleration_mm_per_sec2: 80.000
    max_travel_mm: 300.000
    soft_limits: false
    homing:
      cycle: 1
      positive_direction: true
      mpos_mm: 0
      feed_mm_per_min: 300.000
      seek_mm_per_min: 800.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: NO_PIN
      limit_pos_pin: gpio.32:high
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 4.000
      tmc_2209:
        uart_num: 1
        addr: 2
        cs_pin: NO_PIN
        r_sense_ohms: 0.110
        run_amps: 0.800
        homing_amps: 0.800
        hold_amps: 0.500
        microsteps: 8
        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.10
        direction_pin: I2SO.9
        disable_pin: I2SO.8

     #B
    motor1:
      limit_neg_pin: NO_PIN
      limit_pos_pin: gpio.34:high
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 4.000
      tmc_2209:
        uart_num: 1
        addr: 3
        cs_pin: i2so.19
        r_sense_ohms: 0.110
        run_amps: 0.800
        homing_amps: 0.800
        hold_amps: 0.500
        microsteps: 8
        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.18
        direction_pin: I2SO.17
        disable_pin: I2SO.16

#  c:
#    steps_per_mm: 80.000
#    max_rate_mm_per_min: 5000.000
#    acceleration_mm_per_sec2: 100.000
#    max_travel_mm: 300.000
#    soft_limits: false
#    homing:
#      cycle: 0
#      positive_direction: true
#      mpos_mm: 150.000
#      feed_mm_per_min: 100.000
#      seek_mm_per_min: 800.000
#      settle_ms: 500
#      seek_scaler: 1.100
#      feed_scaler: 1.100
#
#    motor0:
#      limit_neg_pin: gpio.39:low
#      limit_pos_pin: NO_PIN
#      limit_all_pin: NO_PIN
#      hard_limits: false
#      pulloff_mm: 3.000
#      tmc_2209:
#        uart_num: 1
#        addr: 3
#        cs_pin: i2so.22
#        r_sense_ohms: 0.110
#        run_amps: .8
#        homing_amps: 0.800
#        hold_amps: 0.050
#        microsteps: 16
#        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
#        disable_pin: I2SO.23

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
  card_detect_pin: NO_PIN
  frequency_hz: 20000000

probe:
  pin: gpio.36:low
  toolsetter_pin: NO_PIN
  check_mode_start: true

start:
  must_home: false

coolant:
  flood_pin: gpio.2
  mist_pin: gpio.16
  delay_ms: 0

control:
  safety_door_pin: NO_PIN
  reset_pin: NO_PIN
  feed_hold_pin: NO_PIN
  cycle_start_pin: NO_PIN
  macro0_pin: NO_PIN
  macro1_pin: NO_PIN
  macro2_pin: NO_PIN
  macro3_pin: NO_PIN

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

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: gpio.26
  digital1_pin: gpio.27
  digital2_pin: NO_PIN
  digital3_pin: NO_PIN

#Laser:
#  pwm_hz: 5000
#  output_pin: gpio.27
#  enable_pin: NO_PIN
#  disable_with_s0: false
#  s0_with_disable: true
#  tool_num: 0
#  speed_map: 0=0.000% 255=100.000%
#  off_on_alarm: true

# pwm:
#  pwm_hz: 5000
#  direction_pin: gpio.26
#  output_pin: gpio.27
#  enable_pin: NO_PIN
#  disable_with_s0: false
#  s0_with_disable: true
#  spinup_ms: 0
#  spindown_ms: 0
#  tool_num: 0
#  speed_map: 0=0.000% 1000=100.000%
#  off_on_alarm: false

# 5V out gpio.26/27
# VMot out gpoi.2/16
# In's left to right gpoi.25/33/32/35/34/39/36

Startup Messages

FluidTerm v1.2.1 (1cf9483) using COM178
Exit: Ctrl-C, Ctrl-Q or Ctrl-], Clear screen: CTRL-W
Upload: Ctrl-U, Reset ESP32: Ctrl-R, Send Override: Ctrl-O
Resetting MCU
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13260
load:0x40080400,len:3028
entry 0x400805e4
[MSG:INFO: uart_channel0 created]
[MSG:RST]
[MSG:INFO: FluidNC v3.9.0 https://github.com/bdring/FluidNC]
[MSG:INFO: Compiled with ESP32 SDK:v4.4.7-dirty]
[MSG:INFO: Local filesystem type is littlefs]
[MSG:INFO: Configuration file:config.yaml]
[MSG:INFO: Machine LowRider]
[MSG:INFO: Board Jackpot TMC2209]
[MSG:INFO: UART1 Tx:gpio.0 Rx:gpio.4 RTS:NO_PIN Baud:115200]
[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 freq:20000000]
[MSG:INFO: Stepping:I2S_STATIC Pulse:4us Dsbl Delay:0us Dir Delay:1us Idle Delay:255ms]
[MSG:INFO: User Digital Output: 0 on Pin:gpio.26]
[MSG:INFO: User Digital Output: 1 on Pin:gpio.27]
[MSG:INFO: Axis count 3]
[MSG:INFO: Axis X (0.000,1220.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:0 CS:NO_PIN Step:I2SO.2 Dir:I2SO.1 Disable:I2SO.0 R:0.110]
[MSG:INFO:  X Neg Limit gpio.25]
[MSG:INFO: Axis Y (0.000,2440.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:1 CS:NO_PIN Step:I2SO.5 Dir:I2SO.4 Disable:I2SO.7 R:0.110]
[MSG:INFO:  Y Neg Limit gpio.33]
[MSG:INFO:   Motor1]
[MSG:INFO:     tmc_2209 UART1 Addr:3 CS:I2SO.14 Step:I2SO.13 Dir:I2SO.12 Disable:I2SO.15 R:0.110]
[MSG:INFO:  Y2 Neg Limit gpio.35]
[MSG:INFO: Axis Z (-300.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:2 CS:NO_PIN Step:I2SO.10 Dir:I2SO.9 Disable:I2SO.8 R:0.110]
[MSG:INFO:  Z Pos Limit gpio.32]
[MSG:INFO:   Motor1]
[MSG:INFO:     tmc_2209 UART1 Addr:3 CS:I2SO.19 Step:I2SO.18 Dir:I2SO.17 Disable:I2SO.16 R:0.110]
[MSG:INFO:  Z2 Pos Limit gpio.34]
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Y2 Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: Z2 Axis driver test passed]
[MSG:INFO: Kinematic system: Cartesian]
[MSG:INFO: STA SSID is not set]
[MSG:INFO: AP SSID FluidNC IP 192.168.0.1 mask 255.255.255.0 channel 1]
[MSG:INFO: AP started]
[MSG:INFO: WiFi on]
[MSG:INFO: Captive Portal Started]
[MSG:INFO: HTTP started on port 80]
[MSG:INFO: Telnet started on port 23]
[MSG:INFO: Flood coolant gpio.2]
[MSG:INFO: Mist coolant gpio.16]
[MSG:INFO: Probe gpio.36:low]

User Interface Software

Fluidterm, webuiV2

What happened?

Try to start a know good file, board reboots. Fluid term screenshot shown below.

GCode File

strut_plate.txt

Other Information

panic

V1EngineeringInc commented 2 weeks ago

Confirmed by another user with a different know good file.

aaronse commented 2 weeks ago

started with known good file, got a panic and reboot?

V1EngineeringInc commented 2 weeks ago

Edited that sentence.

V1EngineeringInc commented 2 weeks ago

The file works as expected with 3.8.4-pre9. I am out of ideas to help you out, I have a few boards to test with, just let me know how I can help.

bdring commented 2 weeks ago

I can reproduce the issue. I'll see what the backtrace shows and look at the latest commits.

MitchBradley commented 2 weeks ago

@dymk - the differences between 3.8.4-pre9 and main are all in your looping code. Could you take a shot at debugging?

jeyeager65 commented 2 weeks ago

Looks like this fixes it. @michmela44 figured it out, I just validated it. Not sure if there are any other issues with that code, but it resolved the problem we saw.

image

Here was my stacktrace:

Grbl 3.9 [FluidNC v3.9.0 (wifi) '$' for help]
WebSocket disconnect 0
[MSG:INFO: WebUI: Request from 192.168.0.120]
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400e4965  PS      : 0x00060530  A0      : 0x800dcc3c  A1      : 0x3ffb20b0  
A2      : 0x00000000  A3      : 0x00000001  A4      : 0x80000020  A5      : 0x00000007  
A6      : 0x00000005  A7      : 0x00000001  A8      : 0x00000000  A9      : 0x3ffb2090
A10     : 0x580ea9b9  A11     : 0x3ffc643c  A12     : 0x3ffc6339  A13     : 0x3ffc57b4  
A14     : 0x00003a97  A15     : 0x3f40d0d8  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000  LBEG    : 0x4008bbe8  LEND    : 0x4008bbfe  LCOUNT  : 0xffffffff  

Backtrace: 0x400e4962:0x3ffb20b0 0x400dcc39:0x3ffb20d0 0x400dcc6c:0x3ffb2100 0x401fdca1:0x3ffb2120 0x400fc275:0x3ffb2150 0x400fc5f5:0x3ffb21b0 0x400fc665:0x3ffb21d0 0x400fd6b1:0x3ffb2210 0x400ee0e4:0x3ffb2250 0x40128d81:0x3ffb2290
  #0  0x400e4962 in Job::save() at FluidNC/src/Job.cpp:37
  #1  0x400dcc39 in _ZL7runFilePKcS0_19AuthenticationLevelR7Channel$isra$58 at FluidNC/src/FileCommands.cpp:257
      (inlined by) runFile at FluidNC/src/FileCommands.cpp:251
  #2  0x400dcc6c in runSDFile(char const*, AuthenticationLevel, Channel&) at FluidNC/src/FileCommands.cpp:269  
  #3  0x401fdca1 in WebCommand::action(char const*, AuthenticationLevel, Channel&) at FluidNC/src/Settings.cpp:539
  #4  0x400fc275 in do_command_or_setting(char const*, char const*, AuthenticationLevel, Channel&) at FluidNC/src/ProcessSettings.cpp:898
  #5  0x400fc5f5 in settings_execute_line(char*, Channel&, AuthenticationLevel) at FluidNC/src/ProcessSettings.cpp:1024
  #6  0x400fc665 in execute_line(char*, Channel&, AuthenticationLevel) at FluidNC/src/ProcessSettings.cpp:1041  
  #7  0x400fd6b1 in protocol_main_loop() at FluidNC/src/Protocol.cpp:289 (discriminator 4)
  #8  0x400ee0e4 in loop() at FluidNC/src/Main.cpp:152
  #9  0x40128d81 in loopTask(void*) at C:/Users/jeyea/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50

ELF file SHA256: e4c469edd0e307f2
bdring commented 2 weeks ago

It works for me too.

There is some test stuff for the PR. We should see if that still runs.

https://github.com/bdring/FluidNC/tree/main/fixture_tests/fixtures

renhil commented 2 weeks ago

image image image the activeChannel become 1, when open a file. but the stack is empty. so get a panic and reboot.

MitchBradley commented 2 weeks ago

Each of the 21 uses of Job::active() needs to be checked carefully to see if the change to its definition is appropriate for that situation. The change was:

 bool Job::active() {
-    return !job.empty();
+    return !job.empty() || activeChannel;
 }

My suspicion is that the change is good for most of the uses in Flowcontrol.cpp, but not for most of the uses elsewhere. @dymk should weigh in.

V1EngineeringInc commented 2 weeks ago

3.9.1 works as expected. Thanks guys!