Ankita
Ankita

Reputation: 11

ESP8266 - Exception(29) StoreProhibited

Friends I am working on NodeMCU v3 using MQTT Protocol. The client gets Connected and when I send a long message there arises a expection 29.

My code is :

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char* ssid = "ABCDEFG";
const char* password = "Hello12345";
const char* mqtt_server = "broker.mqtt-dashboard.com";
WiFiClient espClient;
PubSubClient client(espClient);
void setup_wifi() {
   delay(100);
  // We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) 
{
  delay(500);
  Serial.print(".");
}
  randomSeed(micros());
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
 }

  void callback(char* topic, byte* payload, unsigned int length) 
{
  Serial.print("Command is : [");
  Serial.print(topic);
  Serial.print("]");
  for (int i=0;i<length;i++) {
   Serial.print((char)payload[i]);
  }
} 

void reconnect() {
    while (!client.connected()) 
  {
    Serial.print("Attempting MQTT connection...");
    // Create a random client ID
    String clientId = "ESP8266Client-";
    clientId += String(random(0xffff), HEX);
    if (client.connect(clientId.c_str()))
    {
      Serial.println("connected");
     //once connected to MQTT broker, subscribe command if any
      client.subscribe("hello_hi");
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 6 seconds before retrying
      delay(6000);
    }
  }
} 

void setup() {
 Serial.begin(115200);
 Serial.println("Setup completato...");
 setup_wifi();
 client.setServer(mqtt_server, 1883);
 client.setCallback(callback);
 }

void loop() {
  if (!client.connected()) {
   reconnect();
  }

  client.loop();
} 

I get this exception after decoding:

Exception 29: StoreProhibited: A store referenced a page mapped with an attribute that does not permit stores Decoding 2 results 0x40203376: PubSubClient::loop() at /home/softwares/arduino-1.8.2/libraries/pubsubclient/src/PubSubClient.cpp line 584

Thanks in advance.

Upvotes: 1

Views: 2456

Answers (1)

reza ghasemi
reza ghasemi

Reputation: 11

First ensure that you have good power supply on node mcu.

Also please check that your flash size setting in the IDE matches the size of the flash chip. There is a CheckFlashConfig example, please run it on your board.

Upvotes: 1

Related Questions