static IP on esp32 in AP mode?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
bitrat
Posts: 41
Joined: Fri Jul 26, 2019 4:13 am

static IP on esp32 in AP mode?

Post by bitrat » Mon Sep 27, 2021 6:14 am

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

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: static IP on esp32 in AP mode?

Post by davef » Mon Sep 27, 2021 9:54 am

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'))

bitrat
Posts: 41
Joined: Fri Jul 26, 2019 4:13 am

Re: static IP on esp32 in AP mode?

Post by bitrat » Tue Sep 28, 2021 8:13 am

Thanks, yep, I did that. Think I need to do more research...

Post Reply