Closed JavierReyes945 closed 2 months ago
Hi,
It is recommended not to set the AT+CWDHCP=0,1
. To disable DHCP in softAP mode, use AT+CWDHCP=0,2
. If you need to disable DHCP in both station and softAP modes, use AT+CWDHCP=0,3
. If you want to enable DHCP in station mode, set it to AT+CWDHCP=1,1
. I hope this information is helpful to you.
@Luxin812 Thank you for the recommendation. I have tried as you suggested it and works now.
As feedback for maintainers of the repository, official documentation https://docs.espressif.com/projects/esp-at/en/latest/esp32c6/AT_Command_Set/Wi-Fi_AT_Commands.html#at-cwdhcp-enable-disable-dhcp should be updated, as the way it is shown, the parameters for the Set Command are:
Set Command
Function:
Enable/disable DHCP.
Command:
AT+CWDHCP=<operate>,<mode>
Parameters
<operate>:
0: disable
1: enable
<mode>:
Bit0: Station DHCP
Bit1: SoftAP DHCP
But after your feedback, it is clear that the second parameter mode
of the Set Command works as documented for the Query Command:
Query Command
Command:
AT+CWDHCP?
Response:
+CWDHCP:<state>
OK
Parameters
<state>: the status of DHCP
Bit0:
0: Station DHCP is disabled.
1: Station DHCP is enabled.
Bit1:
0: SoftAP DHCP is disabled.
1: SoftAP DHCP is enabled.
Bit2:
0: Ethernet DHCP is disabled.
1: Ethernet DHCP is enabled.
Answers checklist
AT+GMR
AT version:3.5.0.0-dev(0f91d98 - ESP32C6 - Jul 19 2024 02:57:35) SDK version:v5.1.2-dirty compile time(368f620f):Aug 9 2024 14:25:28 Bin version:v4.1.0.0-dev(ESP32C6-4MB) OK
ESP-AT Firmware Source
Local build from master Branch, also tested with prebuilt Binary for v4.0.0.0/release for ESP32C6
Hardware Information
ESP32C6-DevKitM-1
Power Supply used
USB
What is the expected behavior?
The DCHP client for Wifi interface (as Station) shall be activated or deactivated with the AT command
AT+CWDHCP=<operate>,<mode>
. DHCP is active by default, but in some cases one needs to assign an IP address statically, so DHCP first needs to be disabled.What is the actual behavior?
The DHCP cannot be changed (at least not directly) with the AT command. Either before Wifi Station initialization, or after the initialization, or even after the connection to an Access Point. It simply does not allow to change the DHCP.
Strangely, one can indirectly change the DHCP with the command
AT+CIPSTA=<"ip">,<"gateway">,<"netmask">
, due to the condition documented:So, if we set a fixed IP address, we then see that the DHCP has been deactivated for Wifi Station. This would be OK, but then the DHCP is deactivated persistently, and the only way to activate it is to run a factory reset.
Probability of recurrence
Always
AT+SYSRAM?
AT+SYSRAM? +SYSRAM:256860,249408 OK
Steps to reproduce
Either before Wifi Station initialization:
Or after the initialization:
Or after Wifi connection to external AP:
But indirectly (setting fixed IP when DHCP is on) works (but cannot be enabled again, only with a factory reset):
AT command port output
AT log port output
More Information.
No response