Duet2WiFi net connection inconsistent between VIN and USB

  • I just got a Duet2WiFi to replace my kossel's MKSMini that got the extruder driver blown. Just finished the rewiring and initial setup and I'm experiencing a few issues for which I'll cut separate threads so if I get to resolve them, others can easily find the fixes for their issues in the future.

    2/22/2021, 11:17:12 PM	M115
    FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet 
    ELECTRONICS: Duet WiFi 1.02 or later FIRMWARE_DATE: 2020-02-09b1

    So Problem #1 is the duet doesn't always connect to the wifi when using VIN, which means sometimes when i edit the config.g (still calibrating the thing) after reset it never comes back up. I need to kill the power or reset it sometimes once, sometimes multiple times until it randomly connects back and it may or may not stay up after multiple resets until it fails similarly again. I was unable to recognize a pattern in this behavior. Whenever it doesn't connect there is absolutely zero connectivity - there is no ICMP traffic to it either (i.e. no ping).
    Funnily enough if I were to kill the PSU and power the board via USB everything works 100% of the time. Since I'm hooking the board to my laptop on the off chance I need to send commands via the serial emulation, I'm never connecting both the PSU and the USB to make sure something doesn't kill my laptop's board/USB controller.

    The setup I have is a bunch of TPLink devices in OneMesh, the MAC is the default one (i.e. no MAC spoofing via M540) and the IP has been reserved on the router DHCP side to ensure my host records locally work.

  • Moderator

    @vlex please post config.g and response to M122, which will show WiFi firmware version and signal strength. You can do this connected via USB or via DWC if Wi-Fi is connected. Does the blue LED on the WiFi module continue to flash, or stay solid (indicating a connection), when you can’t connect? If you have a multimeter, it may also be worth checking the 5V and 3.3V levels on USB and VIN.


  • I'd second measuring the 5V and 3.3V rails if you can. Yesterday I saw a similar problem (not on a Duet board) with an ESP8266 (the device used for WiFi on The Duet). That board had a fault that resulted in the 3.3V supply being around 3.65V when running from a 24V VIn and 3.2V when running from the 5V supplied via USB. The board worked fine when running from the USB supply, but when running from 5V the ESP8266 would sometimes not boot. The main mcu was fine. The maximum rated supply voltage for an ESP8266 is 3.6V, so I guess it was just on the edge.

  • M122
    === Diagnostics ===
    RepRapFirmware for Duet 2 WiFi/Ethernet version 2.05.1 running on Duet WiFi 1.02 or later
    Board ID: 0JD0M-9P6M2-NW4SS-6J9DJ-3S46K-1TY3M
    Used output buffers: 3 of 24 (9 max)
    === RTOS ===
    Static ram: 25712
    Dynamic ram: 92636 of which 364 recycled
    Exception stack ram used: 408
    Never used ram: 11952
    Tasks: NETWORK(ready,628) HEAT(blocked,1232) MAIN(running,388) IDLE(ready,160)
    Owned mutexes:
    === Platform ===
    Last reset 00:08:35 ago, cause: power up
    Last software reset at 2021-02-22 23:52, reason: User, spinning module GCodes, available RAM 11944 bytes (slot 2)
    Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0441f000 BFAR 0xe000ed38 SP 0xffffffff Task 0x4e49414d
    Error status: 0
    Free file entries: 9
    SD card 0 detected, interface speed: 20.0MBytes/sec
    SD card longest block write time: 7.6ms, max retries 0
    MCU temperature: min 30.3, current 39.0, max 39.1
    Supply voltage: min 10.5, current 11.6, max 12.0, under voltage events: 0, over voltage events: 0, power good: yes
    Driver 0: ok, SG min/max 0/327
    Driver 1: ok, SG min/max 0/475
    Driver 2: ok, SG min/max 0/493
    Driver 3: ok, SG min/max not available
    Driver 4: standstill, SG min/max not available
    Date/time: 2021-02-23 21:03:30
    Cache data hit count 1550935955
    Slowest loop: 19.37ms; fastest: 0.06ms
    I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
    === Move ===
    Hiccups: 0, FreeDm: 140, MinFreeDm: 136, MaxWait: 265901ms
    Bed compensation in use: none, comp offset 0.000
    === DDARing ===
    Scheduled moves: 190, completed moves: 150, StepErrors: 0, LaErrors: 0, Underruns: 0, 0
    === Heat ===
    Bed heaters = 0 -1 -1 -1, chamberHeaters = -1 -1
    Heater 0 is on, I-accum = 0.0
    Heater 1 is on, I-accum = 0.5
    === GCodes ===
    Segments left: 0
    Stack records: 2 allocated, 0 in use
    Movement lock held by null
    http is idle in state(s) 0
    telnet is idle in state(s) 0
    file is doing "G1 X22.124 Y18.129 E0.02169" in state(s) 0
    serial is idle in state(s) 0
    aux is idle in state(s) 0
    daemon is idle in state(s) 0
    queue is idle in state(s) 0
    autopause is idle in state(s) 0
    Code queue is empty.
    === Network ===
    Slowest loop: 84.62ms; fastest: 0.00ms
    Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0) Telnet(0)
    HTTP sessions: 1 of 8
    - WiFi -
    Network state is running
    WiFi module is connected to access point 
    Failed messages: pending 0, notready 0, noresp 0
    WiFi firmware version 1.23
    WiFi MAC address f4:cf:a2:e2:09:11
    WiFi Vcc 3.38, reset reason Turned on by main processor
    WiFi flash size 4194304, free heap 23168
    WiFi IP address
    WiFi signal strength -52dBm, reconnections 0, sleep mode modem
    Socket states: 0 0 0 0 0 0 0 0

    Yes, the LED stops blinking (usually it does do two sets of blinks though, i.e. 3 blinks, short stop while it's on then another 3 blinks and then solid again). I noticed today also that it didn't boot correctly over usb either - I tried 2-3 times and the web ui never booted, plus the serial terminal couldn't connect - tried on two separate ports just in case.

    Measured the 3.3 and 5V buses - the 3.3 bus reads 3.29-3.30 - even though I'm not measuring with a fluke meter, but with some chinesium with questionable accuracy, it should be within spec. The 5V bus was 4.98-5.00 too. The VIN is at 11.80, so I might tweak the pot to get an even 12V in the PSU, though I doubt it to be the issue given the steady voltages on these two buses.

  • Moderator

    @vlex as voltages and WiFi signal seem okay, I’d probably check the SD card; M122 reports the interface is okay, so possible card corruption or slow access causing boot problems. What are you currently using? See here for notes on size and formatting and try a new card: https://duet3d.dozuki.com/Wiki/SD_Card#Section_Specification
    Also please post config.g.


  • Apologies, completely forgot about the config.g:

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; Configuration file for Duet WiFi (firmware version 2.03)
    ; executed by the firmware on start-up
    ; generated by RepRapFirmware Configuration Tool v3.2.3 on Mon Feb 22 2021 09:18:29 GMT+0000 (Greenwich Mean Time)
    ; General preferences
    G90                                         ; send absolute coordinates...
    M83                                         ; ...but relative extruder moves
    M550 P"SomeHostName"                           ; set printer name
    M665 R105.6 L218 B85 H317                   ; Set delta radius, diagonal rod length, printable radius and homed height
    M666 X0 Y0 Z0                          ; put your endstop adjustments here, or let auto calibration find them
    ; Network
    M552 S1                                     ; enable network
    M586 P0 S1                                  ; enable HTTP
    M586 P1 S0                                  ; disable FTP
    M586 P2 S0                                  ; disable Telnet
    ; Drives
    M569 P0 S1                                  ; physical drive 0 goes forwards
    M569 P1 S1                                  ; physical drive 1 goes forwards
    M569 P2 S1                                  ; physical drive 2 goes forwards
    M569 P3 S0                                  ; physical drive 3 goes forwards
    M584 X0 Y1 Z2 E3                            ; set drive mapping
    M350 X16 Y16 Z16 E16 I1                     ; configure microstepping with interpolation
    M92 X100.00 Y100.00 Z100.00 E100.00         ; set steps per mm
    M566 X1200.00 Y1200.00 Z1200.00 E1200.00    ; set maximum instantaneous speed changes (mm/min)
    M203 X18000.00 Y18000.00 Z18000.00 E1200.00 ; set maximum speeds (mm/min)
    M201 X1000.00 Y1000.00 Z1000.00 E1000.00    ; set accelerations (mm/s^2)
    M906 X1000 Y1000 Z1000 E1000 I30             ; set motor currents (mA) and motor idle factor in per cent
    M84 S30                                     ; Set idle timeout
    ; Axis Limits
    M208 Z-0.1 S1                               ; set minimum Z
    ; Endstops
    M574 X2 Y2 Z2 S1                            ; set active high endstops
    ; Z-Probe
    M558 P4 H5 F120 T6000                       ; set Z probe type to switch and the dive height + speeds
    G31 P500 X0 Y0 Z0                           ; set Z probe trigger value, offset and trigger height
    M557 R85 S20                                ; define mesh grid
    ; Heaters
    M305 P0 T100000 B4138 R4700                 ; set thermistor + ADC parameters for heater 0
    M143 H0 S120                                ; set temperature limit for heater 0 to 120C
    M305 P1 T100000 B4138 R4700                 ; set thermistor + ADC parameters for heater 1
    M143 H1 S350                                ; set temperature limit for heater 1 to 350C
    ; Fans
    M106 P0 C"Hotend Fan" S0 I0 F500 H-1        ; set fan 0 name, value, PWM signal inversion and frequency. Thermostatic control is turned off
    M106 P1 S1 I0 F500 H-1                      ; set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned off
    ; Tools
    M563 P0 S"Hotend" D0 H1 F0                  ; define tool 0
    G10 P0 X2.8 Y-2.2 Z0                        ; set tool 0 axis offsets
    G10 P0 R0 S0                                ; set initial tool 0 active and standby temperatures to 0C
    ; Custom settings are not defined
    ; Miscellaneous
    T0                                          ; select first tool
    M501										; load config-override.g
    M307 H2 A-1 C-1 D-1							; map E1 to LEDs

    Not that it should matter but since i moved the hotend fan from the PWM headers to a constantly on one.

    As to the SD card - I use whatever I got installed and shipped with when i bought the board from E3D in the UK. In this case it's a SanDisk Edge (never heard of the edge lineup before). Happy to swap the card for a brand new SanDisk Ultra if that's what you reckon causes the issue?

  • Moderator

    @vlex Can't see anything wrong in your config.g. Try copying everything off the SD card, then formatting it with the SD formatting tool (see link I posted earlier) and try again, before buying a new SD card.


  • Hmm may be the card was indeed slow - ran a couple of tests with AJA (for the lack of a better tool on this machine) and it dipped below the rated by class 4 4MB/s sequential writes:

    Disk Write Test
      Number of frames = 193
      Write rate       = 1 frames/second
      Write rate       = 5 MB/second
      Minimum rate     = 3 MB/Sec <-- this should not happen
      Maximum rate     = 7 MB/Sec

    Dug in my drawer and found an elecom class4 card that was much faster (avg 14-15MB/s) and moved all files to it, though that didn't end up solving the issue, however, I think I did solve it eventually:

    When I got the board, it had 1 testing network stored and I initially added my IOT guest network's SSID, but later changed my mind and moved the board to my main network. Today I dropped all unnecessary ones with M588 and all of the sudden the board consistently connects to the wifi every single time. May be it's worth looking into the firmware what logic the board uses which ssid to connect to or at least to specify in the setup guide to look out for, but this definitely explains also the multiple blink sets instead of having just the one as it does now.

    In any case I think we can consider the matter resolved. Thanks for the help!

  • Moderator

    @vlex said in Duet2WiFi net connection inconsistent between VIN and USB:

    looking into the firmware what logic the board uses which ssid to connect to

    It connects to the network with the strongest signal.

  • It connects to the network with the strongest signal.

    @Phaedrux that's great to know. That said, in my case it caused issues and if this were documented anywhere it would've helped me solve my issue a lot sooner.

  • Moderator

    @vlex said in Duet2WiFi net connection inconsistent between VIN and USB:

    if this were documented anywhere

    It is.


    P"ssid" (optional, RepRapFirmware 1.20 and later) SSID of network to connect to. The SSID and password must already have been registered using M587. If this parameter is not present, the Duet 2 WiFi will try to connect to the strongest network that is broadcasting its SSID and whose SSID has been registered using M587.

    It's also the default behaviour of all wireless clients to connect to the strongest available network.

Log in to reply