Hello,
I am trying to get an ESP32 DevKit C Arduino sketch working that has both an AP and a Station. The AP is used to provide a private network to similar ESP32 nodes (all in STA mode). The issue I am facing is that I cannot get the ESP32 that has the AP implemented to connect to the network.
I have implemented a similar system using the AT-Command firmware and it works fine. However, I cannot get this Arduino sketch to do the same.
Is the dual mode (AP and STA) possible to work this way? I need the ESP32 with the AP to also be able to connect to the AP network and send/receive multicast packets.
Sid
ESP32 Access Point and Station issue
Re: ESP32 Access Point and Station issue
I would love to get a response to this question please,
Sid
Sid
-
- Posts: 831
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32 Access Point and Station issue
The answer is no.
The ESP32 can do this, arduino-esp32 cannot. It is compiled with the necessary options (ip forwarding and L2->L3 transfers) turned off for security reasons.
The tasmota build for platform.io by Jason2866 (https://github.com/Jason2866/esp32-ardu ... /releases/) has these options enabled. Or, you can just use tasmota, which in turn uses that platform to build off of, and has NAT forwarding all set up out of the box.
The ESP32 can do this, arduino-esp32 cannot. It is compiled with the necessary options (ip forwarding and L2->L3 transfers) turned off for security reasons.
The tasmota build for platform.io by Jason2866 (https://github.com/Jason2866/esp32-ardu ... /releases/) has these options enabled. Or, you can just use tasmota, which in turn uses that platform to build off of, and has NAT forwarding all set up out of the box.
Re: ESP32 Access Point and Station issue
Thank you for your help.
I am already using the jason2866 platform, I had an earlier problem and PlatformIO suggested using that. I do not understand how I can use that platform to achieve the result that I need as all the documentation links are for configuration with PlatformIO and that is done.
I would very much appreciate any help you can offer.
I am already using the jason2866 platform, I had an earlier problem and PlatformIO suggested using that. I do not understand how I can use that platform to achieve the result that I need as all the documentation links are for configuration with PlatformIO and that is done.
I would very much appreciate any help you can offer.
-
- Posts: 831
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32 Access Point and Station issue
I don't have things setup to test, but it should be as simple as setting up your device in APSTA mode, connecting to the upstream wifi, and calling:
Code: Select all
#include "lwip/lwip_napt.h"
u32_t napt_netif_ip = 0xC0A80401; // Set to ip address of softAP netif (Default is 192.168.4.1)
ip_napt_enable(htonl(napt_netif_ip), 1);
Re: ESP32 Access Point and Station issue
Many thanks, that appears to enable me to send and receive multicast packets from the AP device to the network.
One issue is that after the call to "ip_napt_enable" I have to use a delay, which is not a good practice. Is there an API that could be polled to know when the device is ready?
After the delay I call WiFi.status and it returns "6" (Disconnected) and the IP address returned by WiFi.localIP is "0.0.0.0".
This is confusing because the device does send and receive multicast packets.
Any input would be much appreciated.
One issue is that after the call to "ip_napt_enable" I have to use a delay, which is not a good practice. Is there an API that could be polled to know when the device is ready?
After the delay I call WiFi.status and it returns "6" (Disconnected) and the IP address returned by WiFi.localIP is "0.0.0.0".
This is confusing because the device does send and receive multicast packets.
Any input would be much appreciated.
-
- Posts: 831
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32 Access Point and Station issue
The code is at https://github.com/espressif/esp-lwip/b ... ip4_napt.c
Good luck. Post what you find for the next person that comes along.
Good luck. Post what you find for the next person that comes along.
Who is online
Users browsing this forum: No registered users and 39 guests