Board reboots when Blynk.syncAll() used

  1. Using the starter sketch Have defined 4 buttons linked to GPIO 4, 12, 13 and 14.
  2. Works well on button press as expected.
  3. Wanted to sync app and hardware. Used Blynk.syncAll(). Board reboots constantly post the setup routine.
  4. Turned on debug on serial port. Have attached debug output. Shows the same pins being restored.
  5. Have read that if global variables take more than 45% of memory, ESP8266 reboots. In my case, it is 41%.
  6. Have read that high event frequency having server data calls also causes reboots. Not high in my case either.

Have attached the debug output as a pic. Need help please. TIA

log suggests you are sending bad data i.e. ??

Do you have anything other than the 4 buttons?

Try starting a new project with the correct board type this time.

Use 115200 baud not “Arduino” 9600.

No.

  1. Changed baud to 115200. Got junk on the serial monitor. Changed it back to 9600 and was able to see readable text.
  2. Deleted the old project and created a new one. App has 4 buttons only.
  3. Saw all sync examples using Virtual pins. Attached a virtual pin to each button. In the sketch, for every Virtual pin, used pinMode to set appropriate GPIO pin for output and used digitalWrite (HIGH/LOW). Worked well.
  4. Inserted Blynk.syncAll() in setup() and the reboot started all over.

Thought it was sync of physical pins that possibly created the issue, maybe causing a reset due to GPIO16. Was not the case here. There seems to be a 30 second delay between each reboot. Is this caused by the connection timeout timer?

Change Serial Monitor to same 115200.

pinMode is not needed as it’s in the Blynk library.

Not sure what you are doing is correct. please provide more detail or post your formatted sketch.

In the Arduino IDE, I’ve chosen upload speed as 115200. I do not see a setting for serial console. Will hunt.

It’s in your sketch.

Formatted code only, backticks.

Yes. Did that earlier and got junk on the terminal. Changed it to 9600 and readable text appeared.

Sketch 115200
Serial Monitor 115200
Readable text.

Pardon my ignorance. I’ve the sketch on the IDE. I did try to copy and paste it to a reply. Has vanished. Could you educate me on what you meant in your terse message? Should I enclose the sketch within backticks?

Yes please.

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "9bfce62ec5f248e1962a0f0d135426f4";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Linksys-01750";
char pass[] = "sundaram!@#";

BLYNK_WRITE(V1)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable 
  pinMode(14, OUTPUT);
  if (pinValue) 
  {   
   digitalWrite(14, HIGH); //GPIO2
   Serial.print("\nV1 is set to ");
  Serial.print(pinValue);
  } 
  else 
  {
  digitalWrite(14, LOW); // GPIO2
  Serial.print("\nV1 is set to ");
  Serial.print(pinValue);
  }
}

BLYNK_WRITE(V2)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable 
  pinMode(12, OUTPUT);
  if (pinValue) 
  {   
   digitalWrite(12, HIGH); //GPIO2
   Serial.print("\nV2 is set to ");
  Serial.print(pinValue);
  } 
  else 
  {
  digitalWrite(12, LOW); // GPIO2
  Serial.print("\nV2 is set to ");
  Serial.print(pinValue);
  }
}

BLYNK_WRITE(V3)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable 
  pinMode(4, OUTPUT);
  if (pinValue) 
  {   
   digitalWrite(4, HIGH); //GPIO2
   Serial.print("\nV3 is set to ");
  Serial.print(pinValue);
  } 
  else 
  {
  digitalWrite(4, LOW); // GPIO2
  Serial.print("\nV3 is set to ");
  Serial.print(pinValue);
  }
}

BLYNK_WRITE(V4)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable 
  pinMode(13, OUTPUT);
  if (pinValue) 
  {   
   digitalWrite(13, HIGH); //GPIO2
   Serial.print("\nV4 is set to ");
  Serial.print(pinValue);
  } 
  else 
  {
  digitalWrite(13, LOW); // GPIO2
  Serial.print("\nV4 is set to ");
  Serial.print(pinValue);
  }
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass, IPAddress(188,166,206,43), 8442);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
  //Blynk.syncAll();
  Serial.print("Setup done");
  
}

void loop()
{
  Blynk.run();
  
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

Remove the pinMode() calls.

Please check the sync example on our examples site: https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=More%2FSync%2FSyncPhysicalButton

Blynk.syncAll or Blynk.syncVirtual should be called in BLYNK_CONNECTED and not setup

BLYNK_CONNECTED() {
  // Request the latest state from the server
  Blynk.syncVirtual(V2);

  // Alternatively, you could override server state using:
  //Blynk.virtualWrite(V2, ledState);
}
1 Like

pinmode() is not causing any issue. It works well when Blynk.syncAll() is not used.

Do you know core you are using?

2.3.0 core will not handle syncAll() but 2.4.0 is fine.

Even if Blynk.syncAll() is called from this event, the board reboots.

How do I figure this out? Should I ask the board manufacturer?

It’s software not hardware so the manufacturer will not know.

In IDE, File, Preference and paste here the url that you see.