-
Notifications
You must be signed in to change notification settings - Fork 7k
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
static ip set in wifi- station mode in esp32 (IDFGH-3274) #5266
Comments
Hi @sowmimalu No need to start the DHCP client after setting the address. tcpip_adapter_set_ip_info(WIFI_IF_STA, &ip); This should be enough to setup static IP address, after that an IP event should be received (depending on your event registration, e.g. |
tried now its working...thank you |
This should be closed. @Alvin1Zhang |
Thanks for the notes @AxelLin . @sowmimalu Glad that it is working, feel free to reopen if the issue still happens. |
hai ,
In my application i need to connect with the static IP given.
i can able to connect when used
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
it can able get ip with dynamic and connect with wifi
then i tried with static,
tcpip_adapter_init();
tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA); // Don't run a DHCP client
tcpip_adapter_ip_info_t ip_info;
ip_info.ip.addr = ipaddr_addr("192.168.43.3");
ip_info.gw.addr = ipaddr_addr("192.168.43.1");
ip_info.netmask.addr = ipaddr_addr("255.255.255.0");
tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
printf("IP Address: %s\n", ip4addr_ntoa(&ip_info.ip));
printf("Subnet mask: %s\n", ip4addr_ntoa(&ip_info.netmask));
printf("Gateway: %s\n", ip4addr_ntoa(&ip_info.gw));
ESP_ERROR_CHECK(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA));
but always i am getting invalid static ip ...
could you please tell me on how to fix the static ip and to connect with wifi??
The text was updated successfully, but these errors were encountered: