Page 1 of 1

static IP on esp32 in AP mode?

Posted: Mon Sep 27, 2021 6:14 am
by bitrat
I'm a bit dense when it comes to networking, so I'm not even sure if this make sense. Does the AP dynamically allocate it's own ip?

I've tried just using the ifconfig that's returned from ifconfig if I start wlan in AP mode with no config...

Code: Select all

wlan.ifconfig( ('192.168.4.1', '255.255.255.0', '192.168.4.1', '0.0.0.0') )
I tried a few variations on the arguments as well, like...

Code: Select all

wlan.ifconfig(config=('192.168.4.1', '255.255.255.0', '192.168.4.1', '0.0.0.0') )
..and..

Code: Select all

wlan.ifconfig(0, ('192.168.4.1', '255.255.255.0', '192.168.4.1', '0.0.0.0') )
They all crash or return errors, eg:

Code: Select all

TCP/IP Invalid Parameters

Re: static IP on esp32 in AP mode?

Posted: Mon Sep 27, 2021 9:54 am
by davef
Did you:

Code: Select all

ap_if = network.WLAN(network.AP_IF) #  create access-point interface
first?

Then maybe:

Code: Select all

ap_if.ifconfig((config.WiFi_device, '255.255.255.0', config.gateway, '8.8.8.8'))

Re: static IP on esp32 in AP mode?

Posted: Tue Sep 28, 2021 8:13 am
by bitrat
Thanks, yep, I did that. Think I need to do more research...