Troubleshooting Husarnet on ESP32
In this document we describe problems Husarnet users stumbled into in the past. You might find the solution to your problem here, and also it is good resource to gain deeper understanding of the Husarnet system. If you do not see a solution you want, please let us know. Describe your problem and post it on Husarnet Community Forums or contact us at support@husarnet.com if you want to send any sensitive information.
What information to provide while posting problem report?
- description of the problem and your test setup
- Husarnet and ESP-IDF/Arduino logs, please make sure that you enable verbose Husarnet logs (
HUSARNET_LOG_LEVEL_DEBUG
option in menuconfig in ESP-IDF) - providing a minimal reproducible example is always helpful and speeds up the debugging process
It usually is a good idea to have a look at app.husarnet.com - both in the group/network config and element/device tabs. Some of the configuration issues are automatically highlighted there.
Reseting IPv6 address
Husarnet IPv6 address of each ESP32 is stored in the flash (NVS) under the husarnet
prefix. If you want to generate a new IPv6 address for you ESP32 run: idf.py erase-flash
inside the project folder to clear entire flash memory or use idf.py erase-region nvs
to clear only the NVS partition.
Remember to flash the firmware again after erasing the flash!
If you are using Arduino IDE you can erase flash before uploading by turning on the Erase flash before upload
option in the Tools
menu. Remember to turn it off after flashing! Otherwise board identity / IP address will be regenerated each upload.
Multiple devices with the same name
When using Husarnet, make sure that each device has a unique hostname. If two devices have the same hostname, the network may not work correctly and strange behavior may occur (e.g. one device is visible but not accessible from the other).
Collisions are likely to occur on ESP32 as the hostname is usually hardcoded in the firmware. After generating a new identity (e.g. by erasing the flash), remember to either change new hostname to a unique one or remove old device from the dashboard.
Watchdog warnings in logs
In the current implementation device identity generation is a resource-intensive operation. Usually it takes a few seconds to generate a new identity. When system is under load, watchdog may issue a warning. This is considered a normal behavior and should not be a cause for concern.
High latency (ping)
If you experience high latency when pinging other devices in the Husarnet network, it might be caused by the Wi-Fi power saving mode. To disable it, add the following code snippet to your project:
#include "esp_wifi.h"
...
void app_main() {
...
// In order to reduce ping, power saving mode is disabled
esp_wifi_set_ps(WIFI_PS_NONE);
...
}
Remember that disabling power saving mode will increase power consumption.
Sketch too big
If you encounter the following error message while compiling your sketch:
Sketch too big; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.
text section exceeds available space in board
Compilation error: text section exceeds available space in board
Please select larger partition scheme in the Arduino IDE. Go to Tools -> Partition Scheme
and select a partition scheme with more flash memory available for the main application.
Updating Arduino ESP32 platform
When trying to compile a sketch with the Husarnet library, you may encounter the following error:
husarnet.h:7:6: error: #error "This library requires ESP32 Arduino Core version 3.0.3 or newer. Please upgrade your board/platform."
The Husarnet library is only available for the ESP32 platform versions 3.0.3 and newer. To use the Husarnet library, you need to update the ESP32 platform in your Arduino IDE. Open the Board Manager from the sidebar, search for esp32
and click Install
.
Make sure that you have selected version 3.0.3 or above from the dropdown.
If you are using third party boards that come with their own board definitions (e.g. M5Stack), you may need to wait for the board maintainer to update the platform.