hi support team,
may i ask how to set static ip address for 7002?
1. i set these configs:
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y


hi support team,
may i ask how to set static ip address for 7002?
1. i set these configs:
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y
Hi,
there will be error in log: that is 30 seconds gaps and shows error, also it will not connect to router.
Try setting:
CONFIG_NET_CONFIG_INIT_TIMEOUT=0
2. and if i set CONFIG_NET_DHCPV4=ythe static ip address setting will be overwrite by dhcp:
This is expected when DHCP client is enabled.
To set static ip, you can use wifi/sta as an example.
You will need to change the dhcp function in main.c to something like this:
static void print_dhcp_ip(struct net_mgmt_event_callback *cb) { #if defined(CONFIG_NET_DHCPV4) /* Get DHCP info from struct net_if_dhcpv4 and print */ const struct net_if_dhcpv4 *dhcpv4 = cb->info; const struct in_addr *addr = &dhcpv4->requested_ip; char dhcp_info[128]; net_addr_ntop(AF_INET, addr, dhcp_info, sizeof(dhcp_info)); LOG_INF("DHCP IP address: %s", dhcp_info); #endif }
And in prj.conf, you explicitly disable dhcp:
CONFIG_NET_DHCPV4=n
And set your wanted IP address on the network that you're connecting to:
CONFIG_WIFI_CREDENTIALS_STATIC_SSID="MY_SSID" CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="MY_PASSWORD" CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.32.1" CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.32.9"
My network is on 192.168.32.xxx
On a test-laptop, connected to the same network, I can then ping 192.168.32.9:
$ ping 192.168.32.9 PING 192.68.32.9 (192.168.32.9): 56 bytes 64 bytes from 192.168.32.9: icmp_sec=1 ttl=64 time=53.068 ms
Kind regards,
Håkon
Hi,
there will be error in log: that is 30 seconds gaps and shows error, also it will not connect to router.
Try setting:
CONFIG_NET_CONFIG_INIT_TIMEOUT=0
2. and if i set CONFIG_NET_DHCPV4=ythe static ip address setting will be overwrite by dhcp:
This is expected when DHCP client is enabled.
To set static ip, you can use wifi/sta as an example.
You will need to change the dhcp function in main.c to something like this:
static void print_dhcp_ip(struct net_mgmt_event_callback *cb) { #if defined(CONFIG_NET_DHCPV4) /* Get DHCP info from struct net_if_dhcpv4 and print */ const struct net_if_dhcpv4 *dhcpv4 = cb->info; const struct in_addr *addr = &dhcpv4->requested_ip; char dhcp_info[128]; net_addr_ntop(AF_INET, addr, dhcp_info, sizeof(dhcp_info)); LOG_INF("DHCP IP address: %s", dhcp_info); #endif }
And in prj.conf, you explicitly disable dhcp:
CONFIG_NET_DHCPV4=n
And set your wanted IP address on the network that you're connecting to:
CONFIG_WIFI_CREDENTIALS_STATIC_SSID="MY_SSID" CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="MY_PASSWORD" CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.32.1" CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.32.9"
My network is on 192.168.32.xxx
On a test-laptop, connected to the same network, I can then ping 192.168.32.9:
$ ping 192.168.32.9 PING 192.68.32.9 (192.168.32.9): 56 bytes 64 bytes from 192.168.32.9: icmp_sec=1 ttl=64 time=53.068 ms
Kind regards,
Håkon