1.19beta7 and WiFi connect



  • while trying beta7 i encountered a problem during WiFi authentication.
    i'm using "@" within my WPA-PSK. while using 1.18.2 this was possible, it isn't with beta7.
    i read in some other thread that there are some possible issues with some characters.
    will there be a fix, or should i think about changed my infrastructure?

    BR


  • administrators

    I am surprised that 1.18 allowed password characters that 1.19 doesn't, I expected it to be the other way around. Are you sure it is the '@' character that is causing the problem?



  • hmmm… You're right. Tried the connection in several constellations. Result is that beta7/8 is able to use "@" because i was able to connect to the same SSID/WPA hosted by a different AP.

    But within my trials i wasn't able to connect to my primary AP at all. Tried several reboots of the AP, different SSIDs/WPA combos without any success. I read that some users got issues with an AVM Fritzbox which i'm using too, but i don't know if it is related to that or if it is something ESP special.

    When i remember correctly there was an ESP8266 WiFi issue where it didn't forget the config although the SDK command was used (the storage sector has to be deleted manually with flashEraseSector(0x3fe)). What i want to try is to completly reset the ESP and try to connect to an (at this point) unknown/new SSID.

    BTW After downgrading to 1.18.2 WiFi connection to the same SSID/WPA works instantaneous without any problems! From my point of view it has something to do with a different way of interpretation of some stored parameters.

    @dc42: is the ESP configured for non persistent SSID/WPA usage, so they aren't stored on ESP itself but only on SAM?
    is there a possibility to reset/clear the ESP WiFi config (see above) via RRF? or only via direct ESP_COMMS?


  • administrators

    One potential problem I have just realised concerns accented characters (although they didn't generally work on the older firmware anyway). On the older firmware, when you enter your SSID and password, accented characters will be sent over the web in UTF8 encoding. With the newer firmware, the encoding will depend on settings of the text editor that you use to create the macro file containing the M587 command.

    To make matters worse, there are two different ways of representing most accented characters: either as a single combined character, or as a plain character followed by a combining accent.

    Regarding the way we use the ESP8266, we always send it the SSID and password we want to connect to before we ask it to connect. The AP list is stored in flash on the ESP8266, but this is not the same flash area used by the SDK. However, I can see a few options that we can change to prevent the SDK functions storing connection details in its own flash area, and I will activate those in the next build. Also, when a connection fails I'll try to pass back the reason for the failure, e.g. authentication failed.



  • @dc42:

    1. after fiddling around a little bit more i think that the reason isn't located within the SSID/WPA-PSK combo. why? see below
    2. i think it has something to do with the "mode change" of the ESPs WiFi, as i get an connection to my WiFi once in a time after several calls of M552 S-1/0/1/2 (switching between AP, Client mode, Off)
    3. is it possible that the P parameter of the M552 is mandatory at the moment (use 0.0.0.0 if using DHCP) and didn't have an fallback value if none is defined?
    [[language]]
    Connecting...
    Printer is now online.
    >>> M122
    SENDING:M122
    === Diagnostics ===
    Used output buffers: 1 of 32 (1 max)
    === Platform ===
    RepRapFirmware for Duet WiFi version 1.19beta8 running on Duet WiFi 1.0
    Board ID: xxx
    Static ram used: 20900
    Dynamic ram used: 96284
    Recycled dynamic ram: 1600
    Stack ram used: 3960 current, 4864 maximum
    Never used ram: 7424
    Last reset 00:00:15 ago, cause: reset button or watchdog
    Last software reset reason: User, spinning module GCodes, available RAM 7568 bytes (slot 4)
    Software reset code 0x0003, HFSR 0x00000000, CFSR 0x00000000, ICSR 0x00400000, BFAR 0xe000ed38, SP 0xffffffff
    Error status: 0
    [ERROR] Error status: 0
    
    Free file entries: 10
    SD card 0 detected, interface speed: 20.0MBytes/sec
    SD card longest block write time: 0.0ms
    MCU temperature: min -207.9, current 48.9, max 49.1
    Supply voltage: min 23.9, current 24.0, max 24.2, under voltage events: 0, over voltage events: 0
    Driver 0: stalled standstill
    Driver 1: stalled standstill
    Driver 2: stalled standstill
    Driver 3: standstill
    Driver 4: standstill
    Date/time: 1970-01-01 00:00:00
    Slowest main loop (seconds): 0.001749; fastest: 0.000031
    === Move ===
    MaxReps: 0, StepErrors: 0, MaxWait: 0ms, Underruns: 0, 0
    Scheduled moves: 0, completed moves: 0
    Bed compensation in use: none
    Bed probe heights: 0.000 0.000 0.000 0.000 0.000
    Probe change coordinates:
    === Heat ===
    Bed heater = 0, chamber heater = -1
    === 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 idle in state(s) 0
    serial is ready with "M122" 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
    Code queue is empty.
    Network state is changing mode
    WiFi module is trying to connect
    WiFi firmware version 1.19beta7
    WiFi MAC address aa:bb:cc:dd:ee:ff
    WiFi Vcc 3.10, reset reason Turned on by main processor
    WiFi flash size 4194304, free heap 40728
    HTTP sessions: 0 of 8
    Socket states:  0 0 0 0 0 0 0 0
    Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0)
    >>> M587
    SENDING:M587
    Remembered networks:
    xxxx yyyy z.z
    WiFi reported error: failed to connect to access point
    Wifi module is idle
    >>> M552
    SENDING:M552
    WiFi module is idle
    >>> M552 S-1
    SENDING:M552 S-1
    WiFi module stopped
    >>> M552 S2
    SENDING:M552 S2
    WiFi module started
    WiFi reported error: Failed to start access point
    Wifi module is idle
    >>> M552 P0.0.0.0 S1
    SENDING:M552 P0.0.0.0 S1
    Wifi module is connected to access point xxxx yyyy z.z, IP address 192.168.0.247
    
    -----
    
    Network state is running
    WiFi module is connected to access point
    WiFi firmware version 1.19beta7
    WiFi MAC address aa:bb:cc:dd:ee:ff
    WiFi Vcc 3.10, reset reason Turned on by main processor
    WiFi flash size 4194304, free heap 39736
    WiFi IP address 192.168.0.247
    WiFi signal strength -66db
    HTTP sessions: 1 of 8
    
    

  • administrators

    I've just released DuetWiFiServer 1.18beta8. Please try it in case it helps. It disables persistence and auto-connect at startup. At the very least, it should provide a more detailed error message (to PanelDue and USB) if it fails to connect when you send M552 S1.

    The P parameter of M552 isn't used on the Duet WiFi.



  • just uploaded WiFiServer beta8 and everything works as expected.
    only get an error once while trying connect/disconnect/change mode now for 30+ times.
    the error was:

    [[language]]
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    
    

    unfortunately i hurried to much, and i resettet the Duet, so i can't say if the above error is "self-healing" or not (retry after a timeout or something like this).
    but it didn't occur a second time

    @dc42: thx!



  • upps… did it again...
    after some hours online a reboot was needed, and afterwards no WiFi connection was establised.

    [[language]]
    >>> M552
    SENDING:M552
    WiFi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    
    

    And no, it isn't an error of me that the "currentSsid" which should come after "… connect to ..." is missing.
    So i think the config couldn't be read although M587 did list the known SSIDs

    [[language]]
    >>> M587
    SENDING:M587
    Remembered networks:
    xxxx yyyy z.z
    
    

  • administrators

    Thanks, that gives me something to go on. If you try sending M552 S1 a few more times, does it connect eventually? If not, try M552 S-1 followed by M552 S1.



  • nope… this time no changes...

    [[language]]
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S-1
    SENDING:M552 S-1
    WiFi module stopped
    >>> M552 S1
    SENDING:M552 S1
    WiFi module started
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S1
    SENDING:M552 S1
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    >>> M552 S-1
    SENDING:M552 S-1
    WiFi module stopped
    >>> M552 S1
    SENDING:M552 S1
    WiFi module started
    WiFi reported error: Unexpected WiFi state 'idle' while trying to connect to
    Wifi module is idle
    
    

    15-30 seconds between each try.



  • ok tested a little bit more… there seems to be a bug with EEPROM put/get.

    szenario: all known SSIDs are deleted with M588 S"" and all AP configurations are deleted also with M589 S"".

    [[language]]
    M588 S"*"
    ok
    M589 S"*"
    ok
    M587
    No remembered networks
    ok
    
    

    after that i established an AP config which is listed correctly with M587

    [[language]]
    M589 S"duet" P"duet" I192.168.1.1
    ok
    M587
    Remembered networks:
    duet
    ok
    
    

    when i try to start AP mode -> error, but AP config seems to be still stored

    [[language]]
    M552 S2
    ok
    WiFi reported error: Failed to start access point
    Wifi module is idle
    M587
    Remembered networks:
    duet
    ok
    
    

    add an client config and list again known configs the AP config is gone

    [[language]]
    M587 S"test" P"test"
    ok
    M587
    Remembered networks:
    test
    
    

  • administrators

    M587 should not list the AP name as a remembered network if you are using beta 8 of DuetWiFiFirmware. Please check which version you are running. Tomorrow I'll check for coding errors in that area.



  • WifiServer beta8 and RRF beta8. see below:

    [[language]]
    M122
    === Diagnostics ===
    Used output buffers: 1 of 32 (1 max)
    === Platform ===
    RepRapFirmware for Duet WiFi version 1.19beta8 running on Duet WiFi 1.0
    Board ID: xxxx
    Static ram used: 20900
    Dynamic ram used: 96084
    Recycled dynamic ram: 1800
    Stack ram used: 3960 current, 4784 maximum
    Never used ram: 7504
    Last reset 00:00:47 ago, cause: power up
    Last software reset reason: User, spinning module GCodes, available RAM 7180 bytes (slot 2)
    Software reset code 0x0003, HFSR 0x00000000, CFSR 0x00000000, ICSR 0x00400000, BFAR 0xe000ed38, SP 0xffffffff
    Error status: 0
    Free file entries: 10
    SD card 0 detected, interface speed: 20.0MBytes/sec
    SD card longest block write time: 0.0ms
    MCU temperature: min -210.4, current 41.4, max 41.5
    Supply voltage: min 0.1, current 0.5, max 0.8, under voltage events: 0, over voltage events: 0
    Driver 0: ok
    Driver 1: ok
    Driver 2: ok
    Driver 3: ok
    Driver 4: ok
    Date/time: 1970-01-01 00:00:00
    Slowest main loop (seconds): 0.001695; fastest: 0.000027
    === Move ===
    MaxReps: 0, StepErrors: 0, MaxWait: 0ms, Underruns: 0, 0
    Scheduled moves: 0, completed moves: 0
    Bed compensation in use: none
    Bed probe heights: 0.000 0.000 0.000 0.000 0.000
    Probe change coordinates:
    === Heat ===
    Bed heater = 0, chamber heater = -1
    === 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 idle in state(s) 0
    serial is ready with "M122" 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
    Code queue is empty.
    Network state is running
    WiFi module is idle
    WiFi firmware version 1.19beta8
    WiFi MAC address aa:bb:cc:dd:ee:ff
    WiFi Vcc 3.10, reset reason Turned on by main processor
    WiFi flash size 4194304, free heap 41104
    HTTP sessions: 0 of 8
    Socket states:  0 0 0 0 0 0 0 0
    Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0)
    ok
    
    

  • administrators

    OK, I found the bug, it's purely a reporting issue. If you have no remembered networks but you have specified an access point name, then when you list remembered networks it prints the access point name. After you have added a remembered network, you can still retrieve the own access point name by sending M589. The fix will be in the next beta.

    I still haven't worked out why it's trying to connect to an empty SSID. I'll look at that later today.



  • @dc42: as per definition the passphrase within the AP mode hast to be at least 8 chars long, i think it would be reasonable to check for valid M589 input (i think ssid min 0 max 32 chars and passphrase min 8-64 chars).
    try:

    [[language]]
    M552 S0
    ok
    WiFi module started
    
    M589 S"test" P"test" I192.168.1.1
    ok
    M552 S2
    ok
    WiFi module started
    WiFi reported error: Failed to start access point
    Wifi module is idle
    
    M589 S"test" P"testtest" I192.168.1.1
    ok
    M552 S2
    ok
    Wifi module is providing access point test, IP address 192.168.1.1
    
    

  • administrators

    Thanks for the suggestion, I'll implement it in the next beta.

    I can't reproduce the problem with failing to connect and not displaying the SSID name, but I've built a new DuetWiFiServer.bin with some changes that may help and put it at https://dl.dropboxusercontent.com/u/19369680/DuetWiFiServer.bin. Please try it.



  • will give it a try. will give feedback tomorrow.
    is there the possibility to erase the ESP (incl. flash) completly from SAM/RRF? or only via ISP?



  • @dc: i think i found the reason, why an empty config was read…

    SocketServer.cpp - row 64

    [[language]]
    for (size_t i = 1; i <= MaxRememberedNetworks; ++i)
    
    

    shouldn't it be```
    [[language]]
    for (size_t i = 0; i <= MaxRememberedNetworks; ++i)

    same in row 83
    
    or better (i think) not to waste one slot at the beginning (row 64, 83, 112, 521,…)
    

    [[language]]
    for (size_t i = 0; i < MaxRememberedNetworks; i++)


  • administrators

    The first entry is the configuration for the WiFi module as an access point. So the count starts from 1 when it is searching for a remembered SSID.



  • hmmm… once again:

    [[language]]
    for (int8_t i = 0; i < num_ssids; ++i)
    {
    	if ((strongestNetwork < 0 || WiFi.RSSI(i) > WiFi.RSSI(strongestNetwork)) && RetrieveSsidData(WiFi.SSID(i).c_str(), ssidData))
    	{
    		strongestNetwork = i;
    	}
    }
    
    

    WiFi.RSSI's and WiFi.SSID's parameters are a zero based index from prior discovered SSIDs by blocking WiFi.scanNetworks(false, true)
    At this point we are looking at the wrong index. aren't we? ++i -> i++


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.