Espressif ESP32-S2 Programming Manual page 147

Table of Contents

Advertisement

Chapter 2. API Reference
Typical use cases of mesh events include using events such as
MESH_EVENT_CHILD_CONNECTED
stream respectively. Likewise, IP_EVENT_STA_GOT_IP and IP_EVENT_STA_LOST_IP can be used to indi-
cate when the root node can and cannot transmit data to the external IP network.
Warning: When using ESP-WIFI-MESH under self-organized mode, users must ensure that no calls to Wi-
Fi API are made. This is due to the fact that the self-organizing mode will internally make Wi-Fi API calls
to connect/disconnect/scan etc. Any Wi-Fi calls from the application (including calls from callbacks and
handlers of Wi-Fi events) may interfere with ESP-WIFI-MESH's self-organizing behavior. Therefore,
user's should not call Wi-Fi APIs after
called.
LwIP & ESP-WIFI-MESH
go through the LwIP stack. The LwIP stack is only required by the root node to transmit/receive data to/from an
external IP network. However, since every node can potentially become the root node (due to automatic root node
selection), each node must still initialize the LwIP stack.
Each node is required to initialize LwIP by calling tcpip_adapter_init(). In order to prevent non-root
node access to LwIP, the application should stop the following services after LwIP initialization:
• DHCP server service on the softAP interface.
• DHCP client service on the station interface.
The following code snippet demonstrates how to initialize LwIP for ESP-WIFI-MESH applications.
/*
tcpip initialization */
tcpip_adapter_init();
/*
* for mesh
* stop DHCP server on softAP interface by default
* stop DHCP client on station interface by default
*/
ESP_ERROR_CHECK(tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP));
ESP_ERROR_CHECK(tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA));
Note: ESP-WIFI-MESH requires a root node to be connected with a router. Therefore, in the event that a node
becomes the root, the corresponding handler must start the DHCP client service and immediately obtain an
IP address. Doing so will allow other nodes to begin transmitting/receiving packets to/from the external IP network.
However, this step is unnecessary if static IP settings are used.
Espressif Systems
Fig. 2: ESP-WIFI-MESH System Events Delivery
to indicate when a node can begin transmitting data upstream and down-
esp_mesh_start()
The application can access the ESP-WIFI-MESH stack directly without having to
136
Submit Document Feedback
MESH_EVENT_PARENT_CONNECTED
is called, and before
esp_mesh_stop()
and
is
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF