Skip to content

instruction esp_now_send causes ESP8266MOD to crash due to hardware watchdog reset #8989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
6 tasks done
lozziboy opened this issue Sep 14, 2023 · 1 comment
Open
6 tasks done

Comments

@lozziboy
Copy link

lozziboy commented Sep 14, 2023

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: [ESP8266MOD]
  • Core Version: [Release 3.1.2 - Mar20]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Wemos D1 R2]
  • Flash Mode: [qio|dio|other]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [ck|nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [921600]

Problem Description

Using instruction esp_now_send causes ESP8266MOD to crash due to hardware watchdog reset.
I also found a workaround for that, that is to setup the GPIO16 as OUTPUT during setup (i.e. pinMode(16, OUTPUT) ), but I don't realize why this happens and how this could be related to esp_now_send instruction.

MCVE Sketch

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <espnow.h>

uint8_t targetAddr[] = {0x8C, 0xAA, 0xB5, 0xB5, 0x90, 0x60};

byte myData = 1;
int cnt = 0;

void OnDataSent(uint8_t *mac, uint8_t sendStatus)
{
  if (sendStatus == 0)  {
    Serial.println("Delivery success");
  }
  else  {
    Serial.println("Delivery fail");
  }
}

void setup()
{
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  if (esp_now_init() != 0)  {
    Serial.println("Error initializing ESP-NOW");
    return;
  }
  esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);
  esp_now_register_send_cb(OnDataSent);
  esp_now_add_peer(targetAddr, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);
}

void loop()
{
  if (cnt % 10000 == 0)  {
    Serial.println(cnt);
    esp_now_send(targetAddr, (uint8_t *) &myData, sizeof(myData));
  }
  cnt += 1;
}

Debug Messages


ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v00042e70
~ld
⸮����⸮n⸮�r⸮⸮n|⸮l⸮l`��b���b�r��l⸮nb⸮n�l`�⸮�r�l⸮l�⸮⸮
0


@d-a-v
Copy link
Collaborator

d-a-v commented Nov 4, 2023

esp-now is not supported by us because this part is closed-source.
You can try with another firmware by selecting the "generic esp8266" board and use the firmware option that will be available inside the tools menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants