cnlohr / colorchord

Chromatic Sound to Light Conversion System
Other
663 stars 114 forks source link

Cannot connect to wifi router in station mode #24

Open gabikater opened 8 years ago

gabikater commented 8 years ago

Hi to all. is here somebody with similar problem? When I try to set up the ESP module via web-GUI to station mode (I set the SSID, pasword and click the "change parameters" button) the ESP writes on uart:

Switching to: "SSID"/"Pasword" (12/12). BSSID_SET: 0 [1] -->'SSID' -->'Pasword' Switching.

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

after that, my ESP stoned. After that I have done restart. The ESP then writes on uart by endless loop this:

don't use rtc mem data rl� ColorChord Opmode: 1 Station mode: "SSID":"Pasword" (bssid_set:0)

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 32660, room 16 tail 4 chksum 0xa5 load 0x3ffe8000, len 1076, room 4 tail 0 chksum 0xd6 load 0x3ffe8440, len 3272, room 8 tail 0 chksum 0x7d csum 0x7d

Have You any advice?

My HW: ESP-07

cnlohr commented 8 years ago

Bug report is 10/10 Can reproduce, even under newest update. Will tackle tonight.

cnlohr commented 8 years ago

0/10 cannot reproduce. It was resetting for me for a while, then when I tried compiling with an older SDK everything worked. Now I'm back on the 1.5.4 (one that gets pulled with esp-open-sdkk) and it's fine again. Just try these binaries and see if it still crashes.

bins.zip

It's possible I didn't recompile something, now I did.

I highly recommend pulling recursive, a lot of changes have been made to esp82xx, so it should work better.

con-f-use commented 8 years ago

I remember having the same problem at one point in time. It was on one of my dogy modules, so it's quiet possible that the flash might be bad. Or as @cnlohr said, that it was an older revision of esp82xx.

Btw. I cannot be assed to look it um in the code right now. Is there a command to change wifi settings over UDP and/or esptool.py? On second thought, UDP is marginally useful, because chances are, if your ESP is caught in an endless loop, like OPs, you are not going to UDP it - esptool.py it is. Just asking out of curiosity.

cnlohr commented 8 years ago

The settings for wifi control are still within the Espressif settings sector, so if there is a way with esptool, I don't know it. Though -- that is an interesting point. There /should/ be. I don't remember the command and can't really mess with it now, but, via UDP, should be as simple as sending a properly formatted W1 (Station) or W2 (SoftAP) packet to the IP address, port 7878.

i.e. W1\t[SSID]\t[Password]\t[encryption (optional)]\t[mac (optional)]

i.e.

# echo -ne "W1\tTest\t\t\t\n" | nc -u -w 1 192.168.4.1 7878

I might have the tab formatting wrong. There might not be a tab after 'W1'

con-f-use commented 8 years ago

Espressif seems to store these settings at the end of falsh. So one need's to know the flash size. For my 4 Mbyte it seems to start at 0x37d005. Will maybe find out more, if I really care to.

mabushey commented 8 years ago

I had colorchord running on a D1 mini. I tried changing the setting with my cell but none took - probably a web-sockets compatibility issue. I then used Chromium on a laptop to set it to my SSID and pass and that was the end...

I had to erase the flash with esptool.py before I could get it working again:

esptool.py erase_flash
make clean
make all
make burn
make webburn

It looks like this stuff is in commonservices.c, but I'm not sure how to hardcode my SSID and pass into it.

BTW Colorchord is amazing, thank you! I'm looking forward to getting this running.

con-f-use commented 8 years ago

Did you use the scan button in the wifi settings and then select your network from the returned list? Also I think charles changed the automatic switch to AP-mode to a button triggered change in the newer versions.

cnlohr commented 8 years ago

Yep. You can press-and-hold and it resets the ap settings... Though I am probably going to change the behavior so it only does that until power down.

mabushey commented 8 years ago

In Chromium, when I press the scan button after maybe 5 seconds a table of SSID's pops up that lasts maybe a quarter of a second - it was so quick I had to do this 5 times just to verify the table actually contained SSID's. The table vanishes and says "No APs found. Did you scan?"

