Skip to content

Wifi.softAP DHCP issue - ERROR: send_offer (error -13) #7871

Closed
@michaloles

Description

@michaloles

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: ESP8266 node MCU V3
  • Core Version: 2.7.2
  • Development Env: Platformio
  • Operating System: Windows

Settings in IDE

  • Module: nodemcuv2
  • Flash Mode: [qio|dio|other]
  • Flash Size: 4MB
  • Flash Frequency: 40Mhz
  • CPU Frequency: [80Mhz
  • Upload Using: SERIAL]
  • Upload Speed: 115200

Problem Description

When I run WIFI in soft AP mode I can't connect to my board using DHCP. I've tried from different devices both Windows PC and Android phones failed during obtaining IP address. When I assign static IP everything works fine. I've checked network communication using Wireshark and DHCP offer message wasn't send from ESP. When I enabled debug I see following errors:
ERROR: send_offer (error -13)
ERROR: dhcps send ack (error -13)

I've tried different devices and play with a lot of different settings like: WiFi.setSleepMode. IP configuration, dhcps_offer_option, WiFi.mode but without success. I've also check a lot of similar issues (one with mDNS, too short password etc) but none of them fix mine. I will be really glad if somebody give me some advice.

MCVE Sketch

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncJson.h>
#include <ArduinoJson.h>
#include <DHT.h>
#include <LittleFS.h>

extern "C" {
  #include "user_interface.h"
}

void setup() {
     Serial.begin(115200);
     Serial.setDebugOutput(true);

     WiFi.setSleepMode(WIFI_NONE_SLEEP);
     WiFi.disconnect(true);
     WiFi.mode(WIFI_AP);

     uint8 mode = 1;
     wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode);

     WiFi.softAP(systemConfig.wifiName, systemConfig.wifiPassword, 9);
     delay(500); //wait for SYSTEM_EVENT_AP_START 
     WiFi.softAPConfig(IPAddress{10, 0, 0, 1}, IPAddress{10, 0, 0, 1}, IPAddress{255, 255, 255, 0});

     Serial.println("Connected:");
     Serial.println(WiFi.softAPIP());
     
     Serial.println("DHCP status:");
     Serial.println(wifi_softap_dhcps_status());

    //starting web server etc
}

void loop() {
   //basic reading sensor operation nothing heavy
}

Debug Messages

SDK:2.2.2-dev(38a443e)/Core:2.7.2=20702000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-30-g92add50/BearSSL:5c771be
sleep disable
[AP] softap config unchanged
[APConfig] local_ip: 10.0.0.1 gateway: 10.0.0.1 subnet: 255.255.255.0
[APConfig] DHCP IP start: 10.0.0.100
[APConfig] DHCP IP end: 10.0.0.200
Connected:
10.0.0.1
DHCP status:
1
wifi evt: 7
aid 1
station: 28:b2:bd:cf:c0:f1 join, AID = 1
wifi evt: 5
ERROR: send_offer (error -13)
wifi evt: 7
....
wifi evt: 7
wifi evt: 9
wifi evt: 7
ERROR: dhcps send ack (error -13)
wifi evt: 9
wifi evt: 7
wifi evt: 7
...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions