Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Solved [SBC] Error: M140 has thrown an exception:

    DSF Development
    2
    10
    97
    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.
    • X3N07
      X3N07 last edited by dc42

      Hi,

      I recently added a SBC to my Duet mini 5+. In standalone mode it printed perfectly fine with no issue. But now I cannot print anything. It still does homing at the beginning of the print, but at the time the printer should be heating up, it displays the following error message:
      Error: M140 has thrown an exception: [ArgumentException] Failed to serialize code.

      When I switched from standalone to SBC I did not change any configuration files.
      It is also strange that a file printed once without error, and when I tried to print the same file again, the error occurred.

      I am aware that there are two similar topics, however, these did not help me.

      Edit:
      I switched back to standalone mode and everything is working perfectly fine. What could be the problem? Thanks for your help 🙂

      1 Reply Last reply Reply Quote 0
      • Phaedrux
        Phaedrux Moderator last edited by

        Did you go through the software update process on the Duet Pi installation? Sudo apt update && sudo apt upgrade?

        When in SBC mode the SD card needs to be removed from the Duet itself.

        Can you setup SBC mode again, and this time send M122 after you see the fault and post it here?

        Z-Bot CoreXY Build | Thingiverse Profile

        X3N07 1 Reply Last reply Reply Quote 0
        • X3N07
          X3N07 @Phaedrux last edited by

          @Phaedrux Yes, I did the software updates on my Pi and removed the SD card from the Duet.

          M122
          === Diagnostics ===
          RepRapFirmware for Duet 3 Mini 5+ version 3.4.5 (2022-11-30 19:41:16) running on Duet 3 Mini5plus Ethernet (SBC mode)
          Board ID: M9G10-B867A-G65J0-401GN-KN82Z-RKBRP
          Used output buffers: 1 of 40 (14 max)
          === RTOS ===
          Static ram: 103652
          Dynamic ram: 98440 of which 0 recycled
          Never used RAM 39548, free system stack 132 words
          Tasks: SBC(ready,1.5%,458) HEAT(notifyWait,0.0%,367) Move(notifyWait,0.0%,290) CanReceiv(notifyWait,0.0%,774) CanSender(notifyWait,0.0%,336) CanClock(delaying,0.0%,341) TMC(notifyWait,0.7%,115) MAIN(running,96.8%,416) IDLE(ready,0.2%,30) AIN(delaying,0.8%,263), total 100.0%
          Owned mutexes: HTTP(MAIN)
          === Platform ===
          Last reset 00:03:05 ago, cause: software
          Last software reset at 2023-01-21 14:54, reason: User, none spinning, available RAM 39548, slot 2
          Software reset code 0x0012 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x00000000 BFAR 0xe000ed38 SP 0x00000000 Task SBC Freestk 0 n/a
          Error status: 0x00
          MCU revision 3, ADC conversions started 185280, completed 185280, timed out 0, errs 0
          Step timer max interval 1490
          MCU temperature: min 29.4, current 29.8, max 30.1
          Supply voltage: min 24.1, current 24.1, max 24.2, under voltage events: 1, over voltage events: 0, power good: yes
          Heap OK, handles allocated/used 0/0, heap memory allocated/used/recyclable 0/0/0, gc cycles 0
          Events: 0 queued, 0 completed
          Driver 0: standstill, SG min 0, read errors 0, write errors 0, ifcnt 15, reads 5616, writes 2, timeouts 0, DMA errors 0, CC errors 0
          Driver 1: standstill, SG min 0, read errors 0, write errors 0, ifcnt 15, reads 5615, writes 2, timeouts 0, DMA errors 0, CC errors 0
          Driver 2: standstill, SG min 0, read errors 0, write errors 0, ifcnt 16, reads 5616, writes 2, timeouts 0, DMA errors 0, CC errors 0
          Driver 3: standstill, SG min 0, read errors 0, write errors 0, ifcnt 13, reads 5618, writes 0, timeouts 0, DMA errors 0, CC errors 0
          Driver 4: standstill, SG min 0, read errors 0, write errors 0, ifcnt 15, reads 5616, writes 2, timeouts 0, DMA errors 0, CC errors 0
          Driver 5: not present
          Driver 6: not present
          Date/time: 2023-01-21 14:57:46
          Cache data hit count 407601691
          Slowest loop: 52.20ms; fastest: 0.08ms
          === Storage ===
          Free file entries: 10
          SD card 0 not detected, interface speed: 0.0MBytes/sec
          SD card longest read time 0.0ms, write time 0.0ms, max retries 0
          === Move ===
          DMs created 83, segments created 3, maxWait 146300ms, bed compensation in use: none, comp offset 0.000
          === MainDDARing ===
          Scheduled moves 6, completed 6, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
          === AuxDDARing ===
          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, chamber heaters -1 -1 -1 -1, ordering errs 0
          === GCodes ===
          Segments left: 0
          Movement lock held by null
          HTTP* is doing "M122" 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
          Code queue is empty
          === CAN ===
          Messages queued 962, received 2137, lost 0, boc 0
          Longest wait 2ms for reply type 6013, peak Tx sync delay 3, free buffers 18 (min 17), ts 533/533/0
          Tx timeouts 0,0,0,0,0,0
          === SBC interface ===
          Transfer state: 5, failed transfers: 0, checksum errors: 0
          RX/TX seq numbers: 8028/8028
          SPI underruns 0, overruns 0
          State: 5, disconnects: 0, timeouts: 0 total, 0 by SBC, IAP RAM available 0x0f6ac
          Buffer RX/TX: 0/0-0, open files: 0
          === Duet Control Server ===
          Duet Control Server v3.4.5
          Code buffer space: 4096
          Configured SPI speed: 8000000Hz, TfrRdy pin glitches: 1
          Full transfers per second: 39.13, max time between full transfers: 54.8ms, max pin wait times: 35.4ms/0.7ms
          Codes per second: 0.18
          Maximum length of RX/TX data transfers: 3499/848
          
          1 Reply Last reply Reply Quote 0
          • Phaedrux
            Phaedrux Moderator last edited by

            Can you share your config.g and the first 50 lines or so of the gcode file being printed?

            Z-Bot CoreXY Build | Thingiverse Profile

            X3N07 1 Reply Last reply Reply Quote 0
            • X3N07
              X3N07 @Phaedrux last edited by

              @Phaedrux This is my config:

              ; RRF 3.x config for CR20 IDEX - dual independent Z
              ; General preferences
              M929 P"eventlog.txt" S3 ;save log data
              M80 C"pson" ; Turns on the ATX power supply
              M451                                      ; Enable FFF mode
              G90                                       ; Send absolute coordinates...
              M83                                       ; ...but relative extruder moves
              
              ; Drives 
              M569 P0.0 D3 S1 V20                                     ; Physical drive goes forwards, stealthChop (X) 
              M569 P0.1 D3 S1 V20                                     ; Physical drive goes forwards, stealthChop (Y)
              M569 P0.2 D3 S1 V20                                     ; Physical drive goes forwards, stealthChop, set tpwmthrs parameter (Z)
              M569 P0.3 D3 S0                                         ; Physical drive goes forwards, stealthChop (E0)
              M569 P0.4 D3 S1 V20                                     ; Physical drive goes forwards, stealthChop (U)
              M569 P121.0 D3 S0                                       ; Physical drive goes forwards, stealthChop (E1)
              M584 X0.0 Y0.1 Z0.2 U0.4 E0.3:121.0                  	; X Y Z U E0:E1 drive mapping
              
              ;set stall detection
              M915 XU S40 R1 F2
              M915 Y S0 R1 F2							
              M915 Z S50 R1 F2									
              
              ;set motor values
              M906 X650 Y750 Z1000 U650 E1000:1000 I30             			; Set motor currents (mA) (and motor idle factor in per cent)
              M350 X16 Y16 U16 Z16 E16:16 I1                                  ; Configure microstepping with interpolation
              M92 X94.33 Y94.11 U94.33 Z400 E95.85:95.85  					; Set steps per mm 
              M566 X700.00 Y700.00 Z80 U700.00 E600.00:600.00 P0              ; Set maximum instantaneous speed changes (mm/min)
              ; M205 X6 Y6 U6 Z0.3 E5                                         ; Set maximum instantaneous speed changes (mm/sec)
              M203 X5000.00 Y4500.00 U5000.00 Z900.00 E3000.00:3000.00       	; Set maximum speeds (mm/min)
              M201 X500.00 Y500.00 U500.00 Z70.00 E2000.00:2000.00        	; Set accelerations (mm/s^2)
              ;M204 P20000 T20000                                             ; Set print and travel acceleration maximums
              M84 S30                                                         ; Set idle timeout
              
              ; Axis Limits
              M208 X-23:207 Y-10:138 U60:290 Z0:150    
              
              ; Endstops  
              M574 X1 S1 P"io0.in"                    ;low end switch
              M574 Y1 S1 P"!io1.in"                   ;low end switch                                    
              M574 Z1 S1 P"!io2.in"                   ;low end switch
              M574 U2 S1 P"io4.in"                    ;high end switch
              
              ;set filament out sensor
              M591 D0 P3 C"io5.in" S1 A1 L25.84 R70:114	; filament monitor connected to E0_stop
              M591 D0 									; display filament sensor parameters for extruder drive 0
              
              ;Z-Probe
              M558 P1 C"io3.in" H7 F120 T6000         ;umodulated probe, dive height, speeds
              G31 P500 X26 Y5 Z2.126                  ;trigger value, offset, hight
              M557 X-19:206 Y0:135 S15                ;define mesh grid
              
              ; Thermistors
              M308 S0 P"0.temp0" Y"thermistor" A"bed" T100000 B4138           ;thermistor onboard 
              M308 S1 P"0.temp1" Y"pt1000" A"left" B1096                      ;pt1000 onboard
              M308 S2 P"121.temp0" Y"pt1000" A"right" B1096                   ;pt1000 on toolboard
              
              ; Heaters
              M950 H0 C"0.OUT0" T0                                   ; heater 0 uses the OUT0 pin, sensor 0
              M950 H1 C"0.OUT1" T1                                   ; heater 1 uses the OUT2 pin and sensor 1
              M950 H2 C"121.OUT0" T2                                 ; heater 2 uses the OUT2 pin and sensor 2
              
              ; Fans
              M950 F0 C"0.OUT3" Q250                                 ; x part cooling fan
              M950 F1 C"0.OUT5"                                      ; x heatsink fan
              M950 F2 C"121.OUT1"                                    ; u part cooling fan
              M950 F3 C"0.OUT6"                                      ; u heatsink fan
              
              M106 P0 C"left heatsink fan" H1 T45                  ; part cooling fan is thermostatically controlled
              M106 P1 C"left part fan" H-1 S0                      ; print head fan is not thermostatically controlled
              M106 P2 C"right heatsink fan" H2 T45                 ; part cooling fan is thermostatically controlled
              M106 P3 C"right part fan" H-1 S0                     ; print head fan is not thermostatically controlled
              
              ;Tools
              
              ; Bed
              M140 H0                                             ; bed heater
              
              ; first toolhead (left)
              M563 P0 S"left"  D0 H1 X0 F0                        ; first tool, X head
              G10 P0 X0 Y0 Z0 S0 R0                               ; set tool 0 offsets and temperatures
              
              ; second toolhead (right)
              M563 P1 S"right"  D1 H2 X3 F2                       ; second tool, U head
              G10 P1 X61 Y0 Z0.95 S0 R0                     		; tool offsets
              
              ; -- copy mode
              ;M563 P2 S"copy mode"  D0:1 H1:2 X0:3 F0:2          ; tool for copy mode
              ;G10 P2 X85 Y0 Z0 U61 S0 R0                         ; tool offsets for copy mode
              ;M567 P2 E1:1                                       ; set mix ratio 100% on both extruders for copy mode
              
              ; -- mirror mode 
              ;M563 P3 S"mirror mode" D0:1 H1:2 X0:3 F0:2         ; tool for mirror mode
              ;G10 P3 X60 Y0 Z0 U-61 S0 R0                        ; tool offset for mirror mode (flipped X offset)
              ;M567 P3 E1:1                                       ; set mix ratio 100% on both extruders for mirror mode
              
              ; temperature limits
              M143 H0 S150
              M143 H1 S340
              M143 H2 S240
              
              ; PID tune
              M501
              

              And this are the first Lines of the Gcode. This is actually not the first line but the 337th. Line 1 here is the 337th line in the Gcode file itself. But the lines 1-337 are only comments. I think they are for the preview image. I have removed them once, but it made no difference.

              ;Generated with Cura_SteamEngine 5.2.1
              T0
              M190 S60
              M104 S190
              M109 S190
              M82 ;absolute extrusion mode
              M915 XYZU S3 R1 F1
              M82 ;absolute extrusion mode
              T0
              G21                ;metric values
              G90                ;absolute positioning
              M107              ;start with the fan off
              M83  	       ; extruder relative mode
              M104 S[first_layer_temperature] ; set extruder temp
              M140 S[first_layer_bed_temperature] ; set bed temp
              ; Homing & leveling
              G28		      
              G1  X86.5 Y105 F1000 ; Go to bed center before probing
              ;Wait for Temperature
              M109 S[first_layer_temperature] ; wait for extruder temp
              M190 S[first_layer_bed_temperature] ; wait for bed temp
              G30 ; Find the Z=0
              G29 S1         ; Load the height map from the last time I used G29 to probe the bed.
              M83 ;relative extrusion mode
              M83 ;relative extrusion mode
              G1 F1500 E-4
              ;LAYER_COUNT:198
              ;LAYER:0
              M107
              G1 F600 Z1.3
              G0 F4200 X102.353 Y63.588 Z1.3
              ;TYPE:SKIRT
              G1 F600 Z0.3
              G1 F1500 E4
              G1 F2400 X102.618 Y63.176 E0.02444
              G1 X102.946 Y62.813 E0.02441
              G1 X103.329 Y62.508 E0.02443
              G1 X103.757 Y62.27 E0.02443
              G1 X104.217 Y62.104 E0.0244
              G1 X104.779 Y62 E0.02851
              G1 X125 Y62 E1.00883
              
              1 Reply Last reply Reply Quote 0
              • Phaedrux
                Phaedrux Moderator last edited by

                Is that a finished sliced file from cura? It looks like the placeholder values haven't been evaluated to actual numbers.

                M140 S[first_layer_bed_temperature] ; set bed temp

                [first_layer_bed_temperature] should be replaced by the slicer to the actual number value chosen for the bed temp. If it's not doing that either the placeholder text is incorrect, or something is stopping cura from replacing it, maybe a bug?

                At any rate, if you pass M140 S[first_layer_bed_temperature] to RRF as is, it's not going to like that, it expects a number.

                Z-Bot CoreXY Build | Thingiverse Profile

                X3N07 1 Reply Last reply Reply Quote 0
                • X3N07
                  X3N07 @Phaedrux last edited by

                  @Phaedrux Yes, this is a sliced file from cura. Last week I changed M140 S[first_layer_temperature] to my target temps, but then I got a new error. Not M140 but M190 S[first_layer_temperature]. But I just wasn't smart enough to change that too 😆 : So now I did that and had several other errors:

                  Error: in GCode file: M140: temperature too high for heater 0
                  Error: in GCode file: M190: temperature too high for heater 0
                  

                  But despite the errors it did print.
                  The "[first_layer_temperature]" seems to be the problem. But why can I print the exact same gcode file in standalone mode without any problems?

                  X3N07 Phaedrux 2 Replies Last reply Reply Quote 0
                  • X3N07
                    X3N07 @X3N07 last edited by X3N07

                    @X3N07 said in [SBC] Error: M140 has thrown an exception::

                    But why can I print the exact same gcode file in standalone mode without any problems?

                    I discovered that I also get error messages in standalone mode:

                    Error: in GCode file line 1403 column 11: M109: expected number after 'r'
                    Error: Bad command: mperature] 
                    Error: in GCode file line 1404 column 11: M190: expected number after 'r'
                    Error: Bad command: mperature]
                    Error: in GCode file line 1397 column 11: M104: expected number after 'r'
                    Error: Bad command: mperature] 
                    Error: in GCode file line 1398 column 7: M140: expected number after 'S'
                    Error: Bad command: mperature]
                    

                    But they are probably only reported and then ignored, because the print continues normally.
                    The line numbers don't match the above gcode, because that was a different print.

                    1 Reply Last reply Reply Quote 0
                    • Phaedrux
                      Phaedrux Moderator @X3N07 last edited by

                      @X3N07 said in [SBC] Error: M140 has thrown an exception::

                      But why can I print the exact same gcode file in standalone mode without any problems?

                      It's handling garbage inputs differently.

                      I think the problem is that you're not using the right replacement terms for Cura. Cura uses curly brackets for one thing. Maybe you've got them from Prusa Slicer?

                      Here are curas
                      http://files.fieldofview.com/cura/Replacement_Patterns.html

                      Here's prusa slicers
                      https://help.prusa3d.com/ja/article/list-of-placeholders_205643

                      Z-Bot CoreXY Build | Thingiverse Profile

                      X3N07 1 Reply Last reply Reply Quote 0
                      • X3N07
                        X3N07 @Phaedrux last edited by

                        @Phaedrux I found my mistake. I thought I had no start code for my extruder in cura. I even looked it up. But cura didn't display anything.

                        Cura1.jpg

                        Turns out I did have one.
                        However, the start code was not displayed unless I clicked on the input box.

                        Cura2.jpg

                        And in my startcode there were the bad gcode commands.

                        Now that I removed them, the gcode file looks normal again and everything works as it should.
                        So thanks 😃

                        1 Reply Last reply Reply Quote 2
                        • Topic has been marked as a question  Phaedrux Phaedrux 
                        • Topic has been marked as solved  Phaedrux Phaedrux 
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA