Giter Site home page Giter Site logo

esp-now's Introduction

ESP-NOW Component

Component Registry

esp-now supports one-to-many and many-to-many device connection and control which can be used for the mass data transmission, like network config, firmware upgrade and debugging etc.

Add component to your project

Please use the component manager command add-dependency to add the esp-now to your project's dependency, during the CMake step the component will be downloaded automatically.

idf.py add-dependency "espressif/esp-now=*"

Example

Please use the component manager command create-project-from-example to create the project from example template.

idf.py create-project-from-example "espressif/esp-now=*:coin_cell_demo/bulb"

Then the example will be downloaded in current folder, you can check into it for build and flash.

You can use this command to download other examples. Or you can download examples from esp-now repository:

  1. coin_cell_demo/bulb
  2. coin_cell_demo/switch
  3. control
  4. get-started
  5. ota
  6. security
  7. solution
  8. wireless_debug

Q&A

Q1. I encountered the following problems when using the package manager

Executing action: create-project-from-example
CMakeLists.txt not found in project directory /home/username

A1. This is because an older version packege manager was used, please run pip install -U idf-component-manager in ESP-IDF environment to update.

esp-now's People

Contributors

bubblesnake avatar chenlijun99 avatar dcsbl avatar deining avatar larryli avatar lhespress avatar ljysp avatar marcoccio avatar n3b0j5a avatar wujiangang avatar zhanzhaocheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp-now's Issues

Please clarify security capabilities of esp-now (AEGHB-38)

Hi,
from what I understand esp-now does not support encrypted multicast/broadcast communication. In fact, from the documentation of ESP-IDF, I read:

Encrypting multicast vendor-specific action frame is not supported.

However, this repository seems to be a series of application level components that are developed on-top of the low-level esp-now primitives provided in ESP-IDF and, in particular, it seems to me that the security component implements its own application-level security, that apparently doesn't make use of the PMK/LMK mechanism of the low-level esp-now. It seems also that this application level security supports broadcast/multicast encrypted communication.
Could you please confirm this?

can esp now uses as the repeater on esp8266

Hello,

I have many esp8266 which does some work like on off relay, temperature sensor etc. Each esp8266 reports to the wifi network. Problem is each esp might not be in the range of wifi. Can esp now some how help in resolving the issue by extending the range of wifi or helps in relaying the message. Thanks!

Workaround for wifi_channel_set when connected to AP (AEGHB-23)

Hi at all,
I'm working on refactoring of an old firmware written with IDF<3.3 reguarding a product that is connected to wifi (STA) and communicate to other standalone device not connected to wifi

For bypass the AP dynamic channel use the function
wifi_channel_set
to temporarily change the channel to 1 and send the real channel to the slave (I know that it's not the best thing to do... but works)

But starting from IDF 3.3 the function usage is restricted and I cannot use It while is connected to AP.

But there is a workaround in the recent IDF to force temporarily the STA channel and send a esp-now message?

Thanks

how to save espnow security parameter so after restart device not start security responder/initiator ?

Hello,

I test the espnow security examples it works very well.

  1. For my project, i want something that once the security process finish btwn initiator/responder it should not restart security process again. and used the previous security parameters.

I digged into the espnow security components did not find much on that. So, What I can do this?

  1. Last, how can i filter the mac address so, reponder response to the specific mac address only.

Fix the ESPNOW parameters such as seq number and 4-byte random values. (esp_now_send()) (AEGHB-25)

Hello,
I hope you are doing well!

I need to fix the seq number and the 4-bytes random values at the beginning of the payload of ESPNOW packet. I believe that that magic happen in the esp_now_send() function, but I could find any API for that function. (Maybe the esp_now.c)

Is there anyway to access the random_values and sequence_control values in the espnow frame?

Thank you,
Best regards

Is API in Programming Guide old version of ESP-Now?

I wanna use esp-now in my little project of ESP8266,i try to find reference in programming guide,and later i saw this.
the API is not the same ,so is this new version of ESP-Now?If so,is there any examples of old version.
Thanks

ESP32 Sensor network with ESPNOW protocol (AEGHB-146)

I would like to ask about the project on this link

https://github.com/espressif/esp-now/tree/master/examples

I would like to create a project that combines the examples on this link. In other words, I want to create a sensor network from multiple ESP32 using the ESPNOW protocol. Could you please help me with a detailed description of examples on this line or possibly with their connection to a larger project where I will be able to communicate more ESP32 and send some data at regular intervals.
Please do not know how to add at least detailed comments to the examples on that link?

espNow crashing with dmd32 lib (AEGHB-35)

hi, im using dmd32 lib with esp now ,, but simple program rebooting again and again,
174472637-34609be5-e0c9-4dc0-9a63-2f3bd212f2a2
`#include <esp_now.h>
#include <WiFi.h>

#include <DMD32.h> //
#include "fonts/SystemFont5x7.h"
#include "fonts/Arial_black_16.h"

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
//Timer setup//create a hardware timer of ESP32
hw_timer_t * timer = NULL;

//////////////
typedef struct struct_message{
uint8_t a;
uint8_t b;

}struct_message;
// Create a structured object
struct_message myData;

void OnDataRecv(const uint8_t * mac, const uint8_t incomingData, int len);
/--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/

void IRAM_ATTR triggerScan()
{
dmd.scanDisplayBySPI();
}
void setup(void){
Serial.begin(115200);
Serial.println("receive");

// return the clock speed of the CPU
uint8_t cpuClock = ESP.getCpuFreqMHz();
// Use 1st timer of 4
// devide cpu clock speed on its speed value by MHz to get 1us for each signal of the timer
timer = timerBegin(0, cpuClock, true);
// Attach triggerScan function to our timer
timerAttachInterrupt(timer, &triggerScan, true);
// Set alarm to call triggerScan function
// Repeat the alarm (third parameter)
timerAlarmWrite(timer, 300, true);

// Start an alarm
timerAlarmEnable(timer);

//clear/init the DMD pixels held in RAM
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
///////////////
// Set ESP32 as a Wi-Fi Station
WiFi.mode(WIFI_STA);
// Initilize ESP-NOW
if (esp_now_init() != ESP_OK) {
Serial.println("Error initializing ESP-NOW");
return;
}
// Print MAC Address to Serial monitor

Serial.print("Responder ");
Serial.print("MAC Address: ");
Serial.println(WiFi.macAddress());

// Register callback function
esp_now_register_recv_cb(OnDataRecv);
}

/--------------------------------------------------------------------------------------
loop
Arduino architecture main loop
--------------------------------------------------------------------------------------/
unsigned int count;
char buf[]="1234";
void loop(void){

byte b;
// 10 x 14 font clock, including demo of OR and NOR modes for pixels so that the flashing colon can be overlayed
dmd.clearScreen( true );
dmd.selectFont(Arial_Black_16);
snprintf(buf, sizeof(buf), "%d",count);
dmd.drawString( 3,1,buf,strlen(buf), GRAPHICS_NORMAL );

delay(500);
count++;
}

// Callback function executed when data is received
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
memcpy(&myData, incomingData, sizeof(myData));
Serial.print("Data received: ");
Serial.println(len);
Serial.print("Character Value: ");
Serial.println(myData.a);
Serial.print("Integer Value: ");
Serial.println(myData.b);
}`

Enable spiram causes dhcp timeout

Chip:[esp32-wrover-e 4MBflash]
With spiram enable, calling esp_now_send() before calling esp_wifi_connect() will cause dhcp to time out on getting the ip.
This is my code:

static const char *TAG = "app_main";
static void ip_event_handler(void *arg, esp_event_base_t event_base,
                             int32_t event_id, void *event_data)
{
    ESP_LOGE(TAG, "ip_event_handler %d", event_id);
    return;
}
static void wifi_event_handler(void *arg, esp_event_base_t event_base,
                               int32_t event_id, void *event_data)
{
    ESP_LOGE(TAG, "wifi_event_handler %d", event_id);
    if(event_id == WIFI_EVENT_STA_START || event_id == WIFI_EVENT_STA_DISCONNECTED){
        esp_wifi_connect();
    }
    return;
}

static void wifi_init()
{
    ESP_ERROR_CHECK(esp_netif_init());
    esp_event_loop_create_default();
    esp_netif_create_default_wifi_sta();
    esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &wifi_event_handler, NULL);
    esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &ip_event_handler, NULL);
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK(esp_wifi_init(&cfg));
    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
    ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE));
    ESP_ERROR_CHECK(esp_wifi_start());

    wifi_config_t config = {0};
    strncpy((char *)config.sta.ssid, "ChinaNet-2.4G-3648", strlen("ChinaNet-2.4G-3648") + 1);
    strncpy((char *)config.sta.password, "quit8269", strlen("quit8269") + 1);
    esp_wifi_set_config(WIFI_IF_STA, &config);
}

static void espnow_send_task(void *arg)
{
    esp_err_t ret  = ESP_OK;
    char *data  = "hello";
    size_t size    = strlen(data);
    espnow_frame_head_t frame_head = {
        .retransmit_count = 1,
        .broadcast        = true,
        .channel = ESPNOW_CHANNEL_CURRENT,
    };
    for (;;) {
        ret = espnow_send(ESPNOW_TYPE_DATA, ESPNOW_ADDR_BROADCAST, data, size, &frame_head, portMAX_DELAY);
        if(ret != ESP_OK){
            ESP_LOGE(TAG, "Send error : %d", ret);
        }
        vTaskDelay(1000 / portTICK_RATE_MS);
    }
}

static esp_err_t espnow_recv_handle(uint8_t *src_addr, void *data,
                      size_t size, wifi_pkt_rx_ctrl_t *rx_ctrl)
{
    static uint32_t count = 0;
    ESP_LOGI(TAG, "espnow_recv, <%d> [" MACSTR "][%d][%d][%d]: %.*s", 
            count++, MAC2STR(src_addr), rx_ctrl->channel, rx_ctrl->rssi, size, size, (char *)data);
    return ESP_OK;
}

void app_main()
{
    esp_storage_init();
    wifi_init();
    espnow_config_t espnow_config = ESPNOW_INIT_CONFIG_DEFAULT();
    espnow_init(&espnow_config);
    espnow_set_type(ESPNOW_TYPE_DATA, 1, espnow_recv_handle);
    xTaskCreate(espnow_send_task, "uart_read_task", 4 * 1024, NULL, tskIDLE_PRIORITY + 1, NULL);
}

Lwip dhcp debug is enabled and all other menuconfig options are default .
This is the output of disable spiram:

I (438) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (512) wifi:wifi driver task: 3ffb9a80, prio:23, stack:6656, core=0
I (512) system_api: Base MAC address is not set
I (512) system_api: read default base MAC address from EFUSE
I (522) wifi:wifi firmware version: 63017e0
I (522) wifi:wifi certification version: v7.0
I (522) wifi:config NVS flash: enabled
I (532) wifi:config nano formating: disabled
I (532) wifi:Init data frame dynamic rx buffer num: 32
I (532) wifi:Init management frame dynamic rx buffer num: 32
I (542) wifi:Init management short buffer num: 32
I (542) wifi:Init static tx buffer num: 32
I (552) wifi:Init static rx buffer size: 1600
I (552) wifi:Init static rx buffer num: 10
I (562) wifi:Init dynamic rx buffer num: 32
I (562) wifi_init: rx ba win: 6
I (562) wifi_init: tcpip mbox: 32
I (572) wifi_init: udp mbox: 6
I (572) wifi_init: tcp mbox: 6
I (582) wifi_init: tcp tx win: 5744
I (582) wifi_init: tcp rx win: 5744
I (582) wifi_init: tcp mss: 1440
I (592) wifi_init: WiFi IRAM OP enabled
I (592) wifi_init: WiFi RX IRAM OP enabled
I (602) wifi:Set ps type: 0

