-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Cannot receive ESP-Now Broadcasts #6174
Comments
Unfortunately we're stuck on sdk 2.2.x for the moment, and this fix, among others, were applied post sdk 3. |
@littleyoda can you tripple check per this comment |
I tested it, and it works. Great. Thanks. If someone wants to reproduce it:
If someone knows how to enable this version in platformio, I would be happy about an message. |
For PlatformIO, with current master of this core, you can add |
thanks .... Works ... great For Platforumio: [env:d1_mini]
platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
board = d1_mini
framework = arduino
build_flags = -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22y I added also a ESP.eraseConfig(), because sometimes the old wifi credentials causes problems. #include <Arduino.h>
#include <ESP8266WiFi.h>
extern "C" {
#include <espnow.h>
#include "user_interface.h"
}
#define WIFI_CHANNEL 1
byte message[10] = {1,2,3,4,5,6,7,8,9,10};
unsigned long last = 0;
uint8_t broadcastMac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
void setup() {
Serial.begin(115200);
WiFi.disconnect();
ESP.eraseConfig();
delay(3000);
Serial.println(ESP.getSdkVersion());
WiFi.softAP("sender", "sendersender", WIFI_CHANNEL, false);
WiFi.mode(WIFI_AP_STA);
Serial.println("INIT: " + String(esp_now_init()));
delay(10);
Serial.println("Set Self Role: " + String(esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER)));
// Callback for received messages
esp_now_register_recv_cb([](uint8_t *mac, uint8_t *data, uint8_t len) {
Serial.println("[" + String(millis()) + "] Received Message. Len=" + String(len));
});
WiFi.printDiag(Serial);
}
void loop() {
// Send a new message every 5 sec
if ((last + 5000) < millis()) {
int ret = esp_now_send(broadcastMac, message, 10);
last = millis();
Serial.println("[" + String(millis()) + "] Sending new Message -- Result Code: " + String(ret));
}
delay(10);
} |
Amazing, thank you!!! Here's a full project where it's working with PlatformIO: https://github.com/theicfire/led_sync/tree/master/led_hat |
Just FYI (a few years later) this works with the default PlatformIO setup, sdk, etc. I was able to send/receive messages via broadcast (FF:FF:FF:FF:FF:FF) without any under the hood modifications. Also, there was no need to add_peer the broadcast address of (FF:FF:FF:FF:FF:FF). |
Basic Infos
Platform
Settings in IDE
Problem Description
Currently the ESP8266 is able to send ESP-Now Broadcast, but is not able to receive ESP-Now Broadcast.
The Problem has been fixed in the ESP8266_NONOS_SDK around Nov 2018.
espressif/ESP8266_NONOS_SDK#8
espressif/ESP8266_NONOS_SDK#134
Apparently this bugfix has not been applied yet.
I tested the program below against the ESP32. The ESP32 is able to receive the Broadcasts send by the ESP8266.
All in all, it is very difficult for an outstanding user to find out which changes from ESP8266_NONOS_SDK have been applied. Even after reading SDK issues (SDK reverted from pre3 to 2.2.1) and Migrate core from NONOS SDK to FreeRTOS SDK
MCVE Sketch
The text was updated successfully, but these errors were encountered: