ESP32_DevkitC_V4 (WROVER_IE) error code 12391

djdan_23
Posts: 1
Joined: Fri Sep 16, 2022 2:39 pm

ESP32_DevkitC_V4 (WROVER_IE) error code 12391

Postby djdan_23 » Fri Sep 16, 2022 3:22 pm

Hi all!
I'm working on Arduino 1.8.13 with a setup using as ONE
Sender (ESP-32-WROVER_IE) and as receivers 4 (ESP8266 like NodeMcu-12F & Wemos D1 min pro)

I'm using the 2way communication correctly on all 3 but when I add a fourth board (ESP-32-WROOM devboardC)
I see an error in the monitor when it is, is time to send.

This is the error showing in the Sender's monitor, and of course the #4 monitor shows nothing.
"Error sending the data #4 MAC: 98:F4:AB:6:40:90 result4= 12391"
According to "https://docs.espressif.com/projects/esp ... codes.html"
the error is "ESP_ERR_ESPNOW_NO_MEM (0x3067): Out of memory"

No compiling errors on all boards

So my question #1 : How come I have this error
#2 : What can I do to resolve this one.

Thanks all for your help.
---------------------------------------------------------------------------

Code: Select all

#include <esp_now.h>             // FOR ESP-32


#ifdef ESP32
  #include <WiFi.h>
#else
  #include <ESP8266WiFi.h>
#endif


// ***************************************************************************************
//                                     SENDER
// ***************************************************************************************
//                               ESP-32 WROVER -IE         16-09-2022
//                             
//          SERVER:  MAC: {0x8C, 0x4B, 0x14, 0x15, 0x9C, 0xC8} (using ESP32 Wrover module)
// ***************************************************************************************


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

byte t;

// REPLACE WITH YOUR Receiver module MAC ADDRESS
uint8_t broadcastAddress1[] = {0xA4, 0xCF, 0x12, 0xDF, 0x10, 0x0D};   // Wemos ESP8266 mini pro #2                      SLAVE1
uint8_t broadcastAddress2[] = {0xCC, 0x50, 0xE3, 0x09, 0x66, 0xF0};    // Wemos ESP8266 mini pro #1                      SLAVE2
uint8_t broadcastAddress3[] = {0xA4, 0xCF, 0x12, 0xDD, 0xE2, 0xAB};  // NodMcu ESP-8266-12F #2                           SALVE3
uint8_t broadcastAddress4[] = {0x98, 0xF4, 0xAB, 0x06, 0x40, 0x90};    // ESP-32 (using ESP32-WROOM-DA module) SLAVE4

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


//Create a struct_message called myData
test_struct myData;


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");
  }



//callback function that will be executed when data is received
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int 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();
  }



 // ****************************************
 //  DOIT ETRE PLACÉ AVANT SETUP() ET LOOP()
 // ****************************************
 // Create a GLOBAL variable of type "esp_now_peer_info_t"
 esp_now_peer_info_t peerInfo;


 
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);
   esp_now_register_recv_cb(OnDataRecv); 


   // esp_now_del_peer

   // register peer default
   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 1");
      return;
     }
   else
     {
      Serial.println("broadcastAddress1 Registered OK"); 
     }

  
   memcpy(peerInfo.peer_addr, broadcastAddress2, 6);
   if (esp_now_add_peer(&peerInfo) != ESP_OK)
     {
      Serial.println("Failed to add peer 2");
      return;
     }
   else
     {
      Serial.println("broadcastAddress2 Registered OK"); 
     }
   
   
   memcpy(peerInfo.peer_addr, broadcastAddress3, 6);
   if (esp_now_add_peer(&peerInfo) != ESP_OK)
     {
      Serial.println("Failed to add peer 3");
      return;
     }
   else
     {
      Serial.println("broadcastAddress3 Registered OK"); 
     } 

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


     
  }
 
void loop() 
  {
   test_struct test;
   test_struct test2;
   test_struct test3;
   test_struct test4;
   
   test.x =  1; // random(0,20);
   test.y = 11; // random(0,20);
   
   test2.x = 2;
   test2.y =22;

   test3.x = 3;
   test3.y =33;

   test4.x = 4;
   test4.y =44;

   
 
   esp_err_t result1 = esp_now_send (broadcastAddress1, (uint8_t *) &test, sizeof(test_struct));
   if (result1 == ESP_OK) 
     {
      Serial.println("Sent with success #1");
     }
   else 
     {
      Serial.print("Error sending the data #1 MAC: ");
      for (t=0; t<6; t++)
        {
         Serial.print (broadcastAddress1 [t],HEX);
         Serial.print (":");
        }
       Serial.println ();   
     }
     
   delay(500);
   
   esp_err_t result2 = esp_now_send (broadcastAddress2, (uint8_t *) &test2, sizeof(test_struct));   
   if (result2 == ESP_OK) 
     {
      Serial.println("Sent with success #2");
     }
   else 
     {
      Serial.print("Error sending the data #2 MAC: ");
      for (t=0; t<6; t++)
        {
         Serial.print (broadcastAddress2 [t],HEX);
         Serial.print (":");
        }
       Serial.println ();
     }
  
   delay(500);  

   esp_err_t result3 = esp_now_send(broadcastAddress3, (uint8_t *) &test3, sizeof(test_struct));
   if (result3 == ESP_OK) 
     {
      Serial.println("Sent with success #3");
     }
   else 
     {
      Serial.print ("Error sending the data #3 MAC: ");
      for (t=0; t<6; t++)
        {
         Serial.print (broadcastAddress3 [t],HEX);
         Serial.print (":");  
        }
        Serial.println(); 
     }

   // signed int = 0 OK
   esp_err_t result4 = esp_now_send(broadcastAddress4, (uint8_t *) &test4, sizeof(test_struct));
   if (result4 == ESP_OK) 
     {
      Serial.println("Sent with success #4");
     }
   else 
     {
      Serial.print ("Error sending the data #4 MAC: ");
      for (t=0; t<6; t++)
        {
         Serial.print (broadcastAddress4 [t],HEX);
         Serial.print (":");  
        }
        Serial.print("result4= "); 
        Serial.println(result4); 
     }




  delay(2000);
  Serial.println();  
  
 }

Who is online

Users browsing this forum: Google [Bot] and 69 guests