PuceBaboon / ESP-Now-Gateway

ESP8266 with W5500 ethernet running as a gateway for ESP-Now nodes. Node demo code included.
MIT License
69 stars 18 forks source link

Boot loop with DHCP #1

Closed 1rabbit closed 6 years ago

1rabbit commented 6 years ago

I'm trying to replicate your circuit on

https://esp8266hints.wordpress.com/2018/02/13/adding-an-ethernet-port-to-your-esp-revisited/

But it seems to continuously fail.

I have tried everything i could think about. I followed your instructions, copied the Ethernet folder and everything. Here's a picture of my circuit :

yd5fbmu

error logs : http://dpaste.com/1Y0D4D8 http://dpaste.com/1FDZ308

PuceBaboon commented 6 years ago

Hi 1rabbit,

Sorry to hear you're having problems. I suspect that the watchdog reset may be because the ESP is starting up with previously cached values for an access point. Try using esptool.py to completely erase flash (esptool.py erase_flash --port /dev/ttyUSB0 --baud 115200) and then reload the gateway code and try it again.

It's a little difficult to tell from your photo, but you might also want to check the resistor lead isn't touching the RF shielding on the ESP. What transistor are you using, by the way?

Do the lights on the W5500 flash? Does it look as though it's actually getting a reset pulse?

                               -John-

On 3 March 2018 at 10:59, 1rabbit notifications@github.com wrote:

I'm trying to replicate your circuit on

https://esp8266hints.wordpress.com/2018/02/13/adding-an-ethernet-port-to- your-esp-revisited/

But it seems to continuously fail.

I have tried everything i could think about. I followed your instructions, copied the Ethernet folder and everything. Here's a picture of my circuit :

[image: yd5fbmu] https://user-images.githubusercontent.com/35274849/36929246-61843fda-1e8e-11e8-88f9-17486b65aaae.jpg

error logs : http://dpaste.com/1Y0D4D8 http://dpaste.com/1FDZ308

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PuceBaboon/ESP-Now-Gateway/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AKLtWfFmJu8Nn3ur66xF3gmdtneristBks5tafjsgaJpZM4SaunI .

1rabbit commented 6 years ago

Hi John, i appreciate the fast answer,

I tried to wipe the flash Chip erase completed successfully in 11.0s

Then i tried another esp board, and rewired it with a new w5500.

The PNP is a 2N3906, here is pictures of the new wiring with brand new components : https://imgur.com/a/MSZ8u

https://imgur.com/a/USfhj a quick video of the flashing pattern.

I tried to make it as readable as possible. The wiring appears to be good but i may be missing a detail.

Error log : http://dpaste.com/3VT7V9A ; doesn't seem to be different