I (602) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (692) wifi:mode : sta (bc:dd:c2:cf:f0:f4)
I (692) wifi:enable tsf
E (692) app_main: wifi_event_handler 2
I (692) ESPNOW: espnow [version: 1.0] init
I (732) wifi:new:<6,2>, old:<1,0>, ap:<255,255>, sta:<6,2>, prof:2
I (732) wifi:state: init -> auth (b0)
I (752) wifi:state: auth -> assoc (0)
I (762) wifi:state: assoc -> run (10)
I (782) wifi:connected with ChinaNet-2.4G-3648, aid = 1, channel 6, 40D, bssid = d8:32:14:db:36:49
I (782) wifi:security: WPA2-PSK, phy: bgn, rssi: -56
I (792) wifi:pm start, type: 0

dhcp_start(netif=0x3ffb741c) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(d31bb883)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
E (832) app_main: wifi_event_handler 4
I (832) wifi:AP's beacon interval = 102400 us, DTIM period = 3
W (842) wifi:<ba-add>idx:0 (ifx:0, d8:32:14:db:36:49), tid:0, ssn:2, winSize:64
dhcp_recv(pbuf = 0x3ffb1880) from DHCP server 192.168.5.1 port 67
pbuf->len = 300
pbuf->tot_len = 300
skipping option 28 in options
searching DHCP_OPTION_MESSAGE_TYPE
DHCP_OFFER received in DHCP_STATE_SELECTING state
dhcp_handle_offer(netif=0x3ffb741c) st1
dhcp_handle_offer(): server 0x0105a8c0
dhcp_handle_offer(): offer for 0x2d05a8c0
dhcp_select(netif=0x3ffb741c) st1
dhcp_select(): dhcp state is REQUESTING
transaction id xid(d31bb883)
dhcp_select: REQUESTING
dhcp_select(): set request timeout 2000 msecs
dhcp_recv(pbuf = 0x3ffb1880) from DHCP server 192.168.5.1 port 67
pbuf->len = 300
pbuf->tot_len = 300
skipping option 28 in options
searching DHCP_OPTION_MESSAGE_TYPE
DHCP_ACK received
dhcp_check(netif=0x3ffb741c) st
dhcp_check(): dhcp state is CHECKING
dhcp_check(): set request timeout 500 msecs
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): CHECKING, ARP request timed out
dhcp_check(netif=0x3ffb741c) st
dhcp_check(): dhcp state is CHECKING
dhcp_check(): set request timeout 500 msecs
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): CHECKING, ARP request timed out
dhcp_bind(netif=0x3ffb741c) st1
dhcp_bind(): t0 renewal timer 86400 secs
dhcp_bind(): set request timeout 86400000 msecs
dhcp_bind(): t1 renewal timer 43200 secs
dhcp_bind(): set request timeout 43200000 msecs
dhcp_bind(): t2 rebind timer 75600 secs
dhcp_bind(): set request timeout 75600000 msecs
dhcp_bind(): IP: 0x2d05a8c0 SN: 0x00ffffff GW: 0x0105a8c0
dhcp_bind(): dhcp state is BOUND
I (1522) esp_netif_handlers: sta ip: 192.168.5.45, mask: 255.255.255.0, gw: 192.168.5.1
E (1532) app_main: ip_event_handler 0
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()

This is the output of enable spiram:

I (1372) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1382) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (1432) wifi:wifi driver task: 3ffcb63c, prio:23, stack:6656, core=0
I (1432) system_api: Base MAC address is not set
I (1432) system_api: read default base MAC address from EFUSE
I (1442) wifi:wifi firmware version: 63017e0
I (1442) wifi:wifi certification version: v7.0
I (1442) wifi:config NVS flash: enabled
I (1452) wifi:config nano formating: disabled
I (1452) wifi:Init data frame dynamic rx buffer num: 32
I (1462) wifi:Init management frame dynamic rx buffer num: 32
I (1462) wifi:Init management short buffer num: 32
I (1472) wifi:Init static tx buffer num: 32
I (1472) wifi:Init tx cache buffer num: 32
I (1472) wifi:Init static rx buffer size: 1600
I (1482) wifi:Init static rx buffer num: 10
I (1482) wifi:Init dynamic rx buffer num: 32
I (1492) wifi_init: rx ba win: 6
I (1492) wifi_init: tcpip mbox: 32
I (1492) wifi_init: udp mbox: 6
I (1502) wifi_init: tcp mbox: 6
I (1502) wifi_init: tcp tx win: 5744
I (1502) wifi_init: tcp rx win: 5744
I (1512) wifi_init: tcp mss: 1440
I (1512) wifi_init: WiFi IRAM OP enabled
I (1522) wifi_init: WiFi RX IRAM OP enabled
I (1522) wifi:Set ps type: 0

I (1532) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (1612) wifi:mode : sta (bc:dd:c2:cf:f0:f4)
I (1612) wifi:enable tsf
E (1612) app_main: wifi_event_handler 2
I (1622) ESPNOW: espnow [version: 1.0] init
I (1622) wifi:new:<6,2>, old:<1,0>, ap:<255,255>, sta:<6,2>, prof:2
I (1622) wifi:state: init -> auth (b0)
I (1642) wifi:state: auth -> assoc (0)
I (1662) wifi:state: assoc -> run (10)
I (1692) wifi:connected with ChinaNet-2.4G-3648, aid = 1, channel 6, 40D, bssid = d8:32:14:db:36:49
I (1692) wifi:security: WPA2-PSK, phy: bgn, rssi: -52
I (1692) wifi:pm start, type: 0

dhcp_start(netif=0x3ffbd47c) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
E (1732) app_main: wifi_event_handler 4
I (1732) wifi:AP's beacon interval = 102400 us, DTIM period = 3
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 1000 msecs
I (2332) app_main: espnow_recv, <0> [94:e6:86:48:82:74][6][-48][5]: hello
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 2000 msecs
dhcp_coarse_tmr()
dhcp_coarse_tmr()
W (4442) wifi:<ba-add>idx:0 (ifx:0, d8:32:14:db:36:49), tid:0, ssn:2, winSize:64
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 4000 msecs
dhcp_coarse_tmr()
dhcp_coarse_tmr()
W (6782) wifi:<ba-add>idx:1 (ifx:0, d8:32:14:db:36:49), tid:6, ssn:0, winSize:64
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 8000 msecs
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
I (12332) app_main: espnow_recv, <1> [94:e6:86:48:82:74][6][-38][5]: hello
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
I (22332) app_main: espnow_recv, <2> [94:e6:86:48:82:74][6][-51][5]: hello
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
I (32342) app_main: espnow_recv, <3> [94:e6:86:48:82:74][6][-44][5]: hello
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
I (42342) app_main: espnow_recv, <4> [94:e6:86:48:82:74][6][-49][5]: hello
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
I (52342) app_main: espnow_recv, <5> [94:e6:86:48:82:74][6][-47][5]: hello
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
I (62342) app_main: espnow_recv, <6> [94:e6:86:48:82:74][6][-50][5]: hello
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
I (72342) app_main: espnow_recv, <7> [94:e6:86:48:82:74][6][-43][5]: hello
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
transaction id xid(5a53c937)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()

