mp-se / gravitymon

iSpindle replacement firmware for beer brewing/fermenting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WiFi connects once after channel change.

lvu opened this issue · comments

Describe the bug
On the D1 mini board I got, Gravitymon doesn't connect to WiFi unless I change the AP's channel. After I do, it connects once, and then, after turning off and on, stops connecting again, until the next channel change.

To Reproduce
Steps to reproduce the behavior:

  1. Flash Gravitymin v 1.3.0 to a D1 mini with BrewFlasher
  2. Set up the AP name and password
  3. Try connecting, while watching the logs on the COM port; the results look like this:
    scandone 
    state: 0 -> 2 (b0)
    .state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 31
    cnt
    connected with LVU, channel 8
    dhcp client start...
    .........................................................................................pm open,type:2 0
    ........................................     22295 E: WIFI: Failed to connect to wifi 7
    22427 W: WIFI: Failed to connect to first SSID LVU.
    22428 W: WIFI: Failed to connect to any SSID.
    22464 I: Main: Setup completed.
    Fatal exception 28(LoadProhibitedCause):
     epc1=0x40215aaf, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000058, depc=0x00000000
    --------------- CUT HERE FOR EXCEPTION DECODER ---------------
    Exception (28):
    epc1=0x40215aaf epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000058 depc=0x00000000
    
    >>>stack>>>
    ctx: cont
    sp: 3fff1c40 end: 3fff1e40 offset: 0190
    3fff1dd0:  3fff0948 3fff09dc 3fff09ec 3fff1e84
    3fff1de0:  3fffdad0 3fff0a3c 3fff09a4 40221470
    3fff1df0:  3fffdad0 3fff0948 3fff09a4 4021fc50
    3fff1e00:  c0000000 40137d85 feefeffe 40215c25
    3fff1e10:  feefeffe feefeffe 00000001 4020c757
    3fff1e20:  3fffdad0 00000000 3fff1e70 4022d0f8
    3fff1e30:  feefeffe feefeffe 3ffe8648 40100399
    <<<stack<<<
     --------------- CUT HERE FOR EXCEPTION DECODER ---------------
    
     ets Jan  8 2013,rst cause:2, boot mode:(3,6)
    
    load 0x4010f000, len 3460, room 16
    tail 4
    chksum 0xcc
    load 0x3fff20b8, len 40, room 4
    tail 4
    chksum 0xc9
    csum 0xc9
    v000b6590
    ~ld
    
  4. Change the APs channel.
  5. The connection gets established, until next time.

Expected behavior
Wifi connection gets established every time after powering the device on

Software:

  • Platform: esp8266
  • Version 1.3.0

Error 7 is probably due to incompatibility with your wifi network. Check the troubleshooting section for the needed preconditions for an esp8266.

All conditions are met. But the router is dual-band, with the same AP name for 2.4 and for 5 GHz – could that be the issue?

I have dual-band enabled on my UniFi router and that works fine with the esp8266 that I use. Might be some other setting that causes the issue.

The problem occurs in the underlying Arduino for ESP8266 library (or the hardware itself). You can check if the open issues might provide some clarity on what could be wrong. https://github.com/esp8266/Arduino

You could try some other project to see if that works? Does it work with the iSpindel firmware? Which version have you tried that worked? Could help to narrow down what the issue is....

This could be relavant; esp8266/Arduino#8956 or this one esp8266/Arduino#8950.

There are quite a few bug reports related to wifi.

I've tried the original iSpindel firmware, and it has the same issue. Actually, no version worked well. I've checked those threads, and the only suggestion there I saw was to disable the 802.11n mode on the router. I've tried to, and it worked... but only for the first time. Same picture: I change the setting (seems it doesn't have to be the channel), turn the device on, and it connects successfully. I turn in off and back on – and it doesn't connect, until I change some WiFi setting on the router again.

Could be related to the first issue i linked, band steering. If the router wants the device to reconnect that could cause the problem. What router model do you have?

I've tried with my main one, TUF-AX3000, and with a separate AP, RP-AC52 in AP mode. Turned 802.11n off on both devices; on the RP-AC52 AP names for 2.4GHz and for 5GHz were different.

I have some other observations, but I need to systemise them.

Its not an issue that i can handle unfortunately. It lies in the esp/arduino combination. You could try with the newer esp32 variants as they should have better compatibility. I support esp32c3 and esp32s2 mini currently and they have the same form factor as the esp8266

I've tried with ESP32 lite (the Floaty HW). Tried versions 1.3.0 and 1.2.0 of GravityMon, and with each one I get the same result: after saving the config and rebooting, the device seemingly doesn't try to connect to the WiFi at all. Probably I should file a separate issue? Here are the logs:

217034 I: WM  : Webserver, handle WiFi save.
217035 I: WM  : Parameter and value
217044 I: WM  : Sent wifi save page
217551 I: WM  : Connecting to new AP.
217807 I: WM  : Connect to new WiFi using new IP parameters
223048 I: WM  : Connected after waiting 5.20 s
223049 I: WM  : Local ip = 192.168.0.145
223049 I: WM  : Connection result: WL_CONNECTED
223059 I: WIFI: Stored SSID1:'LVU' SSID2:''
223128 I: CFG : Configuration saved to /gravitymon.json.
223130 I: WIFI: Exited wifi config portal. Rebooting...
[223635][W][WiFiGeneric.cpp:955] _eventCallback(): Reason: 8 - ASSOC_LEAVE
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10044
load:0x40080400,len:5872
entry 0x400806ac
Serial connection established
4 I: SDBG: Serial logging started at 115200.
E (629) esp_core_dump_flash:▒  ▒ɕ▒dump partition found!
E (629) esp_core_dump_flash: No core dump partition found!
38 I: Main: Started setup for 3c120c.
39 I: Build options: 1.3.0 (..b68835) LOGLEVEL 4 FLOATY
40 I: HELP: Chip=ESP32, Rev=3, Feat=0x0032
56 I: CFG : Filesystem mounted.
72 I: WIFI: Current reset counter 0.
92 I: HELP: Last reset cause 'software reset CPU' (12)
113 I: CFG : Size of configuration file=944 bytes.
137 I: CFG : Configuration file /gravitymon.json loaded.
[   141][E][vfs_api.cpp:105] open(): /littlefs/hardware.json does not exist, no permits for creation
142 W: CFG : Configuration file does not exist /hardware.json.
204 E: GYRO: No valid calibration values, please calibrate the device.

Can you try the 1.4beta its built using newer arduino versions

The wifi connection attempt should occur after the log that you posted... i.e. after the config file has been loaded

My bad. It was a hardware issue, the gyro was probably burnt.