Using Chrome on my cell nothing happens in the browser. The serial console does spit out a list of SSID's however: .........................................................404(favicon.ico) ...WS1 .ISCAN DIRECT-IA-VIZIOTV WIFIE582A5 DIRECT-67-BRAVIA ... coffee ... SoftAP mode: "ESP_06AB3A":"" @ 1 10/1 IGMP Joining: 0104a8c0 fb0000e0 ........................................................................................

mabushey commented 8 years ago

You can press-and-hold and it resets the ap settings...

The reset switch on the ESP8266?

mabushey commented 8 years ago

Here's what happens in the Serial console. The first time the browser changed coffee to Coffee so it didn't connect:

Switching to: "Coffee"/"WPApass" (6/12). BSSID_SET: 0 [1]
-->'Coffee'
-->'WPApass'
Switching.
....Connection failed: 3
IGMP Joining: 0104a8c0 fb0000e0
.......................Switching to: "coffee"/"WPApass" (6/12). BSSID_SET: 0 [1]
-->'coffee'
-->'WPApass'
Switching.
..
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 32492, room 16 
tail 12
chksum 0x05
ho 0 tail 12 room 4
load 0x3ffe8000, len 900, room 12 
tail 8
chksum 0x3c
load 0x3ffe8390, len 3648, room 0 
tail 0
chksum 0xbd
csum 0xbd
��{�l�l��d`��{�l�l�d`��{�lǟ
Opmode: 1
Station mode: "coffee":"WPApass" (bssid_set:0)
..
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 32492, room 16 

It's back to the reboot loop.

cnlohr commented 8 years ago

So, I still don't know what causes this and it seems to be very hard to nail down. I tried re-flashing both the main and web page and it made it go away in my cases, do you mind trying that?

If that doesn't work, can you try adding a system_restore(); call in user_main(), build, burn, remove it, build, burn, then see if it still works.

All of my ESPs are now in a state where this doesn't happen. I would really appreciate it if you could take notes as to what specifically fixes it.

cnlohr commented 7 years ago

@proz0r did you ever get it figured out?

ghost commented 7 years ago

Unfortunately, no. I had other problems too - parts of the web UI would be blank. The bar graph would show at one point and after reflashing it'd be blank, and the LED output just wouldn't work (blank UI pane and no output to the strip itself). Only the scope worked consistently. However, I was using a nodeMCU clone (Lolin board, ESP-12E onboard) so I'm thinking that might've somehow caused a malfunction. Maybe the module is bad too, who knows, either way I've given up on that particular setup.

I've ordered a couple of ESP-01 modules since and I'm waiting for them to arrive. Should be any day now. I'll give those a shot and report back.

cnlohr commented 7 years ago

That really sounds weird. I don't recommend the old ESP-01's because their flash is too small. Def try other hardwares. I know I've run into 2 or three bad boards.

gabikater commented 7 years ago

Hello all. A Long time ago I fix this mallfunction in such a hard-way. I cutted off whole bunch of sources in the makefile and recompile the project with the verry simple program where was only some debug prints to console and where I have setting of wireless mode in function "void user_init(void)": //"wifi_set_opmode( 1 )" //this set device to AP or Station mode--> AP-2, Station mode-1 const char ssid[32] = "Router_SSID"; const char password[32] = "Router_Pasword"; struct station_config stationConf; wifi_set_opmode( 1 ); os_memcpy(&stationConf.ssid, ssid, 32); os_memcpy(&stationConf.password, password, 32); wifi_station_set_config(&stationConf); wifi_station_connect();
//..... Than I started to adding all other sources which I want to have there. It is still in progress because I have another things to do now (priority has changed) but I think I will figure it out in this way...(1.adding source code, 2.compilling, 3.flashing, 4.trying function, jump to 1.) I think there is some complex problem {maybe also HW (not good piece of ESP) and SW problem together}

cnlohr commented 7 years ago

I wish this would happen to me again. It only ever happened once, and I still don't know what I did to fix it. I suppose we could try to do something like this with the press-and-hold-gpio-0-after-boot thing now in esp82xx