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

    [Telnet] Random chars in command

    Scheduled Pinned Locked Moved Unsolved
    General Discussion
    5
    9
    313
    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.
    • AndMazundefined
      AndMaz
      last edited by AndMaz

      This is a long standing problem (not just v3.5.1). It's not recurrent but still, it's an annoying one. Sometimes when I connect via telnet to my duet I get random chars.

      Example:
      7061722c-2177-4dd9-92e8-c5a4541c8a30-image.png
      another example:
      64471d08-e4a4-47e2-a247-1d3ee6e4b83e-image.png

      ^M is when I press Enter and ^? for Backspace

      Closing connection and opening again works fine

      09e8f583-3f6b-4caf-b4ea-bd89ccfe705c-image.png

      This happens on Linux and on Mac.

      Any idea of what is going on here?

      droftartsundefined gloomyandyundefined 2 Replies Last reply Reply Quote 0
      • droftartsundefined
        droftarts administrators @AndMaz
        last edited by

        @AndMaz Which Duet board, WiFi or Ethernet? If you could do an M122 while it's happening, and another when it's fine, there maybe some information in the Network diagnostics that might be useful.

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        1 Reply Last reply Reply Quote 0
        • gloomyandyundefined
          gloomyandy @AndMaz
          last edited by

          @AndMaz In general RRF does not support the use of editing keys (like backspace or the arrow keys) when reading text so it will be seeing the backspace characters you are typing as invalid values. Not sure about the other invalid characters, if enter is causing problems you may need to change what character the enter key is sending in your terminal program.

          1 Reply Last reply Reply Quote 1
          • AndMazundefined
            AndMaz
            last edited by

            @droftarts @gloomyandy I'm using Duet 2 Ethernet.

            In general RRF does not support the use of editing keys (like backspace or the arrow keys) when reading text so it will be seeing the backspace characters you are typing as invalid values.
            If enter is causing problems you may need to change what character the enter key is sending in your terminal program.

            Both enter and backspace work fine when telnet works "properly". The other keys are not so important to me

            When it misbehaves it "magically" adds random chars, as in the echo 1 command that's shown in the first image.

            Network diagnostics that might be useful

            Yep, I'll keep you updated.

            gloomyandyundefined 1 Reply Last reply Reply Quote 0
            • gloomyandyundefined
              gloomyandy @AndMaz
              last edited by

              @AndMaz I think it would help if you could tell us exactly what it is you are typing (including and backspace or other keys) when you get this output (along with exactly what output you get). So for instance do you ever get this extra output if you just type the command correctly (no editing of the line) and hit enter?

              AndMazundefined 1 Reply Last reply Reply Quote 0
              • AndMazundefined
                AndMaz @gloomyandy
                last edited by

                @gloomyandy said in [Telnet] Random chars in command:

                So for instance do you ever get this extra output if you just type the command correctly (no editing of the line) and hit enter?

                Yep, I do. As shown in prints above simple echo 1 produces Bad command 0x03]0x18]0x1f]0x05] echo 1. There's no special chars in here nor it's a copy-paste

                1 Reply Last reply Reply Quote 0
                • Phaedruxundefined Phaedrux marked this topic as a question
                • AndMazundefined
                  AndMaz
                  last edited by

                  Here's the M122, obtained via HTTP, when telnet is showing "Bad Command" error for echo 123:

                  Escape character is '^]'.
                  echo 123
                  Error: Bad command: 0x03]0x18]0x1f]0x05]echo 123
                  ok
                  M122
                  Error: Bad command: M122
                  ok
                  
                  === Diagnostics ===
                  RepRapFirmware for Duet 2 WiFi/Ethernet version 3.5.1 (2024-04-19 14:40:46) running on Duet Ethernet 1.02 or later
                  Board ID: 
                  Used output buffers: 1 of 26 (26 max)
                  Error in macro line 182 while starting up: I2C transmission error
                  === RTOS ===
                  Static ram: 23256
                  Dynamic ram: 77288 of which 0 recycled
                  Never used RAM 4032, free system stack 172 words
                  Tasks: NETWORK(1,ready,34.5%,179) HEAT(3,nWait 5,0.1%,330) Move(4,nWait 5,0.0%,359) MAIN(1,running,65.4%,660) IDLE(0,ready,0.0%,29), total 100.0%
                  Owned mutexes:
                  === Platform ===
                  Last reset 184:52:29 ago, cause: software
                  Last software reset at 2024-05-13 14:28, reason: User, Gcodes spinning, available RAM 3320, slot 2
                  Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0041f000 BFAR 0xe000ed38 SP 0x00000000 Task MAIN Freestk 0 n/a
                  Error status: 0x0c
                  Aux0 errors 0,0,0
                  MCU temperature: min 36.5, current 37.0, max 37.1
                  Supply voltage: min 23.7, current 23.8, max 23.8, under voltage events: 0, over voltage events: 0, power good: yes
                  Heap OK, handles allocated/used 297/201, heap memory allocated/used/recyclable 6144/5672/1340, gc cycles 18345
                  Events: 0 queued, 0 completed
                  Driver 0: standstill, SG min n/a
                  Driver 1: standstill, SG min n/a
                  Driver 2: standstill, SG min n/a
                  Driver 3: standstill, SG min n/a
                  Driver 4: standstill, SG min n/a
                  Driver 5: 
                  Driver 6: 
                  Driver 7: 
                  Driver 8: 
                  Driver 9: 
                  Driver 10: 
                  Driver 11: 
                  Date/time: 2024-05-21 07:21:05
                  Cache data hit count 4294967295
                  Slowest loop: 7.23ms; fastest: 0.15ms
                  I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
                  === Storage ===
                  Free file entries: 7
                  SD card 0 detected, interface speed: 20.0MBytes/sec
                  SD card longest read time 3.5ms, write time 0.0ms, max retries 0
                  === Move ===
                  DMs created 83, segments created 0, maxWait 0ms, bed compensation in use: none, height map offset 0.000, max steps late 0, min interval 0, bad calcs 0, ebfmin 0.00, ebfmax 0.00
                  no step interrupt scheduled
                  Moves shaped first try 0, on retry 0, too short 0, wrong shape 0, maybepossible 0
                  === DDARing 0 ===
                  Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
                  === Heat ===
                  Bed heaters -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
                  === GCodes ===
                  Movement locks held by null
                  HTTP is idle in state(s) 0
                  Telnet is idle in state(s) 0
                  File is doing "G4 S15" in state(s) 0 0, running macro
                  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
                  Daemon is idle in state(s) 0
                  Autopause is idle in state(s) 0
                  Q0 segments left 0
                  Code queue 0 is empty
                  === Network ===
                  Slowest loop: 9.95ms; fastest: 0.07ms
                  Responder states: HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(1)
                  HTTP sessions: 1 of 8
                  Interface state active, link 100Mbps full duplex
                  Socket states: 5 2 2 2 1 3
                  

                  and here's when telnet is ok

                  === Diagnostics ===
                  RepRapFirmware for Duet 2 WiFi/Ethernet version 3.5.1 (2024-04-19 14:40:46) running on Duet Ethernet 1.02 or later
                  Board ID: 
                  Used output buffers: 1 of 26 (26 max)
                  Error in macro line 182 while starting up: I2C transmission error
                  === RTOS ===
                  Static ram: 23256
                  Dynamic ram: 77288 of which 0 recycled
                  Never used RAM 4032, free system stack 172 words
                  Tasks: NETWORK(1,ready,33.9%,179) HEAT(3,nWait 5,0.1%,330) Move(4,nWait 5,0.0%,359) MAIN(1,running,66.0%,660) IDLE(0,ready,0.0%,29), total 100.0%
                  Owned mutexes:
                  === Platform ===
                  Last reset 184:53:20 ago, cause: software
                  Last software reset at 2024-05-13 14:28, reason: User, Gcodes spinning, available RAM 3320, slot 2
                  Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0041f000 BFAR 0xe000ed38 SP 0x00000000 Task MAIN Freestk 0 n/a
                  Error status: 0x0c
                  Aux0 errors 0,0,0
                  MCU temperature: min 36.5, current 36.8, max 37.2
                  Supply voltage: min 23.7, current 23.8, max 23.8, under voltage events: 0, over voltage events: 0, power good: yes
                  Heap OK, handles allocated/used 297/201, heap memory allocated/used/recyclable 6144/4736/404, gc cycles 18347
                  Events: 0 queued, 0 completed
                  Driver 0: standstill, SG min n/a
                  Driver 1: standstill, SG min n/a
                  Driver 2: standstill, SG min n/a
                  Driver 3: standstill, SG min n/a
                  Driver 4: standstill, SG min n/a
                  Driver 5: 
                  Driver 6: 
                  Driver 7: 
                  Driver 8: 
                  Driver 9: 
                  Driver 10: 
                  Driver 11: 
                  Date/time: 2024-05-21 07:21:56
                  Cache data hit count 4294967295
                  Slowest loop: 4.57ms; fastest: 0.22ms
                  I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
                  === Storage ===
                  Free file entries: 7
                  SD card 0 detected, interface speed: 20.0MBytes/sec
                  SD card longest read time 3.2ms, write time 1.1ms, max retries 0
                  === Move ===
                  DMs created 83, segments created 0, maxWait 0ms, bed compensation in use: none, height map offset 0.000, max steps late 0, min interval 0, bad calcs 0, ebfmin 0.00, ebfmax 0.00
                  no step interrupt scheduled
                  Moves shaped first try 0, on retry 0, too short 0, wrong shape 0, maybepossible 0
                  === DDARing 0 ===
                  Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
                  === Heat ===
                  Bed heaters -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
                  === GCodes ===
                  Movement locks held by null
                  HTTP is idle in state(s) 0
                  Telnet is idle in state(s) 0
                  File is doing "G4 S15" in state(s) 0 0, running macro
                  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
                  Daemon is idle in state(s) 0
                  Autopause is idle in state(s) 0
                  Q0 segments left 0
                  Code queue 0 is empty
                  === Network ===
                  Slowest loop: 3.72ms; fastest: 0.07ms
                  Responder states: HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(1)
                  HTTP sessions: 1 of 8
                  Interface state active, link 100Mbps full duplex
                  Socket states: 5 2 2 2 1 3
                  

                  Sorry for @dc42 tagging you but do you have any clue on what might be causing this?

                  1 Reply Last reply Reply Quote 0
                  • EasyTargetundefined
                    EasyTarget
                    last edited by

                    Related; I've been connecting to my Duet@ Wifi over USB and serial a lot recently; but also over telnet (all while working on SerialOM, which actually started out as a telnet client).

                    I have seen similar behaviour on all serial connection types, after a restart random chars appear in the input buffer of the duet. I have seen this on uart, USB-Serial and telnet connections, but is is very ephemeral and random. SerialOM actually has code in it's startup that sends a couple of \n's and ignores the response at startup; I added this specifically to address this issue.

                    I have a 'gut feel' that something is wonky with the input and output buffer initialisation at startup. Possibly the internal MCU UART registers themselves not being properly reset and cleaned during resets? This is a guess on my part, based on observed behaviour, reality may differ substantially.

                    This is an example from last Tuesday; I'm connecting to my D2wifi via USB serial from a Pi3 using pyserial-miniterm.

                    --- Miniterm on /dev/ttyACM0  9600,8,N,1 ---
                    --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
                    g time
                    File 0:/gcodes/bailer.gcode will print in 0h 56m plus hea
                    Error: Bad command: WiFi module is ce
                    ok
                    

                    Context: This is a connection to the board via USB serial immediately after it was rebooted.
                    Before the reboot I had just finished simulating a print via the Web interface.
                    As you can see the Input buffer on the Duet appears to have text in it that was actually written to all serial devices before the restart when the simulation finished.
                    The Duet2 is still running 2.4.6, but I have seen this with earlier releases too

                    Disaster? The original Printeye is dying with RRF 3.5 (M208 depreciated).
                    PrintPy2024 to the rescue!
                    MicroPython based; with simple wiring and and no custom PCB.

                    Chrissundefined 1 Reply Last reply Reply Quote 0
                    • Chrissundefined
                      Chriss @EasyTarget
                      last edited by

                      I see the same behaviour since a looong time. (Linux workstation) It is a bit surprising that I see that every time when I reboot the board and keep the telnet session open. (Which obviously disconnects than) The "Random chars" appear at a reconnect. The only "fix" I found is:
                      Disconenct from the telnet server
                      reset (to reset the linux terminal session)
                      Connect via telnet. That fixes it in 99%.

                      Cheers, Chriss

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA