Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    3.5b1 Reset reason: StuckInSpinLoop?

    Scheduled Pinned Locked Moved Solved
    Beta Firmware
    2
    33
    1.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Diamondbackundefined
      Diamondback
      last edited by Diamondback

      @dc42
      Ok, so here's the most minimalistic version I can create:

      daemon.g

      while global.daemonActive == true
      	set global.deactivateToolAfterFilamentChange = false
      
      	while iterations < #global.displayChar0
      		var lineIndex = iterations ;cache iterations value here since we have a 2D array and need this line counter later again
      		while iterations < #(global.displayChar0[var.lineIndex])
      			M150 R{global.RGBWhite[0]} U{global.RGBWhite[1]} B{global.RGBWhite[2]} P{global.displayChar0[var.lineIndex][iterations] > 0 ? global.displayDefaultBrightness : 0} S1 F1
      		
      	M150 R0 U0 B0 P0 S1 F0 ;announce last LED with a dummy
      	
      	G4 P500
      

      Most notably, if I remove the set global.deactivateToolAfterFilamentChange = false line, things work fine... However, that piece of code has been running for months just fine, this issue only started appearing with my use of LEDs and/or custom arrays.

      And the globals (these are created inside a macro that is called from config.g)

      if !exists(global.displayChar0)
      	global displayChar0 = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,0}}
      	global displayChar1 = {{0,0,1,1,1,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,1,1,1,1,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0}}	
      	global displayChar2 = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{0,1,1,1,0,0,0,0},{0,0,0,1,1,1,0,0},{0,0,0,0,0,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1}}
      	global displayChar3 = {{0,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{0,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1}}
      	
      	global RGBRed = {255,0,0}
      	global RGBGreen = {0,255,0}
      	global RGBBlue = {0,0,255}
      	global RGBWhite = {255,255,255}
      

      All of the above code has been copied together from various macros, it's usually a lot more generic and this is just the smallest version of the overall stuff that I can produce.

      Here's another M122 from that minimal code:

      M122
      === Diagnostics ===
      RepRapFirmware for Duet 3 MB6HC version 3.5beta1+ (2023-01-20 09:47:33) running on Duet 3 MB6HC v1.02 or later (standalone mode)
      Board ID: 08DJM-9P63L-DJ3T0-6J1F4-3S06S-9A1V9
      Used output buffers: 3 of 40 (19 max)
      === RTOS ===
      Static ram: 151340
      Dynamic ram: 113436 of which 0 recycled
      Never used RAM 80984, free system stack 200 words
      Tasks: NETWORK(ready,27.2%,241) ETHERNET(notifyWait,0.2%,434) ACCEL(notifyWait,0.0%,348) HEAT(notifyWait,0.0%,342) Move(notifyWait,0.0%,350) CanReceiv(notifyWait,0.0%,798) CanSender(notifyWait,0.0%,335) CanClock(delaying,0.0%,352) TMC(notifyWait,7.1%,90) MAIN(running,64.5%,953) IDLE(ready,1.0%,30), total 100.0%
      Owned mutexes:
      === Platform ===
      Last reset 00:00:12 ago, cause: software
      Last software reset at 2023-01-21 14:42, reason: StuckInSpinLoop, Gcodes spinning, available RAM 80984, slot 2
      Software reset code 0x4083 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0044a80f BFAR 0x00000000 SP 0x20419664 Task IDLE Freestk 44 ok
      Stack: 004901dd 00490bb2 61000000 a5a5a5a5 004901dd a5a5a5a5 2041aea4 0003f273 20424e2c 2041f370 2041967c 20424e24 00000004 20424ec8 20424ec8 2041967c 00000000 00000001 204196d8 4e49414d 00000000 00000000 00000001 00000001 014858ad 00000000 00000000
      Error status: 0x00
      Step timer max interval 126
      MCU temperature: min 41.4, current 41.5, max 42.4
      Supply voltage: min 23.8, current 23.8, max 23.9, under voltage events: 0, over voltage events: 0, power good: yes
      12V rail voltage: min 12.3, current 12.4, max 12.4, under voltage events: 0
      Heap OK, handles allocated/used 99/89, heap memory allocated/used/recyclable 4096/3548/156, gc cycles 1
      Events: 3 queued, 3 completed
      Driver 0: standstill, SG min n/a, mspos 744, reads 3000, writes 14 timeouts 0
      Driver 1: standstill, SG min n/a, mspos 360, reads 3000, writes 14 timeouts 0
      Driver 2: standstill, SG min n/a, mspos 56, reads 3000, writes 14 timeouts 0
      Driver 3: standstill, SG min n/a, mspos 248, reads 3000, writes 14 timeouts 0
      Driver 4: standstill, SG min n/a, mspos 520, reads 3001, writes 14 timeouts 0
      Driver 5: standstill, SG min n/a, mspos 952, reads 3001, writes 14 timeouts 0
      Date/time: 2023-01-21 14:43:16
      Slowest loop: 5.40ms; fastest: 0.06ms
      === Storage ===
      Free file entries: 10
      SD card 0 detected, interface speed: 25.0MBytes/sec
      SD card longest read time 2.4ms, write time 0.0ms, max retries 0
      === Move ===
      DMs created 125, segments created 0, maxWait 0ms, bed compensation in use: none, comp offset 0.000
      no step interrupt scheduled
      === DDARing 0 ===
      Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
      === DDARing 1 ===
      Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
      === Heat ===
      Bed heaters 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
      === GCodes ===
      Movement locks held by null, null
      HTTP is idle in state(s) 0
      Telnet is idle in state(s) 0
      File is idle in state(s) 0
      USB is idle in state(s) 0
      Aux is idle in state(s) 0
      Trigger is idle in state(s) 0
      Queue is idle in state(s) 0
      LCD is idle in state(s) 0
      SBC is idle in state(s) 0
      Daemon is idle in state(s) 0
      Aux2 is idle in state(s) 0
      Autopause is idle in state(s) 0
      File2 is idle in state(s) 0
      Queue2 is idle in state(s) 0
      Q0 segments left 0, axes/extruders owned 0x0000000
      Code queue 0 is empty
      Q1 segments left 0, axes/extruders owned 0x0000000
      Code queue 1 is empty
      === Filament sensors ===
      Extruder 0: no data received
      Extruder 1: no data received
      Extruder 2: no data received
      Extruder 3: no data received
      === CAN ===
      Messages queued 144, received 308, lost 0, boc 0
      Longest wait 1ms for reply type 6018, peak Tx sync delay 157, free buffers 50 (min 49), ts 62/61/0
      Tx timeouts 0,0,0,0,0,0
      === Network ===
      Slowest loop: 9.07ms; fastest: 0.03ms
      Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0) Telnet(0)
      HTTP sessions: 1 of 8
      = Ethernet =
      State: active
      Error counts: 0 0 0 0 0 0
      Socket states: 5 2 2 2 2 0 0 0
      = WiFi =
      Network state is disabled
      WiFi module is disabled
      Failed messages: pending 0, notready 0, noresp 0
      Socket states: 0 0 0 0 0 0 0 0
      === Multicast handler ===
      Responder is inactive, messages received 0, responses 0
      
      1 Reply Last reply Reply Quote 0
      • Diamondbackundefined
        Diamondback
        last edited by Diamondback

        @dc42
        Hm, i think I might have created a macro that causes this all on its own without daemon.g ( I just call this macro as is without any params for this test)

        var brightness = global.displayDefaultBrightness
        if exists(param.B)
        	set var.brightness = param.B
        
        var activeLEDs = 0
        if exists(param.S)
        	set var.activeLEDs = floor(param.S * global.displayLEDCount)
        	
        var displayContent = "progress" ^ var.activeLEDs
        if global.lastDisplayContent != var.displayContent
        	set global.lastDisplayContent = var.displayContent
        	while iterations < global.displayLEDCount
        		;M150 R{param.C[0]} U{param.C[1]} B{param.C[2]} P{iterations < var.activeLEDs ? var.brightness : 0} S1 F1 ;3.5+
        		var isFrame = iterations < 8 || iterations > 55
        		var isProgress = false ;todo
        		var isActive = var.isFrame || var.isProgress
        		M150 R255 U0 B0 P{var.isActive ? var.brightness : 0} S1 F1
        
        	M150 R0 U0 B0 P0 S1 F0 ;announce last LED with a dummy
        

        This immediately makes the board crash every time, here's an M122 for this:

        M122
        === Diagnostics ===
        RepRapFirmware for Duet 3 MB6HC version 3.5beta1+ (2023-01-20 09:47:33) running on Duet 3 MB6HC v1.02 or later (standalone mode)
        Board ID: 08DJM-9P63L-DJ3T0-6J1F4-3S06S-9A1V9
        Used output buffers: 3 of 40 (22 max)
        === RTOS ===
        Static ram: 151340
        Dynamic ram: 113436 of which 0 recycled
        Never used RAM 80984, free system stack 200 words
        Tasks: NETWORK(ready,32.2%,221) ETHERNET(notifyWait,0.3%,432) ACCEL(notifyWait,0.0%,348) HEAT(notifyWait,0.0%,328) Move(notifyWait,0.0%,350) CanReceiv(notifyWait,0.0%,796) CanSender(notifyWait,0.0%,335) CanClock(delaying,0.0%,340) TMC(notifyWait,7.2%,90) MAIN(running,60.2%,953) IDLE(ready,0.2%,30), total 100.0%
        Owned mutexes:
        === Platform ===
        Last reset 00:01:09 ago, cause: software
        Last software reset at 2023-01-21 14:56, reason: StuckInSpinLoop, Gcodes spinning, available RAM 80920, slot 2
        Software reset code 0x4083 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0044a80f BFAR 0x00000000 SP 0x20419664 Task IDLE Freestk 44 ok
        Stack: 004901dd 00490bba 61000000 a5a5a5a5 004901dd a5a5a5a5 2041aea4 00021363 20424e2c 2041f370 2041967c 20424e24 00000004 20419100 20419100 2041967c 00000000 00000001 204196d8 4e49414d 00000000 00000000 00000001 00000001 02b69a1b 00000000 00000000
        Error status: 0x00
        Step timer max interval 139
        MCU temperature: min 41.1, current 41.3, max 42.3
        Supply voltage: min 23.8, current 23.9, max 23.9, under voltage events: 0, over voltage events: 0, power good: yes
        12V rail voltage: min 12.3, current 12.4, max 12.4, under voltage events: 0
        Heap OK, handles allocated/used 99/89, heap memory allocated/used/recyclable 4096/3776/384, gc cycles 1
        Events: 4 queued, 4 completed
        Driver 0: standstill, SG min n/a, mspos 744, reads 61186, writes 14 timeouts 0
        Driver 1: standstill, SG min n/a, mspos 360, reads 61186, writes 14 timeouts 0
        Driver 2: standstill, SG min n/a, mspos 56, reads 61186, writes 14 timeouts 0
        Driver 3: standstill, SG min n/a, mspos 248, reads 61186, writes 14 timeouts 0
        Driver 4: standstill, SG min n/a, mspos 520, reads 61186, writes 14 timeouts 0
        Driver 5: standstill, SG min n/a, mspos 952, reads 61186, writes 14 timeouts 0
        Date/time: 2023-01-21 14:57:41
        Slowest loop: 5.51ms; fastest: 0.06ms
        === Storage ===
        Free file entries: 10
        SD card 0 detected, interface speed: 25.0MBytes/sec
        SD card longest read time 2.4ms, write time 0.0ms, max retries 0
        === Move ===
        DMs created 125, segments created 0, maxWait 0ms, bed compensation in use: none, comp offset 0.000
        no step interrupt scheduled
        === DDARing 0 ===
        Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
        === DDARing 1 ===
        Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
        === Heat ===
        Bed heaters 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
        === GCodes ===
        Movement locks held by null, null
        HTTP is idle in state(s) 0
        Telnet is idle in state(s) 0
        File is idle in state(s) 0
        USB is idle in state(s) 0
        Aux is idle in state(s) 0
        Trigger is idle in state(s) 0
        Queue is idle in state(s) 0
        LCD is idle in state(s) 0
        SBC is idle in state(s) 0
        Daemon is idle in state(s) 0
        Aux2 is idle in state(s) 0
        Autopause is idle in state(s) 0
        File2 is idle in state(s) 0
        Queue2 is idle in state(s) 0
        Q0 segments left 0, axes/extruders owned 0x0000000
        Code queue 0 is empty
        Q1 segments left 0, axes/extruders owned 0x0000000
        Code queue 1 is empty
        === Filament sensors ===
        Extruder 0: no data received
        Extruder 1: no data received
        Extruder 2: no data received
        Extruder 3: no data received
        === CAN ===
        Messages queued 657, received 1476, lost 0, boc 0
        Longest wait 1ms for reply type 6042, peak Tx sync delay 276, free buffers 50 (min 49), ts 347/346/0
        Tx timeouts 0,0,0,0,0,0
        === Network ===
        Slowest loop: 9.82ms; fastest: 0.03ms
        Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0) Telnet(0)
        HTTP sessions: 1 of 8
        = Ethernet =
        State: active
        Error counts: 0 0 0 1 0 0
        Socket states: 5 2 2 2 2 0 0 0
        = WiFi =
        Network state is disabled
        WiFi module is disabled
        Failed messages: pending 0, notready 0, noresp 0
        Socket states: 0 0 0 0 0 0 0 0
        === Multicast handler ===
        Responder is inactive, messages received 0, responses 0
        
        dc42undefined 1 Reply Last reply Reply Quote 0
        • Diamondbackundefined
          Diamondback
          last edited by Diamondback

          @dc42
          It looks like this line is the culprit: var isActive = var.isFrame || var.isProgress, when I remove it (and directly use that expression below), it works fine...

          Disregard, now that line works fine, so probably some random component to it again...

          Diamondbackundefined 1 Reply Last reply Reply Quote 0
          • Diamondbackundefined
            Diamondback @Diamondback
            last edited by

            @dc42 Now I prevented it from crashing by moving a global set to a later place...

            if global.lastDisplayContent != var.displayContent
            	set global.lastDisplayContent = var.displayContent
            	while iterations < global.displayLEDCount
            		;M150 R{param.C[0]} U{param.C[1]} B{param.C[2]} P{iterations < var.activeLEDs ? var.brightness : 0} S1 F1 ;3.5+
            		var isFrame = iterations < 8 || iterations > 55
            		var isProgress = false ;todo
            		var isActive = var.isFrame || var.isProgress
            		M150 R255 U0 B0 P{var.isActive ? var.brightness : 0} S1 F1
             
            	M150 R0 U0 B0 P0 S1 F0 ;announce last LED with a dummy
            

            becomes:

            if global.lastDisplayContent != var.displayContent
            	while iterations < global.displayLEDCount
            		;M150 R{param.C[0]} U{param.C[1]} B{param.C[2]} P{iterations < var.activeLEDs ? var.brightness : 0} S1 F1 ;3.5+
            		var isFrame = iterations < 8 || iterations > 55
            		var isProgress = false ;todo
            		var isActive = var.isFrame || var.isProgress
            		M150 R255 U0 B0 P{var.isActive ? var.brightness : 0} S1 F1
             
            	M150 R0 U0 B0 P0 S1 F0 ;announce last LED with a dummy
                    set global.lastDisplayContent = var.displayContent
            

            Note how line #2 moved. This somewhat aligns with the crash in daemon.g where a global set also had critical impact on it...

            1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @Diamondback
              last edited by

              @Diamondback what values do you set for the global variables before running this macro? I tried the following values, but it doesn't crash.

              global displayLEDCount=20
              global lastDisplayContent="none"
              global displayDefaultBrightness=10

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              Diamondbackundefined 1 Reply Last reply Reply Quote 0
              • Diamondbackundefined
                Diamondback @dc42
                last edited by

                @dc42

                global displayLEDCount = 64
                global displayDefaultBrightness = 10
                global lastDisplayContent = ""
                

                The more I play around with it, the more I think it's a timing issue... Sometimes I can do things fine by updating the 64 dotstar pixels with 500ms delay between them but not with 100ms etc.

                dc42undefined 1 Reply Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators @Diamondback
                  last edited by

                  @Diamondback said in 3.5b1 Reset reason: StuckInSpinLoop?:

                  global displayLEDCount = 64
                  global displayDefaultBrightness = 10
                  global lastDisplayContent = ""

                  It still doesn't crash for me. Perhaps it depends on what global variables you have created already? Can you share your whole config.g file and any macros that it calls?

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  Diamondbackundefined 1 Reply Last reply Reply Quote 0
                  • Diamondbackundefined
                    Diamondback @dc42
                    last edited by

                    @dc42
                    config.g

                    ;M929 S3                                        ;enable debug logging
                    ;M575 P1 S1 B57600                              ;Enable PanelDue Port
                    G90                                             ; send absolute coordinates...
                    M83                                             ; ...but relative extruder moves
                    M550 P"V-Core Toolchanger"                      ; set printer name
                    
                    ; Enable network
                    M552 P0.0.0.0 S1
                    
                    M669 K1                                         ; select CoreXY mode
                    
                    G4 S2 ; wait for expansion boards to start
                    
                    ; Drives
                    ;XY1: back left
                    ;XY2: back right
                    M569 P0.2 S0                                      ; stepper XY1
                    M569 P0.3 S0                                      ; stepper XY2
                    M569 P0.4 S1                                      ; stepper Coupler
                    M569 P100.0 S0                                    ; stepper E0
                    M569 P100.1 S0                                    ; stepper E1
                    M569 P100.2 S0                                    ; stepper E2
                    M569 P100.3 S0                                    ; stepper E3
                    M569 P0.0 S0                                      ; stepper Z1
                    M569 P0.1 S0                                      ; stepper Z2
                    M569 P0.5 S0                                      ; stepper Z3
                    
                    M584 X0.3 Y0.2 C0.4                               ; set drive mapping (motion system X Y C)
                    M584 E100.0:100.1:100.2:100.3                     ; set drive mapping (extruders)
                    M584 Z0.0:0.1:0.5                                 ; set drive mapping (motion system Z)
                    ;Leadscrew order (starting back center, then clockwise):
                    ;1: back center
                    ;2: front right
                    ;3: front left
                    M671 X-12:216:-203 Y222:-179:-179 S30             ; set Z leadscrew positions
                    
                    
                    ; Axis Limits
                    if !exists(global.hasRunInit)
                    	global minY = -266
                    	global maxY = 115
                    
                    M208 X-148:160 Y{global.minY,global.maxY}       ; set axis minima & maxima
                    M208 C0:250 Z-2:270                             ; set axis minima & maxima
                    
                    M92 X80.00 Y80.00                               ; X/Y: 1.8°/step
                    ;M92 X160.00 Y160.00                            ; X/Y: 0.9°/step
                    M92 C200.00                                     ; C: E3D coupler
                    M92 Z800.00                                     ; Z: TR8x4 leadscrews
                    M350 X16 Y16 I1                                 ; configure microstepping with interpolation
                    M350 C16 Z16 I1                                 ; configure microstepping with interpolation
                    M566 X600 Y600 C2 Z50                           ; set maximum instantaneous speed changes (mm/min)
                    M203 X30000 Y30000 C10000 Z2000                 ; set maximum speeds (mm/min)
                    M201 X5000 Y5000 C500 Z350                      ; set accelerations (mm/s^2)
                    M204 P500 T5000
                    ;M204 P5000 T5000
                    
                    M906 X2000 Y2000                            ; set motor currents (mA) and motor idle factor in per cent
                    M906 C700                                    ; set motor currents (mA) and motor idle factor in per cent
                    M906 Z1500                                   ; set motor currents (mA) and motor idle factor in per cent
                    M906 E500:500:500:500                       ; set motor currents (mA) and motor idle factor in per cent (4x LGX)
                    M906 I50                                   ;only a single idle factor allowed for ALL steppers
                    M84 S30                                         ; Set idle timeout    
                    
                    ;=================== Extruder ======================
                    M92 E408:408:408:408                            ; set steps per mm 
                    M350 E16:16:16:16 I1                            ; configure microstepping 
                    M566 E500:500:500:500                           ; set maximum instantaneous speed changes (mm/min) ; used to be at 1200
                    M203 E15000:15000:15000:15000                   ; set maximum speeds (mm/min) 
                    M201 E3000:3000:3000:3000                       ; set accelerations (mm/s^2)
                    ;====================================================
                    
                    ; Endstops
                    M574 X2 S1 P"0.io0.in"                          ; configure active-high endstop for high end on X via pin xstop
                    M574 Y1 S1 P"0.io1.in"                          ; configure active-high endstop for high end on Y via pin ystop
                    M574 Z0                                         ; No Z-Endstop (use as probe instead)
                    
                    ; Z-Probe
                    if !exists(global.hasRunInit)
                    	global zProbeSpeedFeed = 300
                    	global zProbeSpeedFeedLevel = 1500
                    	global zProbeSpeedTravel = 20000
                    	global zProbeDiveHeightLevel = 30
                    	global zProbeDiveHeightMesh = 3
                    	global zProbePin = "0.io2.in"
                    	global zProbeType = 8
                    	global zProbeTriggerValue = 200
                    	global minXMesh = -146 
                    	global maxXMesh = 150
                    	global minYMesh = -150
                    	global maxYMesh = 150
                    	global meshPointSpacing = 30
                    
                    M558 K0 P{global.zProbeType} C{global.zProbePin} H{global.zProbeDiveHeightMesh} F{global.zProbeSpeedFeed} T{global.zProbeSpeedTravel}  ; Z Endstop/probe
                    M558 K2 P8 C"0.io4.in" H10 F100 T20000  ; tool length switch
                    
                    G31 K0 X0 Y0 Z0 P200 
                    ;G31 K1 X0 Y0 Z0 P200
                    G31 K2 X0 Y0 Z0 P200 
                    
                    ;G31 K0 X0 Y0 Z0 P{global.zProbeTriggerValue}                               ; set Z probe trigger value, offset and trigger height, offsets here are hardcoded in leveling macro as well
                    
                    M557 X{global.minXMesh, global.maxXMesh} Y{global.minYMesh, global.maxYMesh} S{global.meshPointSpacing}   ; define mesh grid
                    M376 H30                                        ; Set bed correction taper
                    
                    ; Heaters
                    M308 S0 P"100.temp0" Y"thermistor" T100000 B3950           ; configure sensor 0 as thermistor 
                    M950 H0 C"100.out0" T0 Q10                                 ; create bed heater output and map it to sensor 0
                    M143 H0 S121                                               ; set temperature limit for heater 0 to 121C
                    M307 H0 B0 R0.676 C345.1 D2.68 S1.00 V24.3                 ; Bed PID Tuning
                    M140 H0                                                    ; map heated bed to heater 0
                    
                    M308 S1 P"0.temp1" Y"thermistor" T100000 B4725 C7.06e-8    ; configure sensor 1 as thermistor
                    M950 H1 C"0.out1" T1                                       ; create nozzle heater output and map it to sensor 1
                    M143 H1 S301                                               ; set temperature limit for heater 1 to 301C
                    
                    M308 S2 P"0.temp2" Y"thermistor" T100000 B4725 C7.06e-8    ; configure sensor 2 as thermistor
                    M950 H2 C"0.out2" T2                                       ; create nozzle heater output and map it to sensor 2
                    M143 H2 S301                                               ; set temperature limit for heater 2 to 301C
                    
                    M308 S3 P"100.temp1" Y"thermistor" T100000 B4725 C7.06e-8  ; configure sensor 3 as thermistor
                    M950 H3 C"100.out1" T3                                     ; create nozzle heater output and map it to sensor 3
                    M143 H3 S301                                               ; set temperature limit for heater 3 to 301C
                    
                    M308 S4 P"100.temp2" Y"thermistor" T100000 B4725 C7.06e-8  ; configure sensor 2 as thermistor
                    M950 H4 C"100.out2" T4                                     ; create nozzle heater output and map it to sensor 2
                    M143 H4 S301                                               ; set temperature limit for heater 2 to 301C
                    
                    M302 S190 R190                                             ;Cold extrusion settings
                    
                    M307 H1 R4.637 K0.673:0.218 D2.31 E1.35 S1.00 B0 V24.2     ; PID Tuning T0
                    M307 H2 R4.174 K0.555:0.276 D1.96 E1.35 S1.00 B0 V24.2     ; PID Tuning T1
                    M307 H3 R4.301 K0.536:0.105 D1.89 E1.35 S1.00 B0 V24.2     ; PID Tuning T2
                    M307 H4 R3.780 K0.576:0.060 D1.57 E1.35 S1.00 B0 V24.2     ; PID Tuning T3
                    
                    ; Fans
                    M950 F0 C"0.out7"                                 ; Hotend Fan Tool 0
                    M106 P0 S255 L255 H1 T50 C"T0 Hotend"             ; Hotend Fan Tool 0
                    M950 F1 C"0.out4" Q50                             ; Layer Fan Tool 0
                    M106 P1 S0 H-1 C"T0"                              ; Layer Fan Tool 0
                    
                    M950 F2 C"0.out8"                                 ; Hotend Fan Tool 1
                    M106 P2 S255 L255 H2 T50 C"T1 Hotend"             ; Hotend Fan Tool 1
                    M950 F3 C"0.out5" Q50                             ; Layer Fan Tool 1
                    M106 P3 S0 H-1 C"T1"                              ; Layer Fan Tool 1
                    
                    M950 F4 C"100.out5"                               ; Hotend Fan Tool 2
                    M106 P4 S255 L255 H3 T50 C"T2 Hotend"             ; Hotend Fan Tool 2
                    M950 F5 C"100.out3" Q50                           ; Layer Fan Tool 2
                    M106 P5 S0 H-1 C"T2"                              ; Layer Fan Tool 2
                    
                    M950 F6 C"100.out6"                               ; Hotend Fan Tool 3
                    M106 P6 S255 L255 H4 T50 C"T3 Hotend"             ; Hotend Fan Tool 3
                    M950 F7 C"100.out4" Q50                           ; Layer Fan Tool 3
                    M106 P7 S0 H-1 C"T3"                              ; Layer Fan Tool 3
                    
                    ;Static layer fan
                    M950 F8 C"0.out0" Q65535                          ; static layer fan
                    M106 P8 S0 H-1 I1 L0.2 C"RSCS"
                    
                    ; Tools
                    M563 P0 D0 H1 F1                                 ; define tool 0
                    G10 P0 R0 S0                                     ; set initial tool 0 active and standby temperatures to 0C
                    
                    M563 P1 D1 H2 F3                                 ; define tool 1
                    G10 P1 R0 S0                                     ; set initial tool 1 active and standby temperatures to 0C
                    
                    M563 P2 D2 H3 F5                                 ; define tool 2
                    G10 P2 R0 S0                                     ; set initial tool 2 active and standby temperatures to 0C
                    
                    M563 P3 D3 H4 F7                                 ; define tool 3
                    G10 P3 R0 S0                                     ; set initial tool 3 active and standby temperatures to 0C
                    
                    M563 P4 S"Pen"                                   ; define tool 4 (Pen)
                    
                    ;Dock present switches
                    M950 J0 C"0.io7.in"                              ; Tool 0 Dock switch
                    M950 J1 C"0.io8.in"                              ; Tool 1 Dock switch
                    M950 J2 C"100.io5.in"                            ; Tool 2 Dock switch
                    M950 J3 C"100.io6.in"                            ; Tool 3 Dock switch
                    
                    ;additional tool related switches
                    M950 J4 C"0.io3.in"                             ;potential toolhead tool present switch, not installed atm, but already wired up inside the box
                    
                    ;Filament sensors, not installed atm, but already wired up inside the box
                    M591 D0 P4 C"100.io0.in" S1 L23.2 R70:150 E5
                    M591 D1 P4 C"100.io1.in" S1 L23.2 R70:150 E5
                    M591 D2 P4 C"100.io2.in" S1 L23.2 R70:150 E5
                    M591 D3 P4 C"100.io3.in" S1 L23.2 R70:150 E5
                    
                    M950 S0 C"0.out9" Q333                          ;PebbleWiper Servo
                    M280 P0 S70                                     ;Servo in idle position
                    M950 P1 C"0.io5.out"                            ;Light switch PWM
                    
                    ;Toolhead Dotstar
                    M150 X0
                    
                    ;Accelerometer
                    M955 P0 C"spi.cs2+spi.cs3"
                    
                    ;Inputshaping
                    ;M593 P"zvddd" F70 S0.2 
                    
                    ; Miscellaneous
                    M98 P"/macros/Misc/ToolheadDisplay/InitToolheadDisplay"
                    M98 P"/macros/Misc/Lights/On"
                    M98 P"/sys/config-tools.g"
                    
                    if !exists(global.hasRunInit)
                    	global pebbleFeedSpeedDefault = 300
                    	global pebbleFeedSpeed = global.pebbleFeedSpeedDefault	
                    	global deactivateToolAfterFilamentChange = false
                    	global displayActiveToolOnHead = true
                    	global hasRunInit = true
                    	global daemonActive = false
                    

                    InitToolheadDisplay

                    if !exists(global.displayLEDCount)
                    	global displayLEDCount = 64
                    	global displayDefaultBrightness = 10
                    	global lastDisplayContent = ""
                    	;global displayDigit = {null, null, null, null, null, null, null, null, null, null} ;enable once we can set individual elements of arrays
                    	;set global.displayDigit[0] = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,0}}
                    	;set global.displayDigit[1] = {{0,0,1,1,1,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,1,1,1,1,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0}}
                    	;set global.displayDigit[2] = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{0,1,1,1,0,0,0,0},{0,0,0,1,1,1,0,0},{0,0,0,0,0,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1}}
                    	;set global.displayDigit[3] = {{0,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{0,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1}}
                    	
                    if !exists(global.displayChar0) && boards[0].firmwareVersion != "3.4.5"
                    	global displayChar0 = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,0}}
                    	global displayChar1 = {{0,0,1,1,1,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,1,1,1,1,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0}}	
                    	global displayChar2 = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{0,1,1,1,0,0,0,0},{0,0,0,1,1,1,0,0},{0,0,0,0,0,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1}}
                    	global displayChar3 = {{0,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{0,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1}}
                    	
                    	global RGBOff = {0,0,0,0}
                    	global RGBRed = {255,0,0,25}
                    	global RGBGreen = {0,255,0,10}
                    	global RGBBlue = {0,0,255,45}
                    	global RGBWhite = {255,255,255,10}
                    

                    Lights/On

                    M42 P1 S230
                    

                    config-tools.g

                    if !exists(global.hasRunInit)
                    	;global toolNozzleSizes = {0,0,0,0}
                    	;global toolNozzleMaterials = {"brass","brass","brass","brass"}
                    	
                    	global tool0NozzleSize = "0.0"
                    	global tool1NozzleSize = "0.0"
                    	global tool2NozzleSize = "0.0"
                    	global tool3NozzleSize = "0.0"
                    	
                    	global tool0NozzleMaterial = ""
                    	global tool1NozzleMaterial = ""
                    	global tool2NozzleMaterial = ""
                    	global tool3NozzleMaterial = ""
                    
                    M98 P"/sys/config-tools-size.g"
                    M98 P"/sys/config-tools-material.g"
                    
                    
                    ;Z-Offset: 	If nozzle is too close to bed _reduce_ offset (negative number becomes more negative)
                    ;			If nozzle is too far away, _increase_ offset (negative number becomes less negative)
                    ;Tool offsets
                    G10 P0 X-8.340 Y39.270 Z-4.190
                    G10 P1 X-8.480 Y39.310 Z-4.020
                    G10 P2 X-8.180 Y38.930 Z-4.200
                    G10 P3 X-8.360 Y39.060 Z-4.506
                    
                    G10 P4 X0 Y46.5 Z-20.000                        ; set tool 4 axis offsets
                    
                    
                    
                    ;    Filament     Nozzle   PA    R-Distance   R-Speed  
                    ; -------------- -------- ----- ------------ --------- 
                    ;  Generic PETG     0.25   0.175        0.6      2100  
                    ;  ---               0.3   0.13         0.6      2100  
                    ;  ---               0.4   0.1          0.6      2100  
                    ;  ---               0.6   0.05         0.6      2100 
                    ;  ---               0.8   0.03         0.6      2100  
                    ;  Generic PLA      0.25   0.0          0.6      2100  
                    ;  ---               0.3   0.0          0.6      2100  
                    ;  ---               0.4   0.08         0.6      2100  
                    ;  ---               0.6   0.0          0.6      2100 
                    ;  ---               0.8   0.0          0.6      2100  
                    ;  BioFusion         0.25  0.0          0.6      2100  
                    ;  ---               0.3   0.09         0.6      2100  
                    ;  ---               0.4   0.07         0.6      2100  
                    ;  ---               0.6   0.0          0.6      2100 
                    ;  ---               0.8   0.035        0.6      2100  
                    ;  PA-CF             0.3   0.0          0.6      2100  
                    ;  ---               0.4   0.0          0.6      2100  
                    ;  PC-CF             0.3   0.0          0.6      2100  
                    ;  ---               0.4   0.0          0.6      2100  
                    ;  PA12              0.25  0.0          0.6      2100  
                    ;  ---               0.3   0.0          0.6      2100  
                    ;  ---               0.4   0.13         0.6      2100  
                    ;  ---               0.6   0.0          0.6      2100 
                    ;  ---               0.8   0.0          0.6      2100  
                    ;  Wood              0.8   0.04         0.6      2100
                    ;  TPU               0.4   0.0          1.0      2100
                    
                    
                    ;https://ozh.github.io/ascii-tables/
                    

                    config-tools-size.g

                    set global.tool0NozzleSize = "0.4"
                    set global.tool1NozzleSize = "0.4"
                    set global.tool2NozzleSize = "0.4"
                    set global.tool3NozzleSize = "0.6"
                    

                    config-tools-material.g

                    set global.tool0NozzleMaterial = "brass"
                    set global.tool1NozzleMaterial = "brass"
                    set global.tool2NozzleMaterial = "brass"
                    set global.tool3NozzleMaterial = "nozzlex"
                    ;set global.toolNozzleMaterials = {"brass","brass","brass","nozzlex"}
                    
                    dc42undefined 1 Reply Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators @Diamondback
                      last edited by

                      @Diamondback thanks.

                      I still couldn't make it crash with your files, but I eventually got a crash with a similar M122 report to yours after running this macro several times:

                      var activeLEDs=10
                      while iterations < 1000
                      	var displayContent = "progress" ^ var.activeLEDs
                      	set global.lastDisplayContent = var.displayContent
                      echo "Done"
                      

                      Duet WiFi hardware designer and firmware engineer
                      Please do not ask me for Duet support via PM or email, use the forum
                      http://www.escher3d.com, https://miscsolutions.wordpress.com

                      Diamondbackundefined 1 Reply Last reply Reply Quote 1
                      • Diamondbackundefined
                        Diamondback @dc42
                        last edited by

                        @dc42 Yea it seems quite random what exactly triggers it, the only things in common for me seem to be some of interaction with custom variables/arrays and possibly the dotstar LEDs, ofc, either one could be a coincidence...

                        dc42undefined 1 Reply Last reply Reply Quote 0
                        • dc42undefined
                          dc42 administrators @Diamondback
                          last edited by

                          @Diamondback I suspect it's an interaction between DWC polling the object model (which involves reading some values from the heap) and garbage collection of the heap taking place because string or array variables are being reassigned.

                          Duet WiFi hardware designer and firmware engineer
                          Please do not ask me for Duet support via PM or email, use the forum
                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                          Diamondbackundefined 1 Reply Last reply Reply Quote 0
                          • Diamondbackundefined
                            Diamondback @dc42
                            last edited by

                            @dc42 I played around with the DWC polling time this morning but didn't get any immediate results, I'll play around with it some more and see if I can maybe make it go away by setting it much higher?

                            dc42undefined 1 Reply Last reply Reply Quote 0
                            • dc42undefined
                              dc42 administrators @Diamondback
                              last edited by

                              @Diamondback my next step will be to disconnect DWC completely and then see if I can provoke the reset by sending the command to run the macro over USB.

                              Duet WiFi hardware designer and firmware engineer
                              Please do not ask me for Duet support via PM or email, use the forum
                              http://www.escher3d.com, https://miscsolutions.wordpress.com

                              Diamondbackundefined dc42undefined 2 Replies Last reply Reply Quote 0
                              • Diamondbackundefined
                                Diamondback @dc42
                                last edited by

                                @dc42 Hm, I guess I can try the same by having the issue triggered by daemon.g and not having any browser connected to it? Or does DWC still do stuff in the background then somehow?

                                dc42undefined 1 Reply Last reply Reply Quote 0
                                • dc42undefined
                                  dc42 administrators @dc42
                                  last edited by

                                  Confirmed, if I send the command over USB with DWC not connected, it doesn't reset. If I connect DWC and send the command over USB, it resets.

                                  Duet WiFi hardware designer and firmware engineer
                                  Please do not ask me for Duet support via PM or email, use the forum
                                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                                  1 Reply Last reply Reply Quote 1
                                  • dc42undefined
                                    dc42 administrators @Diamondback
                                    last edited by

                                    @Diamondback please try the firmware at https://www.dropbox.com/sh/z9f9v517t9txqh9/AACG2Dycr_EghlN4p1HsYVUNa?dl=0. It fixes the case that I was able to reproduce. The change is quite extensive, so please use it with caution.

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    Diamondbackundefined 1 Reply Last reply Reply Quote 1
                                    • Diamondbackundefined
                                      Diamondback @dc42
                                      last edited by

                                      @dc42 Will do! 🙂 This includes the previous array memory leak fix?

                                      dc42undefined 1 Reply Last reply Reply Quote 0
                                      • dc42undefined
                                        dc42 administrators @Diamondback
                                        last edited by

                                        @Diamondback yes it does. If you get any resets, please post a subsequent M122 report.

                                        Duet WiFi hardware designer and firmware engineer
                                        Please do not ask me for Duet support via PM or email, use the forum
                                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                                        Diamondbackundefined 3 Replies Last reply Reply Quote 1
                                        • Diamondbackundefined
                                          Diamondback @dc42
                                          last edited by

                                          @dc42 Looking promising so far, no more resets atm. 🙂
                                          I also yesterday played around more with the DWC polling frequency between 50ms and 60s and as you assumed, with lower values it was happening much quicker.

                                          1 Reply Last reply Reply Quote 0
                                          • Diamondbackundefined
                                            Diamondback @dc42
                                            last edited by

                                            @dc42 Finally working 🙂
                                            https://www.dropbox.com/s/fyguad75k8g2ffe/VID_20230124_102416.mp4?dl=0

                                            1 Reply Last reply Reply Quote 2
                                            • dc42undefined dc42 has marked this topic as solved
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA