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

    [3.5.0-beta.3] 'set var.arr[0] = 1' in loop leads to reset

    Scheduled Pinned Locked Moved Solved
    Beta Firmware
    5
    6
    291
    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.
    • marvineerundefined
      marvineer
      last edited by

      Hi folks,

      Right now, I'm trying to make my macros a bit more maintainable by using arrays. I noticed the following problem:

      ; create array to store n messurements
      var reading = vector(10, 0)
      
      echo var.reading
      
      ; get n messurements and save them in array
      while iterations < 10
          set var.reading[iterations] = 1
      
      echo var.reading
      
      

      Normally, of course, I would not assign a 1 to all elements in the array, but I have simplified the example as much as possible.

      If I run the macro, I get the following messages in the console:
      console_errors

      "M122" throws the following output:

      M122
      === Diagnostics ===
      RepRapFirmware for Duet 3 MB6HC version 3.5.0-beta.3 (2023-04-14 11:28:15) running on Duet 3 MB6HC v1.0 or earlier (SBC mode)
      Board ID: 08DJM-956L2-G43S4-6JTD4-3SS6J-TA7GH
      Used output buffers: 5 of 40 (31 max)
      Error in macro line 72 while starting up: M584: Driver 1.0 does not exist
      === RTOS ===
      Static ram: 154728
      Dynamic ram: 87944 of which 1128 recycled
      Never used RAM 99336, free system stack 196 words
      Tasks: SBC(rWait:,1.1%,390) HEAT(nWait,0.0%,326) Move(nWait,0.0%,340) CanReceiv(nWait,0.0%,795) CanSender(nWait,0.0%,334) CanClock(delaying,0.0%,341) TMC(nWait,7.7%,59) MAIN(running,90.5%,135) IDLE(ready,0.6%,30), total 100.0%
      Owned mutexes: HTTP(MAIN)
      === Platform ===
      Last reset 00:01:54 ago, cause: software
      Last software reset at 2023-05-18 13:49, reason: TerminateCalled, FilamentSensors spinning, available RAM 99240, slot 0
      Software reset code 0x418d HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0044a000 BFAR 0x00000000 SP 0x20439470 Task SBC Freestk 665 ok
      Stack: 0000002b 004966d1 0000002b 00496a7f 00000000 004964c1 204394c0 ffff0000 204394c0 004962a7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 20434a68 00000000 004b7ba4 20434a68 0040ae05 20439524 20409b08
      Error status: 0x00
      Aux0 errors 0,0,0
      MCU temperature: min 35.6, current 44.0, max 44.3
      Supply voltage: min 23.9, current 24.0, max 24.1, under voltage events: 0, over voltage events: 0, power good: yes
      12V rail voltage: min 12.0, current 12.0, max 12.1, under voltage events: 0
      Heap OK, handles allocated/used 99/8, heap memory allocated/used/recyclable 2048/1208/1076, gc cycles 9
      Events: 0 queued, 0 completed
      Driver 0: standstill, SG min n/a, mspos 8, reads 48953, writes 14 timeouts 0
      Driver 1: standstill, SG min n/a, mspos 8, reads 48952, writes 15 timeouts 0
      Driver 2: standstill, SG min n/a, mspos 8, reads 48953, writes 15 timeouts 0
      Driver 3: standstill, SG min n/a, mspos 8, reads 48954, writes 14 timeouts 0
      Driver 4: standstill, SG min n/a, mspos 8, reads 48954, writes 14 timeouts 0
      Driver 5: standstill, SG min n/a, mspos 8, reads 48954, writes 14 timeouts 0
      Date/time: 2023-05-18 13:51:18
      Slowest loop: 3.89ms; fastest: 0.05ms
      === Storage ===
      Free file entries: 20
      SD card 0 not detected, interface speed: 37.5MBytes/sec
      SD card longest read time 0.0ms, 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 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 0, running macro
      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 2: no data received
      === CAN ===
      Messages queued 1044, received 3756, lost 0, boc 0
      Longest wait 3ms for reply type 6053, peak Tx sync delay 373, free buffers 50 (min 49), ts 574/573/0
      Tx timeouts 0,0,0,0,0,0
      === SBC interface ===
      Transfer state: 5, failed transfers: 0, checksum errors: 0
      RX/TX seq numbers: 7608/6553
      SPI underruns 0, overruns 0
      State: 5, disconnects: 0, timeouts: 0 total, 0 by SBC, IAP RAM available 0x26650
      Buffer RX/TX: 0/0-0, open files: 0
      === Duet Control Server ===
      Duet Control Server version 3.5.0-beta.3 (2023-04-14 15:12:26)
      Daemon:
      >> Doing macro daemon.g, started by system
      Code buffer space: 4096
      Configured SPI speed: 8000000Hz, TfrRdy pin glitches: 0
      Full transfers per second: 59.05, max time between full transfers: 304.0ms, max pin wait times: 258.3ms/10.2ms
      Codes per second: 3.45
      Maximum length of RX/TX data transfers: 4657/960
      
      tasundefined dc42undefined chrishammundefined 3 Replies Last reply Reply Quote 0
      • tasundefined
        tas @marvineer
        last edited by

        @marvineer Should there be a var Iterations = 0 before the while?

        jay_s_ukundefined 1 Reply Last reply Reply Quote 0
        • jay_s_ukundefined
          jay_s_uk @tas
          last edited by

          @tas no. iterations is created by the while loop

          Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

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

            @marvineer this looks like either a bug that we have already fixed in the 3.5 source code, or it's specific to SBC mode. We're looking into it.

            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

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

              https://github.com/Duet3D/RepRapFirmware/issues/853

              dc42 created this issue in Duet3D/RepRapFirmware

              closed SBC interface calls ExpressionParser::ParseUnsigned without catching exceptions #853

              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
              • chrishammundefined
                chrishamm administrators @marvineer
                last edited by

                Thanks @marvineer and @dc42, I have fixes ready for DSF and RRF. The reason for the reset was identified by dc42 and the underlying problem was the fact that iterations, which is provided by DSF in SBC mode, wasn't populated before the set command was executed by RRF.

                Duet software engineer

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