[Solved] Soft-AP DHCP lease time

taribo
Posts: 14
Joined: Tue Dec 09, 2014 11:48 pm

[Solved] Soft-AP DHCP lease time

Postby taribo » Sun Apr 24, 2016 5:38 pm

Hi,

I am using the latest AT command FW (AT_V1.0 based on ESP8266_NONOS_SDK_V1.5.3).
I can't set the DHCP lease time correctly.

I am using AT+CWDHCPS_DEF=1,3,"192.168.4.2","192.168.4.3" to set the lease time to 3 minutes. This command returns OK and it should store parameters to flash. But after I restart the ESP8266 module, the DHCP lease time returns to default 120 minutes, as you can see from the serial log below.
After restart, the AT+CWDHCPS_DEF? command returns: +CWDHCPS_DEF:3,192.168.4.2,192.168.4.3
But the AT+CWDHCPS_CUR? command returns: +CWDHCPS_CUR:120,192.168.4.2,192.168.4.3

Code: Select all

AT+RST


OK

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rlŽ‚rlŒžâŒ¢þ
ready
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:0,0.0.0.0,0.0.0.0
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:120,192.168.4.2,192.168.4.101
OK
AT+CWDHCPS_DEF=1,3,"192.168.4.2","192.168.4.3"


OK
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:3,192.168.4.2,192.168.4.3
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:3,192.168.4.2,192.168.4.3
OK
AT+RST


OK

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rlŽ‚rlŒžâŒ¢þ
ready
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:3,192.168.4.2,192.168.4.3
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:120,192.168.4.2,192.168.4.3
OK
AT+GMR

AT version:1.0.0.0(Apr 16 2016 13:02:45)
SDK version:1.5.3(aec24ac9)
compile time:Apr 18 2016 14:20:15
OK


ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Soft-AP DHCP lease time

Postby ESP_Faye » Mon Apr 25, 2016 3:03 pm

Hi,

Please have a try with the new AT bin, if your problem is still unsolved, please feel free to let us know.

Sorry for the inconvenience.
Attachments
AT_test_bin.zip
(279.33 KiB) Downloaded 466 times

taribo
Posts: 14
Joined: Tue Dec 09, 2014 11:48 pm

Re: Soft-AP DHCP lease time

Postby taribo » Tue Apr 26, 2016 3:03 am

Something is not working right. Maybe there is a bug, or maybe I am missing something...

I am using the FW provided by you.
With the default settings, the DHCP server is working fine. Please see below log. In Soft-AP mode, I am connecting 3 Android phones with no problem.

Code: Select all

AT+RST


OK

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rlŽ‚rlŒžâŒbþ
ready
AT+GMR

AT version:1.0.0.0(Apr 25 2016 14:18:03)
SDK version:1.5.3(aec24ac9)
compile time:Apr 25 2016 14:39:42
OK
AT+CWMODE?

+CWMODE:2

OK
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:0,0.0.0.0,0.0.0.0
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:120,192.168.4.2,192.168.4.101
OK
AT+CWLIF

192.168.4.2,5c:f8:a1:xx:xx:xx
192.168.4.3,60:21:c0:xx:xx:xx
192.168.4.4,20:64:32:xx:xx:xx

OK



Then, I am trying to restrict the number of IPs assigned by DHCP to only 2: 192.168.4.2 and 192.168.4.3, with the lease time 3 minute.
But in this case, I can only connect with first Android phone. As long as the first Android is connected, the second Android never receives an IP from DHCP server inside ESP8266.
I can only connect with the second Android phone after following these steps:
- disconnect the first Android from WiFi
- wait 3 minutes for the second Android to connect to the Soft-AP of the ESP8266
When connected (they are never connected simultaneously) both the first and the second Android, receive the IP: 192.168.4.2.

Is this a normal behavior ?


Code: Select all

AT+CWDHCPS_DEF=1,3,"192.168.4.2","192.168.4.3"


OK
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:3,192.168.4.2,192.168.4.3
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:3,192.168.4.2,192.168.4.3
OK
AT+RST


OK

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rlŽ‚rlŒžâŒbþ
ready
AT+GMR

AT version:1.0.0.0(Apr 25 2016 14:18:03)
SDK version:1.5.3(aec24ac9)
compile time:Apr 25 2016 14:39:42
OK
AT+CWMODE?

+CWMODE:2

OK
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:3,192.168.4.2,192.168.4.3
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:3,192.168.4.2,192.168.4.3
OK
AT+CWLIF

192.168.4.2,20:64:32:xx:xx:xx

OK

taribo
Posts: 14
Joined: Tue Dec 09, 2014 11:48 pm

Re: Soft-AP DHCP lease time

Postby taribo » Tue Apr 26, 2016 3:16 am

Also, when I try to restrict the DHCP IP to only one IP: 192.168.4.2, this doesn't work. In this case I am using the command: AT+CWDHCPS_DEF=1,3,"192.168.4.2","192.168.4.2". But after this command, I am able to connect 3 Android phones, with the IPs in the range 192.168.4.2 - 192.168.4.4, as you can see in the log bellow.

Code: Select all

AT+RESTORE


OK

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rlŽ‚rlŒžâŒb lŒbr|ì bàrb Žàlbìònî€nnâ lbl Œ lŒŽl쌌 Œl l`€nü<0>ŒžâŒb lŒ l b ŒžâŒb lŒb|rlrl
ready
AT+GMR

AT version:1.0.0.0(Apr 25 2016 14:18:03)
SDK version:1.5.3(aec24ac9)
compile time:Apr 25 2016 14:39:42
OK
AT+CWMODE?

+CWMODE:2

OK
AT+CWLIF


OK
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:0,0.0.0.0,0.0.0.0
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:120,192.168.4.2,192.168.4.101
OK
AT+CWLIF

192.168.4.2,5c:f8:a1:xx:xx:xx
192.168.4.4,20:64:32:xx:xx:xx
192.168.4.3,60:21:c0:xx:xx:xx

OK
AT+CWDHCPS_DEF=1,3,"192.168.4.2","192.168.4.2"


OK
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:3,192.168.4.2,192.168.4.2
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:3,192.168.4.2,192.168.4.2
OK
AT+RST


OK

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rlŽ‚rlŒžâŒ¢þ
ready
AT+GMR

AT version:1.0.0.0(Apr 25 2016 14:18:03)
SDK version:1.5.3(aec24ac9)
compile time:Apr 25 2016 14:39:42
OK
AT+CWMODE?

+CWMODE:2

OK
AT+CWDHCPS_DEF?

+CWDHCPS_DEF:3,192.168.4.2,192.168.4.2
OK
AT+CWDHCPS_CUR?

+CWDHCPS_CUR:3,192.168.4.2,192.168.4.2
OK
AT+CWLIF

192.168.4.2,5c:f8:a1:xx:xx:xx
192.168.4.4,20:64:32:xx:xx:xx
192.168.4.3,60:21:c0:xx:xx:xx

OK


ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Soft-AP DHCP lease time

Postby ESP_Faye » Tue Apr 26, 2016 4:30 pm

Hi,

Please have a try with the attachment.

If your problem is still unsolved, please feel free to let us know.
Attachments
AT_test_bin2.zip
(279.27 KiB) Downloaded 487 times

taribo
Posts: 14
Joined: Tue Dec 09, 2014 11:48 pm

Re: Soft-AP DHCP lease time

Postby taribo » Wed Apr 27, 2016 2:32 am

Hi,

It's working fine now :)

Thank you.

Who is online

Users browsing this forum: No registered users and 3 guests