(I'm using the arduino IDE 1.8.5 from arduino.cc)

PuceBaboon commented 6 years ago

Strange! Everything looks as though it should be okay. The W5500 is obviously going into reset, so it doesn't seem to be the old GPIO4/5 swap problem. One thing that I do notice is that the regulator on the D1-mini has a lower current rating (500ma) than the NodeMCU (800ma). Check whether the D1-mini will run with no power to the W5500 and, if it does, try slapping something like a 470uf on the 3v3 rail to try to provide the current peak as the W5500 initializes. If that doesn't help, then you may want to try supplying 5v power directly to the 5v pin on the W5500 and let the on-board 3v3 regulator handle the load.

On the software side, I'm assuming that you're building with the processor type set to "d1_mini"?

       -John-

On 4 March 2018 at 04:57, 1rabbit notifications@github.com wrote:

I tried to wipe the flash Chip erase completed successfully in 11.0s

Then i tried another esp board, and rewired it with a new w5500.

The PNP is a 2N3906, here is pictures of the new wiring with brand new components : https://imgur.com/a/MSZ8u

https://imgur.com/a/USfhj a quick video of the flashing pattern.

I tried to make it as readable as possible. The wiring appears to be good but i may be missing a detail.

Error log : http://dpaste.com/3VT7V9A ; doesn't seem to be different

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PuceBaboon/ESP-Now-Gateway/issues/1#issuecomment-370175261, or mute the thread https://github.com/notifications/unsubscribe-auth/AKLtWVT9RWXFiGKVyHyVsXcbViQ1kf9Hks5tavWygaJpZM4SaunI .

1rabbit commented 6 years ago

Yes it is strange Added 470µF + 0.15µF ceramic, then tried 3V3 and 5V for Vcc to the w5500 without success however if i unplug vcc to the w5500 the esp stops rebooting continuously, even if i plug it back it wont reboot loop until i reboot it.

No restarts without vcc to the w5500

This node AP mac: 62:01:94:1E:E6:76 This node STA mac: A0:20:A6:2F:68:D5 Starting Wiz W5500 Ethernet... Ethernet IP is: 255.255.255.255 Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds... Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds... Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds... Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds...

I also tried with different power sources, like a big power bank, no difference. Boards settings seem good.

PuceBaboon commented 6 years ago

Thanks for trying those.

The only thing I can think of at this point is to try inserting "yield();" calls between the delays in the WizReset() function, but to be honest that's just a shot in the dark.

          -John-

On 4 March 2018 at 08:21, 1rabbit notifications@github.com wrote:

Added 470µF + 0.15µF ceramic, then tried 3V3 and 5V for Vcc to the w5500 without success however if i unplug vcc to the w5500 the esp stops rebooting continuously, even if i plug it back it wont reboot loop until i reboot it.

No, restarts without vcc to the w5500

This node AP mac: 62:01:94:1E:E6:76 This node STA mac: A0:20:A6:2F:68:D5 Starting Wiz W5500 Ethernet... Ethernet IP is: 255.255.255.255 Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds... Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds... Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds... Attempting MQTT connection...failed, rc=-2 . Trying again in 5 seconds...

I also tried with different power sources, like a big power bank, no difference.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PuceBaboon/ESP-Now-Gateway/issues/1#issuecomment-370187851, or mute the thread https://github.com/notifications/unsubscribe-auth/AKLtWVAy2XzhnNjnmObvFMJ4R6sGfppKks5tayVsgaJpZM4SaunI .

1rabbit commented 6 years ago

No luck, maybe i should try another ide

PuceBaboon commented 6 years ago

Did you see the MAX_SOCK_NUM warning message during the compile? It's a nuisance, but it's also a pretty good indicator that the compiler is including the Wiznet library files.

Give it a try under PlatformIO. It's pretty easy to install.

       -John-

On 4 March 2018 at 11:11, 1rabbit notifications@github.com wrote:

No luck, maybe i should try another ide

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PuceBaboon/ESP-Now-Gateway/issues/1#issuecomment-370195878, or mute the thread https://github.com/notifications/unsubscribe-auth/AKLtWcLPTvPIDIQk2PyFZXkD7wmwf5IHks5ta004gaJpZM4SaunI .

1rabbit commented 6 years ago

Alright, i switched to platformio (not going back to arduino ide) and i found the issue. It wasn't ide related.

Ethernet.begin(eth_MAC, eth_IP, eth_DNS, eth_GW, eth_MASK); Works fine

I initially tried with the code that enables DHCP. It was the issue :

Ethernet.begin(eth_MAC); Causes reboot loop

No issues on your side with this setting ? In the meantime i can use the fixed IP setting, it seems to be working fine. Well... it doesn't boot loop !

PuceBaboon commented 6 years ago

Well done!

I didn't have issues with the DHCP setting the first time I tried it (but I have to admit that was quite a while back in the development process). My DHCP server is set up to hand out a fairly comprehensive set-up to the clients, whether they ask for it all or not. Is there any indication (from your DHCP server logs) what was wrong?

Anyway, if I get some time later on, I'll change my config and try DHCP again.

Many thanks for persevering with this; I'm glad you got a positive result.

                             -John-

On 5 March 2018 at 10:59, 1rabbit notifications@github.com wrote:

Alright, i switched to platformio (not going back to arduino ide) and i found the issue. It wasn't ide related.

Ethernet.begin(eth_MAC, eth_IP, eth_DNS, eth_GW, eth_MASK); Works fine

I initially tried with the code that enables DHCP. It was the issue

Ethernet.begin(eth_MAC); Causes reboot loop

No issues on your side with this setting ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PuceBaboon/ESP-Now-Gateway/issues/1#issuecomment-370288910, or mute the thread https://github.com/notifications/unsubscribe-auth/AKLtWWNlPqbBnX6Q6mLAFmM8ihotRaBxks5tbJwXgaJpZM4SaunI .

1rabbit commented 6 years ago

Thanks ! I wanted to build a gateway using an esp8266 + w5500 modules for quite a while now so when i found your project i was down to get it working no matter what 👍 Its for soil moisture sensors now, and more later

I couldn't seem to get the esp-now function working till i reviewed the code in the demo_controller

esp_now_send(mac, bs, sizeof(sensorData)); replaced with : esp_now_send(wifi_mac, bs, sizeof(sensorData));

PuceBaboon commented 6 years ago

My -very- bad! In two places. :-(
8 lines above the esp_now_send() call there's another call to esp_now_add_peer() where it also needs to be changed.

Already fixed here.

Note to self:- Don't make cosmetic changes when sanitizing code for GitHub export.

Thanks again, 1rabbit!