Chat freely about anything...

User avatar
By J.Silva
#74576 Hello, ESP8266 keeps writing me strange messages on serial COM port.
When I upload the file I get this:


ets Jan 8 2013,rst cause:2, boot mode:(3,6)


ets Jan 8 2013,rst cause:2, boot mode:(1,6)


ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

If I reset the ESP8266 I will get constantly this type of message:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld


Here is the code we are using to write on the database:


#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
#include <MySQL_Encrypt_Sha1.h>
#include <MySQL_Packet.h>

#include <ESP8266WiFi.h> // Use this for WiFi instead of Ethernet.h


IPAddress server_addr(xxx); // IP of the MySQL *server* here
char user[] = "xxxx"; // MySQL user login username
char password[] = "xxxx"; // MySQL user login password

// Sample query
char INSERT_SQL[] = "INSERT INTO xxxx VALUE ('Hello')";

// WiFi card example
char ssid[] = "xxxxx"; // your SSID
char pass[] = "xxxxx"; // your SSID Password

WiFiClient client; // Use this for WiFi instead of EthernetClient
MySQL_Connection conn((Client *)&client);

MySQL_Cursor cursor(&conn);
This function is where I get the problem


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


// Begin WiFi section
Serial.printf("\nConnecting to %s", ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}

// print out info about the connection:
Serial.println("\nConnected to network");
Serial.print("My IP address is: ");
Serial.println(WiFi.localIP());


Serial.print("Connecting to SQL... ");
if (conn.connect(server_addr, 3306, user, password))
Serial.println("OK.");
else
Serial.println("FAILED.");

Serial.println("1\n");

}

void loop(){

if (conn.connected())
cursor.execute(INSERT_SQL);

Serial.println(".\n");
delay(5000);


}




I updated the firmware, but with putty I can not check what the firmware is, it wont let me write on command prompt. Allthough the update seems to have been successfull, the problem remains,

Please can someone help me with this?
Thank you
User avatar
By btidey
#74592 Reset problems have three primary causes.

The first two are hardware; 1) a dodgy power supply feed or decoupling, 2) not ensuring the boot mode pins GPIO0,1,15 are in the correct state at reset.

The third cause is software that does not respect the need for the background processes to get some cpu time. This will triggers a watchdog and leads to rst cause:4. Note that the software issues can be caused by library calls if the library itself is not obeying the rules.

It helps if you say what kind of hardware module you are using.
User avatar
By J.Silva
#74631 I appreciate the attention given,
Thank you for the information you shared,


Problem Solution:


#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
#include <MySQL_Encrypt_Sha1.h>
#include <MySQL_Packet.h>

#include <ESP8266WiFi.h> // Use this for WiFi instead of Ethernet.h


IPAddress server_addr(xxx); // IP of the MySQL *server* here
char user[] = "xxxx"; // MySQL user login username
char password[] = "xxxx"; // MySQL user login password

// Sample query
char INSERT_SQL[] = "INSERT INTO xxxx VALUE ('Hello')";

// WiFi card example
char ssid[] = "xxxxx"; // your SSID
char pass[] = "xxxxx"; // your SSID Password

WiFiClient client; // Use this for WiFi instead of EthernetClient
MySQL_Connection conn((Client *)&client);

MySQL_Cursor cursor(&conn);
This function is where I get the problem



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


// Begin WiFi section
Serial.printf("\nConnecting to %s", ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}

// print out info about the connection:
Serial.println("\nConnected to network");
Serial.print("My IP address is: ");
Serial.println(WiFi.localIP());


Serial.print("Connecting to SQL... ");
if (conn.connect(server_addr, 3306, user, password))
Serial.println("OK.");
else
Serial.println("FAILED.");

Serial.println("1\n");

}

void loop(){


MySQL_Cursor cursor(&conn);
By moving the function call to the loop() scope, the error was gone,


if (conn.connected())
cursor.execute(INSERT_SQL);

Serial.println(".\n");
delay(5000);


}