Page 1 of 1

APSTA Mode - STA connected but not accessible after random period of time

Posted: Fri May 01, 2020 9:31 am
by teckhaokoh
Hi, I'm running a webserver in esp32 using APSTA mode.
As stated in the subject, after it's running for certain period of time, i found that it's not accessible through the STA, but I've checked the connection, it's still connected to my router, and my router still able to see the IP address.
I couldn't ping or access to my esp32 through STA (using PC), but it's fully operate if I'm connecting directly to the esp32's AP.

Below are summary of my problem:
WIFI mode : APSTA
Connection : Both AP and STA connected
ESP32 crash or reboot:
I'm sure that the esp32 never crash and reboot, as I got a timer counting the uptime, which I'm still able to see it through AP.

Access to web server:
AP fully accessible and operate as normal
STA not accessible, can't even ping

How to get it working again:
1. reboot my router
2. reboot my esp32

Anyone has similar experience?

Re: APSTA Mode - STA connected but not accessible after random period of time

Posted: Thu May 14, 2020 3:02 am
by teckhaokoh
Anyone know the meaning of each items and numbers in the wifi debug message below?


I (467626043) wifi: n:1 0, o:1 1, ap:1 1, sta:1 0, prof:1

Re: APSTA Mode - STA connected but not accessible after random period of time

Posted: Thu May 14, 2020 3:25 am
by WiFive
Does it seem like the dhcp lease expires when it loses connection?

Re: APSTA Mode - STA connected but not accessible after random period of time

Posted: Fri May 22, 2020 2:39 am
by teckhaokoh
I spent quite some time to troubleshoot, I think it's the ARP table issue.
I found that after I switching the WIFI connections of my PC (my esp32 and PC connected to router by default) to esp32's AP, then back to router, the ARP table in my PC do not have the record of my esp.
If I add in the ARP entries manually, then the connection is resumed.

I've updated to the ESP-IDF 4.2 (previously 2.1), i think the gratuitous ARP solve the issue.
I still see the same issue today, but after a while (I think it's because the gratuitous ARP interval of 60s), I'm able to connect again.

Re: APSTA Mode - STA connected but not accessible after random period of time

Posted: Wed Jun 17, 2020 6:43 pm
by awander
I encountered similar problem too !
* I startup a TCP Socket Server at ESP32
* When I try to connect to the ESP32 from PC(Windows), it may cost more than 30s to establish the connection !
* If I ping the ESP32 continuously with a command "ping 192.168.0.xxx -t" on PC(Windows), then the connection can be established very quickly in few seconds !

While checking ARP table of the Windows ("arp -a"), I can find a dynamic ARP record of the ESP32.
If I stop the ping command and wait about 50 seconds, I can still see the ARP record of the ESP32.
STRANGE: But when I try to connect to the ESP32 again, I find that: the ARP record of the ESP32 is disappeared quickly !!! And the connection is blocked for long time to establish !!!

I have no idea how to resolve this problem now, can anybody give me some advises ?
Thanks !

Re: APSTA Mode - STA connected but not accessible after random period of time

Posted: Mon Jul 06, 2020 5:02 am
by liuzhifu
Hi @awander, @teckhaokoh,
  • Is the problem easy or hard to be reproduced? About how long time for you to reproduce the issue?
  • How about configured the Router to open mode (Disable encryption mode)?
  • Does the issue still exist if change the Router to hotspot of phone?