is comunication is low power?

When I use the program related to this technology, the device gets hot, it seems to consume a lot of power, and for this reason, it gets hot. Does this connection really consume low power?
so why device gets hot after few mins

Update support for idf5.0

When I compiled using the master branch of ESP-IDF, I found it had a lot of errors, I thought it was necessary to gradually start supporting IDF5.0
Snipaste_2022-05-19_19-54-36
Snipaste_2022-05-19_19-54-42

ESP32 to ESP01 not work (AEGHB-24)

Hello! I have two boards. Esp32 transmitter and Esp-01 receiver. I work through the ESPNOW protocol. Packets are not coming, I can't figure out what the problem is. Esp-01 receiver and esp8266 Dev mode work and receive with each other. Help me kindly.

`/*********
Rui Santos
Complete project details at https://RandomNerdTutorials.com/esp-now-one-to-many-esp32-esp8266/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*********/

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

//Structure example to receive data
//Must match the sender structure
typedef struct test_struct {
int x;
int y;
} test_struct;

//Create a struct_message called myData
test_struct myData;

//callback function that will be executed when data is received
void OnDataRecv(uint8_t * mac, uint8_t *incomingData, uint8_t len) {
memcpy(&myData, incomingData, sizeof(myData));
Serial.print("Bytes received: ");
Serial.println(len);
Serial.print("x: ");
Serial.println(myData.x);
Serial.print("y: ");
Serial.println(myData.y);
Serial.println();
}

void setup() {
//Initialize Serial Monitor
Serial.begin(115200);

//Set device as a Wi-Fi Station
WiFi.mode(WIFI_STA);
WiFi.disconnect();

//Init ESP-NOW
if (esp_now_init() != 0) {
Serial.println("Error initializing ESP-NOW");
return;
}

// Once ESPNow is successfully Init, we will register for recv CB to
// get recv packer info
esp_now_set_self_role(ESP_NOW_ROLE_SLAVE);
esp_now_register_recv_cb(OnDataRecv);
}

void loop() {

}`

and TX

`/*********
Rui Santos
Complete project details at https://RandomNerdTutorials.com/esp-now-one-to-many-esp32-esp8266/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*********/

#include <WiFi.h>
#include <esp_now.h>

// REPLACE WITH YOUR ESP RECEIVER'S MAC ADDRESS
uint8_t broadcastAddress1[] = {0xC4, 0x5B, 0xBE, 0x73, 0xF9, 0xC0};

typedef struct test_struct {
int x;
int y;
} test_struct;

void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
char macStr[18];
Serial.print("Packet to: ");
// Copies the sender mac address to a string
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print(macStr);
Serial.print(" send status:\t");
Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
}

void setup() {

Serial.begin(115200);

WiFi.mode(WIFI_STA);

if (esp_now_init() != ESP_OK) {
Serial.println("Error initializing ESP-NOW");
return;
}

esp_now_register_send_cb(OnDataSent);

// register peer
esp_now_peer_info_t peerInfo;
peerInfo.channel = 0;
peerInfo.encrypt = false;

memcpy(peerInfo.peer_addr, broadcastAddress1, 6);
if (esp_now_add_peer(&peerInfo) != ESP_OK){
Serial.println("Failed to add peer");
return;
}

}

void loop() {
test_struct test;
test_struct test2;
test_struct test3;
test.x = random(0,20);
test.y = random(0,20);
test2.x = random(0,20);
test2.y = random(0,20);
test3.x = random(0,20);
test3.y = random(0,20);

esp_err_t result1 = esp_now_send(
broadcastAddress1,
(uint8_t *) &test,
sizeof(test_struct));

if (result1 == ESP_OK) {
Serial.println("Sent with success");
}
else {
Serial.println("Error sending the data");
}
delay(500);

}`

Problem in connecting ESPNOW to BLYNK (AEGHB-31)

Hi, I want to send an int value from ESP 8266 to ESP 32 using the ESP NOW protocol.
But when I use this protocol (ESP NOW) in (((blynk))) I can not find any value

This is my ESP 32(Is connected to blynk) code
https://pastebin.com/pzLcsNtn

This is my ESP 8266code
https://pastebin.com/3MxVxrb5

I can not access the variable sent by ESP 8266 when I use BLYNK
I’m sure my ESP NOW protocol is working properly because when I use the following code in ESP 32 everything is fine

Note: I can send commands from ESP 32 to ESP 8266 with this protocol. But I can not do the contrary
Note: If you want to test the code, change the MAC address and BLYNK_TEMPLATE_ID

ESP code 32 without using Blink which works properly (ESPNOW protocol only)

https://pastebin.com/z3DQU7LD

Please help me

Platformio build error: 'CONFIG_ESPNOW_CHANNEL' undeclared (AEGHB-27)

Where can I correct this error?

Building in release mode
Compiling .pio\build\esp32dev\src\main.o
src/main.c: In function 'example_espnow_task':
src/main.c:225:41: error: 'CONFIG_ESPNOW_CHANNEL' undeclared (first use in this function); did you mean 'CONFIG_SPIFFS_CACHE'?
peer->channel = CONFIG_ESPNOW_CHANNEL;
^~~~~~~~~~~~~~~~~~~~~
CONFIG_SPIFFS_CACHE
src/main.c:225:41: note: each undeclared identifier is reported only once for each function it appears in
src/main.c:228:43: error: 'CONFIG_ESPNOW_LMK' undeclared (first use in this function); did you mean 'CONFIG_ESP_INT_WDT'?
memcpy(peer->lmk, CONFIG_ESPNOW_LMK, ESP_NOW_KEY_LEN);
^~~~~~~~~~~~~~~~~
CONFIG_ESP_INT_WDT
In file included from C:/Users/L_D/.platformio/packages/framework-espidf/components/esp_timer/include/esp_timer.h:44,
from C:/Users/L_D/.platformio/packages/framework-espidf/components/freertos/xtensa/include/freertos/portmacro.h:84,
from C:/Users/L_D/.platformio/packages/framework-espidf/components/freertos/include/freertos/portable.h:95,
from C:/Users/L_D/.platformio/packages/framework-espidf/components/freertos/include/freertos/FreeRTOS.h:107,
from src/main.c:19:
src/main.c: In function 'example_espnow_init':
src/main.c:301:49: error: 'CONFIG_ESPNOW_PMK' undeclared (first use in this function); did you mean 'CONFIG_ESP_INT_WDT'?
ESP_ERROR_CHECK( esp_now_set_pmk((uint8_t *)CONFIG_ESPNOW_PMK) );
^~~~~~~~~~~~~~~~~
C:/Users/L_D/.platformio/packages/framework-espidf/components/esp_common/include/esp_err.h:118:31: note: in definition of macro 'ESP_ERROR_CHECK'
esp_err_t __err_rc = (x);
^
src/main.c:312:21: error: 'CONFIG_ESPNOW_CHANNEL' undeclared (first use in this function); did you mean 'CONFIG_SPIFFS_CACHE'?
peer->channel = CONFIG_ESPNOW_CHANNEL;
^~~~~~~~~~~~~~~~~~~~~
CONFIG_SPIFFS_CACHE
src/main.c:332:25: error: 'CONFIG_ESPNOW_SEND_COUNT' undeclared (first use in this function); did you mean 'CONFIG_ESP32_REV_MIN'?
send_param->count = CONFIG_ESPNOW_SEND_COUNT;
^~~~~~~~~~~~~~~~~~~~~~~~
CONFIG_ESP32_REV_MIN
src/main.c:333:25: error: 'CONFIG_ESPNOW_SEND_DELAY' undeclared (first use in this function); did you mean 'CONFIG_ESP32_REV_MIN_0'?
send_param->delay = CONFIG_ESPNOW_SEND_DELAY;
^~~~~~~~~~~~~~~~~~~~~~~~
CONFIG_ESP32_REV_MIN_0
src/main.c:334:23: error: 'CONFIG_ESPNOW_SEND_LEN' undeclared (first use in this function); did you mean 'CONFIG_ESP32_REV_MIN'?
send_param->len = CONFIG_ESPNOW_SEND_LEN;
^~~~~~~~~~~~~~~~~~~~~~
CONFIG_ESP32_REV_MIN

Developing a many-to-many network?

Hello! I've watched the official video on ESP-Now (https://www.youtube.com/watch?v=QmvMtgNs9r8) and have a few questions about the details:

  • The example in the video shows a one-to-many relationship between devices, where a single keypad is changing 255 lights. Is it possible to design the network so that the nodes are all peer to each other and any node can send a message to any other node?

  • How many devices can be paired together into a many-to-many network? The video shows 255 lights but the documentation talks about keeping peers under 20 devices.

  • Can new devices be paired with the entire network at once, or do I have to pair the new device individually with each existing device? As in, can a new device be paired once and quickly become "aware" of the entire network of devices and start sending messages to them even if they weren't directly paired?

  • At 4 minutes 22 seconds in the video they mention developing a multi-hop network, but I haven't been able to find anything about this in the documentation. How does the multi-hop network functionality work?

  • Lastly, at 6 minutes and 31 seconds they show a web interface for debugging. Is it possible to get that web interface? I don't see the source for it anywhere.

Thanks for your help!

provisioning example problem (AEGHB-30)

Hi, I have problem trying the provisioning example, the initiator works fine and able to retrieve the ssid/pass from the responder for the first 3 tries (manually resets for the testing purpose) , but after about 4 or 5 times, it shows the following warning and unable to retrieve ssid info, does anyone know what the problem might be? Thanks!

W (845) espnow_prov: [espnow_prov_initator_recv, 123]: recv_data->type != ESPNOW_PROV_TYPE_WIFI: 0

provisioning

The responder seems stopped working, but no error message, works again after reset, but same thing happened

espnow_deinit example request

Hi, I'd like to call the espnow_deinit() to release the resources once I'm done with the protocol
Do you have a working example to show how it can be done?
If I call it directly, it will panic

assert failed: vQueueDelete queue.c:2140 (pxQueue)

Caused by this line

vQueueDelete(tmp_queue);

Ota (AEGHB-33)

I would like to ask about the ota project. This project works in such a way that if we upload the hello world to the responder, for example, it is no longer possible to update the responder to another project?

can a new uploaded program run on the responder at once so that each time the responder responds, the bootloader looks to see if an update from the initiator is available?

Bind Limit of 20 (AEGHB-8)

Hi, can you explain exactly what limits the pairing of devices to a maximum of 20 ?. If I need to communicate with more than 20 devices without using broadcast, is there a mechanism to do this ?
Many Thanks.

use ESP-now and ADC at the same time (AEGHB-36)

Hi there,

I try to send unidirectional ESP32 ADC2 (and other) data continuously to a second ESP32.
The ADC does not return data if ESP-now is enabled.
As far as I know is that ADC2 is used by the Wi-Fi driver and must be disabled to read ADC samples.

I tried to disable wifi:
esp_wifi_stop();
read data:
esp_err_t r = adc2_get_raw(ADC2_CHANNEL_3, ADC_WIDTH_12Bit, &data[0]);
and re-start the WiFi front-end
esp_wifi_start();

It works but it takes quite some time.
Without stopping/starting WiFi I can easily meet my timing constrain of sending data every 10ms. With it, it needs at least 70ms which is too much for my application.

Is it possible to disable/enable the front-end differently/faster?

Thanks!

ESP limit in broadcast (AEGHB-14)

In broadcast mode, can I assume the 20 peer limit is not in place? After all, no need to store Ack info and Acks are not sent from any peers other than one from the sender itself(which also sees the broadcast message)

ESP-Now Mesh

Hello.

I found out about ESP-Now a few weeks ago and since then I've been testing out the functionality with great success. This mode of communication with the ranges that can be achieved opens a lot of doors for new projects.

Now to further extend the range one would probably need a type of repeater node between nodes that send data and nodes that receive data. And if you then want 2 way communication between the start and end nodes the picture starts looking like a mesh network.

Is mesh networking possible with ESP-Now? And if so how would one build this network of ESP-Now devices?

image

I was able to establish 2 way communication with Sender devices and Receiver device without defining mac addresses on any devices and also without the Repeater devices. I figured that defining mac addresses on any device would be nightmare to maintain if any of the devices were to break. By using the SSID's of the devices to establish a connection I think is a better way to go.

Most examples only show communication between Sender devices and Receiver devices and they also define the mac addresses. This will not work well for the project I have in mind.

So my question is:

Can "Sender 1" then send data to "Receiver" by using the SSID and have it find the best route to take and have "Receiver" send data back to "Sender 1" and have it find the best route to take? Ideally they would then use a "Repeater" to get the job done.

Esp 8266 (AEGHB-40)

I am trying to have a duplex communication with an esp32 and an esp8266-01.

Is it supported? Or just communications between esp32s?

Having esp-now run on Linux (like Raspberry Pi). (AEGHB-26)

I really like the esp-now protocol. At this moment you can only talk between esp's and for some long time i would love to see a solution to my raspberry pi as well.

Therefor i have a small request could you build something that allows the PI directly to the esp-now protocol. I know there was a team that started creating something like that but i never got it working for me.

Are you willing to create something like this? I think it would make esp-now more useful in the future.

Is ESP-NOW Usable in EU ? (AEGHB-37)

Can I use this protocol in EU zone ISM bands without decreasing the transmission power ? I think the physical layer is 802.11 b/g/n. Hence, the protocol should comply with the regulations such as FHSS and e.i.r.p. Thank you.

Bind by RSSI example (AEGHB-261)

Hi, thank you for the library!
In the promote video shows that the bind is set to within the 4cm RSSI range, could you show where I can find the example of it?
I'm testing the control example with 3 C3 dev boards, but doesn't show this feature.

Thanks!

Screen Shot 2021-09-25 at 11 46 15 PM

How to create the continous responder task ??

Hello,

  1. I have multiple initiator which initiate initiator task at different times. I want to one responder which respond continuously to every initiator and vice-versa. I tried to create the task which only response but It now working. Can you guys tell me how do i achieve this ?

  2. Instead of using the protocomm to create the device private and public for secure connection at run time, I want to use the my own prv and pub key to secure connection. How can I do this??

Light_Pwm example crashes on esp32

Hi,

I am trying to get the light pwm example working a normal esp32 but it keeps crashing with the attached log. I am using esp idf 4.4. I also tried turning the wdt off, but that did not help.

Is there anything I'm missing?

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:7044
load:0x40078000,len:15548
load:0x40080400,len:4284
0x40080400: _init at ??:?

entry 0x40080680
I (27) boot: ESP-IDF v4.4-dev-3703-gddc44956bf 2nd stage bootloader
I (27) boot: compile time 15:51:56
I (27) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) qio_mode: Enabling default flash chip QIO
I (44) boot.esp32: SPI Speed      : 80MHz
I (49) boot.esp32: SPI Mode       : QIO
I (53) boot.esp32: SPI Flash Size : 4MB
I (58) boot: Enabling RNG early entropy source...
I (63) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (74) boot:  0 nvs              WiFi data        01 02 0000d000 00008000
I (81) boot:  1 fctry            WiFi data        01 02 00015000 00004000
I (89) boot:  2 log_status       WiFi data        01 02 00019000 00004000
I (96) boot:  3 otadata          OTA data         01 00 0001d000 00002000
I (104) boot:  4 phy_init         RF data          01 01 0001f000 00001000
I (111) boot:  5 ota_0            OTA app          00 10 00020000 001d0000
I (119) boot:  6 ota_1            OTA app          00 11 001f0000 001d0000
I (126) boot:  7 coredump         Unknown data     01 03 003c0000 00010000
I (134) boot:  8 log_info         Unknown data     01 fe 003d0000 00010000
I (142) boot:  9 reserved         Unknown data     01 ff 003e0000 00020000
I (149) boot: End of partition table
I (153) boot_comm: chip revision: 1, min. application chip revision: 0
I (161) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=1a7f4h (108532) map
I (199) esp_image: segment 1: paddr=0003a81c vaddr=3ffb0000 size=04454h ( 17492) load
I (205) esp_image: segment 2: paddr=0003ec78 vaddr=40080000 size=013a0h (  5024) load
I (207) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=8d2b0h (578224) map
I (373) esp_image: segment 4: paddr=000cd2d8 vaddr=400813a0 size=14a6ch ( 84588) load
I (400) esp_image: segment 5: paddr=000e1d4c vaddr=50000000 size=00010h (    16) load
I (411) boot: Loaded app from partition at offset 0x20000
I (412) boot: Disabling RNG early entropy source...
I (423) cpu_start: Pro cpu up.
I (423) cpu_start: Single core mode
I (431) cpu_start: Pro cpu start user code
I (431) cpu_start: cpu freq: 160000000
I (431) cpu_start: Application information:
I (436) cpu_start: Project name:     light_pwm
I (441) cpu_start: App version:      e5a13ba
I (446) cpu_start: Compile time:     Dec  6 2021 15:51:51
I (452) cpu_start: ELF file SHA256:  3dcb7f2f72010677...
I (458) cpu_start: ESP-IDF:          v4.4-dev-3703-gddc44956bf
I (465) heap_init: Initializing. RAM available for dynamic allocation:
I (472) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (478) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (484) heap_init: At 3FFB88E8 len 00027718 (157 KiB): DRAM
I (490) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (497) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (503) heap_init: At 40095E0C len 0000A1F4 (40 KiB): IRAM
I (510) spi_flash: detected chip: generic
I (514) spi_flash: flash io: qio
I (518) esp_core_dump_uart: Init core dump to UART
I (523) cpu_start: Starting scheduler on PRO CPU.
E (543) esp_ota_ops: Rollback is not possible, do not have any suitable apps in slots
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:7044
load:0x40078000,len:15548
load:0x40080400,len:4284
0x40080400: _init at ??:?

entry 0x40080680
I (54) boot: ESP-IDF v4.4-dev-3703-gddc44956bf 2nd stage bootloader
I (54) boot: compile time 15:51:56
I (54) boot: chip revision: 1
I (59) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (66) qio_mode: Enabling default flash chip QIO
I (71) boot.esp32: SPI Speed      : 80MHz
I (76) boot.esp32: SPI Mode       : QIO
I (80) boot.esp32: SPI Flash Size : 4MB
W (85) boot.esp32: PRO CPU has been reset by WDT.
W (90) boot.esp32: WDT reset info: PRO CPU PC=0x4008148d
0x4008148d: panicHandler at /home/rubikscraft/esp/esp-idf/components/esp_system/port/panic_handler.c:213

I (96) boot: Enabling RNG early entropy source...
I (102) boot: Partition Table:
I (105) boot: ## Label            Usage          Type ST Offset   Length
I (113) boot:  0 nvs              WiFi data        01 02 0000d000 00008000
I (120) boot:  1 fctry            WiFi data        01 02 00015000 00004000
I (128) boot:  2 log_status       WiFi data        01 02 00019000 00004000
I (136) boot:  3 otadata          OTA data         01 00 0001d000 00002000
I (143) boot:  4 phy_init         RF data          01 01 0001f000 00001000
I (151) boot:  5 ota_0            OTA app          00 10 00020000 001d0000
I (158) boot:  6 ota_1            OTA app          00 11 001f0000 001d0000
I (166) boot:  7 coredump         Unknown data     01 03 003c0000 00010000
I (173) boot:  8 log_info         Unknown data     01 fe 003d0000 00010000
I (181) boot:  9 reserved         Unknown data     01 ff 003e0000 00020000
I (188) boot: End of partition table
I (193) boot_comm: chip revision: 1, min. application chip revision: 0
I (200) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=1a7f4h (108532) map
I (238) esp_image: segment 1: paddr=0003a81c vaddr=3ffb0000 size=04454h ( 17492) load
I (244) esp_image: segment 2: paddr=0003ec78 vaddr=40080000 size=013a0h (  5024) load
I (246) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=8d2b0h (578224) map
I (412) esp_image: segment 4: paddr=000cd2d8 vaddr=400813a0 size=14a6ch ( 84588) load
I (440) esp_image: segment 5: paddr=000e1d4c vaddr=50000000 size=00010h (    16) load
I (451) boot: Loaded app from partition at offset 0x20000
I (451) boot: Disabling RNG early entropy source...
I (462) cpu_start: Pro cpu up.
I (462) cpu_start: Single core mode
I (470) cpu_start: Pro cpu start user code
I (470) cpu_start: cpu freq: 160000000
I (471) cpu_start: Application information:
I (475) cpu_start: Project name:     light_pwm
I (480) cpu_start: App version:      e5a13ba
I (485) cpu_start: Compile time:     Dec  6 2021 15:51:51
I (491) cpu_start: ELF file SHA256:  3dcb7f2f72010677...
I (497) cpu_start: ESP-IDF:          v4.4-dev-3703-gddc44956bf
I (504) heap_init: Initializing. RAM available for dynamic allocation:
I (511) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (517) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (523) heap_init: At 3FFB88E8 len 00027718 (157 KiB): DRAM
I (530) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (536) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (542) heap_init: At 40095E0C len 0000A1F4 (40 KiB): IRAM
I (549) spi_flash: detected chip: generic
I (553) spi_flash: flash io: qio
I (557) esp_core_dump_uart: Init core dump to UART
I (563) cpu_start: Starting scheduler on PRO CPU.
E (582) esp_ota_ops: Rollback is not possible, do not have any suitable apps in slots

Broadcasting to our own network only

Hello,

I was going through the get started example, just want to know how to broadcast message to out own private group. Suppose I have some devices working on esp now and my neighbour would have some devices working on esp now. How the these two network will be separated? Each network will be able to decode only its netwok messages.
Thanks!

uint32_t vs int issue

Trying to compile esp-now with 5.1 fails due to ticks etc now being uint32_t instead of int's. Is this in the "fixing pipeline"?

Callback on send set but never gets called? (AEGHB-167)

I have two devices, a Wemos BT with battery (aka wemosbat in PlatformIO), and a Wemos D1 R32, with the wemosbat to send a message to the R32 whenever a switch is closed on an input. The wemosbat is the "Pedal" (switch) and the D1 R32 is the "Pump". The wemosbat is the AP and the D1 R32 the STA.

Both fire up, connect, at least between the STA and the AP (I've used this scheme plenty of times for MQTT work but not with ESPNow - first time). However, while I set the callback on send, it never gets called?

Both use:

void InitESPNow(void) {
  //If the initialization was successful
  if (esp_now_init() == ESP_OK) {
    Serial.println("\nESPNow Init Success");
  }
  //If there was an error
  else {
    Serial.println("ESPNow Init Failed");
    ESP.restart();
  }
}

PEDAL

The callback on send is simple and aims to set a flag locally if the callback is successful, since that hints to the PEDAL that the PUMP is present.

void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {

  Serial.println("Sent to pump"); 

  if (status == ESP_NOW_SEND_SUCCESS) {
    Serial.println( "Delivery Success");
    pumpPresence = PUMP_PRESENT;
  } else {
    Serial.println( "Delivery Fail");
    pumpPresence = PUMP_UNAVAILABLE;
  }
}

Setup reports ESPNow initialise and peer attached.

IPAddress local_ip(192,168,4,100);  // set IP of AP device
IPAddress gateway(192,168,4,1);
IPAddress subnet(255,255,255,0);

// ESP-NOW message for pump
uint8_t pumpAddress[] = {0x84, 0xCC, 0xA8, 0x2C, 0x0D, 0xA8};

// setup device
void setup() {
  Serial.begin(115200);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    return;
  }
  
  // setup access point
  WiFi.mode(WIFI_AP);
  delay(1500);
  WiFi.softAPConfig(local_ip, gateway, subnet);
  WiFi.softAP(ssid, password /* , channel, hide_SSID, max_connection*/);
  delay(1500);
  Serial.print("\nMAC: ");
  Serial.println(WiFi.macAddress());

  // start ESP-NOW
  InitESPNow();

  esp_err_t cbstatus = esp_now_register_send_cb(OnDataSent);

  switch (cbstatus)
  {
  case ESP_OK:
    Serial.println("cb registered");
    break;

  case ESP_ERR_ESPNOW_NOT_INIT:
    Serial.println("ESP NOW not actually initiated");
    break;

  case ESP_ERR_ESPNOW_INTERNAL:
    Serial.println("ESP NOW internal error");
    break;

  default:
    Serial.println("Unknown error in cb registration");
    break;
  }

  // setup pedal input
  bounce.attach( BOUNCE_PIN ,  INPUT );
  bounce.interval(5); // interval in ms
  displayUpdate(bounce.read(),pumpPresence);

  // LED SETUP
  int ledState = HIGH;
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, ledState);

  // add peer
  memcpy(peerInfo.peer_addr, pumpAddress, 6);
  peerInfo.channel = 0;  
  peerInfo.encrypt = false;
          
  if (esp_now_add_peer(&peerInfo) != ESP_OK){
    Serial.println("Failed to add peer");
    return;
  } else {
    Serial.println("peer added");

  }

}

The main loop will halt and report no PUMP.

void findPump (void) {
  while (not pumpPresence) {
    pumpMessage.pumpFlag_msg = PUMP_CONNECT;

    esp_err_t result = esp_now_send(pumpAddress, (uint8_t *) &pumpMessage, sizeof(pumpMessage));
   
    if (result == ESP_OK) {
      Serial.println("Find pump success");
      pumpPresence = PUMP_PRESENT;
    }
    else {
      Serial.println("Pump not there");
      pumpPresence = PUMP_UNAVAILABLE;
      delay(2000);
    }
  }
}

// forever do
void loop() {

  findPump();

  ...
}

It is iffy currently, having the PUMP PRESENCE set both in callback and findPump, but I am still trying to understand where is best to do this. I am assuming it will be in the callback, but as I am stuck presently, with the callback not firing, this is something to address once the callback is working.

Console reports at start up, so no debug message from callback and PUMP PRESENCE is never set to true:

MAC: 80:7D:3A:A3:F9:58
ESPNow Init Success
cb registered
peer added
Pump not there
Pump not there
Pump not there

...

PUMP

Pump sets up with:

IPAddress local_IP(192, 168, 4, 110);
IPAddress gateway(192, 168, 4, 1);
IPAddress subnet(255, 255, 255, 0);

// setup device
void setup() {
  Serial.begin(115200);
  
  // setup access point
  WiFi.mode(WIFI_STA);

  if (!WiFi.config(local_IP, gateway, subnet)) {
    Serial.println("STA Failed to configure");
  } else {
    Serial.print("STA configure as local IP: ");
    Serial.print(local_IP);
    Serial.print(" gateway: ");
    Serial.print(gateway);
    Serial.print(" subnset: ");
    Serial.println(subnet);
  }
  
  WiFi.begin(ssid, password);

  while(WiFi.status() != WL_CONNECTED){
    Serial.print(".");
    delay(100);
  }   

  Serial.print("\nMAC: ");
  Serial.println(WiFi.macAddress());

  // start ESP-NOW
  InitESPNow();

  esp_now_register_recv_cb(OnDataRecv);

  // LED SETUP
  int ledState = HIGH;
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, ledState);

}

Console reports:

STA configure as local IP: 192.168.4.110 gateway: 192.168.4.1 subnset: 255.255.255.0
.
 MAC: 84:CC:A8:2C:0D:A8

ESPNow Init Success

The single "." indicating STA finding and connecting to AP. MAC address of pedal matches that embedded in PEDAL code. ESPNOW inits. No callback onReceive raised.

void OnDataRecv(const uint8_t * mac_addr, const uint8_t *incomingData, int len) {
  
  Serial.print(" Pedal press received "); 
  
  memcpy(&pumpMessage, incomingData, sizeof(pumpMessage));
  Serial.print("\r\nLast Packet Send Status:\t");

  if (not pumpMessage.pumpFlag_msg) {
    Serial.println( "Pedal first contact");
  }
  else {
    Serial.println( "Pedal pressed");
    togglePumpFlag = !togglePumpFlag;
  } 
}

UPSHOT

If this were simply subnets not set up properly, I would assume I would happily be receiving send callback indicating unsuccessful send.

ESP long range mode persists on flash, erase, and reset!!! (AEGHB-34)

I spent 2 weeks struggling to figure out that ESP32 if you turn on long range mode, it will break your wifi, even after your erase the chip and put new firmware on that is not in long range mode. It will persist on power cycle, I feel this is NOT OBVIOUS!!!! it needs to be addressed in the manual or fixed.

WiFi.mode(WIFI_STA);
esp_wifi_set_protocol( WIFI_IF_STA, WIFI_PROTOCOL_LR ); //this will double range but half packet rate

and to fix the problem, even after turn off/on, before you attempt to use wifi again, you MUST do this

WiFi.disconnect(true); //required to change modes
WiFi.mode(WIFI_STA);
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);

Hi guys what app are you using ? (AEGHB-29)

hi guys i have started dev on the esp mesh etc but that project looks abandoned? so I'm looking into esp now what app do you guys use it looks like the same as the app for esp mesh?

and if it is another app where is the source code?

Problem with wireless_debug

please how do i connect two esp32 devices in this example? how to insert the added pairing code there? is it necessary to insert the added code into both devices? how do you set menucofig? from that tutorial it's not clear to me how to pair two devices.

How to setup in PlatformIO

Hello

I use PlatformIO for my ESP32
projects, with arduino-espressif32.
I'm trying to find a way to filter Esp Now connections somehow related to signal strength, and then I find this repo...

What I need to understand is how to setup this esp-now repo in my projects, to use the "filter_weak_signal" option!

I hope someone help me :/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.