Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP address not given in AP mode; devices unable to connect. #4

Open
stillgar2001 opened this issue Nov 26, 2017 · 7 comments
Open

IP address not given in AP mode; devices unable to connect. #4

stillgar2001 opened this issue Nov 26, 2017 · 7 comments

Comments

@stillgar2001
Copy link

stillgar2001 commented Nov 26, 2017

I am having difficulty getting the sketch to work properly. It is going in a wearable project, so I am setting the boolean to “true” in the AP portion of the top of the code. The sketch compiles and loads properly, as does the sketch data to the SPIFFS. The problem is, the ESP won’t give an IP address to anything that tries to connect with it. I had previously gotten the esp8266-fastled-webserver code to function, thanks to the great documentation given with it, and it was a good learning experience. I was looking to incorporate the MSGEQ7 breakout board for some sound reactive light display. I have tried the code on a Wemos D1 Mini and a NODEMCU board, and get the same symptoms.
The serial monitor shows the following when I try to connect my laptop to the esp AP:

add 1
aid 1
station: 00:24:d7:bb:a4:50 join, AID = 1
err already associed!
station: 00:24:d7:bb:a4:50 leave, AID = 1
rm 1
add 1
aid 1
station: 00:24:d7:bb:a4:50 join, AID = 1
err already associed!
station: 00:24:d7:bb:a4:50 leave, AID = 1
rm 1
add 1
aid 1
station: 00:24:d7:bb:a4:50 join, AID = 1

After much reading on possible causes of this issue, I erased the flash memory in the ESP8266 by using Nodemcu flasher and loading Pratikpanda’s blank 1M file to each of the following memory locations: 0x00000, 0x100000, 0x200000, 0x300000 (the 0x300000 location hung up after a few percent on the bargraph.) I had tried Kentaylor’s github EraseEsp8266Flash Arduino sketch with the Ken Taylor Wifi manager but could not get it to work.
Then I downloaded the esp8266-fastled-audio sketch and sketch data to the Wemos D1 mini again.
Serial monitor shows:

Hostname: ESP8266-665c6
Connect to Wi-Fi access point: ESP8266-65C6
and open http://192.168.4.1 in your browser
HTTP web server started
Web socket server started
add 1
aid 1
station: 00:ee:bd:ae:14:ea join, AID = 1
station: 00:ee:bd:ae:14:ea leave, AID = 1
rm 1
add 1
aid 1
station: 00:ee:bd:ae:14:ea join, AID = 1

and repeats. Symptoms are the same as before; no IP address is given to my HTC One M8 android phone (ae:14) or laptop (a4:50). Phone eventually shows IP Configuration failure, and the laptop shows the webpage at 192.168.4.1 unreachable. I am pretty stumped, and have tried to find the solution, but could use some help please. Please forgive and github or syntax errors, this is my first github issue submission. Thanks.

@jasoncoon
Copy link
Owner

jasoncoon commented Nov 28, 2017

I'm not sure why the ESP8266 would not be assigning IP address to station clients in AP mode. It should automatically start acting as the DHCP server for the network it creates. This is likely a ESP8266 issue that is not directly related to this sketch.

There is a conversation here that might be related: esp8266/Arduino#1956

Questions:

  1. It works correctly in esp8266-fastled-webserver, but not esp8266-fastled-audio?
  2. Are you using the esp8266-fastled-webserver master branch, or v1.1?
  3. Have you tried any other ESP8266 AP mode examples, such as this one? https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino

@stillgar2001
Copy link
Author

Hi again,

  1. It does work correctly in esp8266-fastled-webserver, but not esp8266-fastled-audio.
  2. I am not sure which esp8266-fastled-webserver I am using; I downloaded it off the github about 4 weeks ago. How do I tell whether it is the master branch or v1.1?
  3. The sketch at https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino

works correctly, serial monitor shows:

[Bunch of ascii symbols here______________]
Configuring access point...AP IP address: 192.168.4.1
HTTP server started

and when I connect to ESPap and go to 192.168.4.1, I get

You are connected

on both my phone and laptop.

@08-15at
Copy link

08-15at commented May 20, 2018

Could be that I've found the problem. Had the same random problems not getting IP-address, getting wrong password messages etc.
Seems as if the readAudio function doesn't leave enough time do the DHCP-Server to issue IP-addresses or accept passwords in time. As soon as I put an immediate return in readAudio, everything works perfect.
AFAIR there was a function to call essential WIFI-Routines from time to time, can't find it right, now (could also be outdated, was years ago) and maybe it would even take too long to react to the sound.
As a quick fix, right now I am just waiting for the AP-Setup to be done, before entering loop().
Don't think yield() (which AFAIR does leave time to WIFI-Routines), would be right. Maybe that readAudio should run on 2nd core? But there maybe some more straightforward solutions. My esp8266 knowledge is rather outdated.

@wilson3682
Copy link

wilson3682 commented Oct 21, 2018

I was having the same issue with the ESP8266 not connecting to my AP. As soon as I disabled this part of the code, it started working:

// // Add entropy to random number generator; we use a lot of it.
// random16_add_entropy(analogRead(MSGEQ7_AUDIO_PIN));

I don't know why but it works now.
Thanks!

Update: I moved the code to the setup section and it works!!!

@zombodotcom
Copy link

ohh yeah, i forgot about that thing. I lost all this code a long time ago, because i moved over to the esp32

@momo90-2
Copy link

momo90-2 commented Apr 20, 2019

Using the original code, the esp keeps disconnecting from my wifi router:

no mySSID found, reconnect after 1s
reconnect

The solution from @wilson3682 didnt help for me.

I added a delay(10000) at the start of the void loop, and now the esp stays connected. But thats a really bad solution.
Edit: even with the delay the nodemcu disconnects from time to time for no reason

@08-15at could you post your solution (code)?

@ryancasler
Copy link

ryancasler commented Oct 7, 2019

I'm hoping for this as well. Was unable to stay connected to Wifi. The only way I was able to get it to work was to set the audio delay to 10. Other than that, nothing worked to be able to connect to the board after I loaded everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants