Фатальное исключение 28 при подключении ESP8266 к серверу MySQL

#mysql #esp8266

Вопрос:

Я пытаюсь подключиться к серверу MySQL с помощью ESP8266-01s. Я могу успешно подключиться к Wi-Fi, но при выполнении if(conn.connect(server_addr, 3306, sql_user, sql_password)) я получил исключение (28) со стеком.

После расшифровки он показывает:

 Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
PC: 0x402014e4
EXCVADDR: 0x00000049

Decoding stack results
0x4010662d: cont_can_yield(cont_t*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0/tools/sdk/include/ets_sys.h line 113
0x40201537: Encrypt_SHA1::pad() at C:UsersDawidDocumentsArduinolibrariesMySQL_Connector_ArduinosrcMySQL_Encrypt_Sha1.cpp line 102
0x402038fc: can_yield() at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266core_esp8266_main.cpp line 109
0x40201524: Encrypt_SHA1::pad() at C:UsersDawidDocumentsArduinolibrariesMySQL_Connector_ArduinosrcMySQL_Encrypt_Sha1.cpp line 101
0x4020651c: Print::write(unsigned char const*, unsigned int) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266Print.cpp line 41
0x402064e8: Print::write(unsigned char const*, unsigned int) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266Print.cpp line 35
0x40202df4: Print::write(char const*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266/Print.h line 59
0x40202e18: Print::write(char const*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266/Print.h line 57
0x40202ea8: Print::print(char const*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266Print.cpp line 121
0x402018f7: MySQL_Packet::scramble_password(char*, unsigned char*) at C:UsersDawidDocumentsArduinolibrariesMySQL_Connector_ArduinosrcMySQL_Packet.cpp line 191
0x40202035: ESP8266WiFiSTAClass::begin(char const*, char const*, int, unsigned char const*, bool) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0librariesESP8266WiFisrcESP8266WiFiSTA.cpp line 208
0x40202012: ESP8266WiFiSTAClass::begin(char const*, char const*, int, unsigned char const*, bool) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0librariesESP8266WiFisrcESP8266WiFiSTA.cpp line 198
0x40100209: millis() at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266core_esp8266_wiring.cpp line 193
0x40214f72: ip4_output_if at core/ipv4/ip4.c line 1549
0x401006c3: umm_free_core(umm_heap_context_t*, void*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266umm_mallocumm_malloc.cpp line 549
0x401008a2: free(void*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266umm_mallocumm_malloc.cpp line 595
0x40100298: vPortFree(void*, char const*, int) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266heap.cpp line 322
0x402159d8: mem_free at core/mem.c line 236
0x401006c3: umm_free_core(umm_heap_context_t*, void*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266umm_mallocumm_malloc.cpp line 549
0x40201a3e: MySQL_Packet::send_authentication_packet(char*, char*, char*) at C:UsersDawidDocumentsArduinolibrariesMySQL_Connector_ArduinosrcMySQL_Packet.cpp line 135
0x402017aa: MySQL_Packet::parse_handshake_packet() at C:UsersDawidDocumentsArduinolibrariesMySQL_Connector_ArduinosrcMySQL_Packet.cpp line 352
0x402012e2: MySQL_Connection::connect(IPAddress, int, char*, char*, char*) at C:UsersDawidDocumentsArduinolibrariesMySQL_Connector_ArduinosrcMySQL_Connection.cpp line 88
0x40202b80: HardwareSerial::write(unsigned char const*, unsigned int) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266/HardwareSerial.h line 193
0x40202880: WiFiClient::connect(IPAddress, unsigned short) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0librariesESP8266WiFisrcWiFiClient.cpp line 143
0x40202e18: Print::write(char const*) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266/Print.h line 57
0x40203fe1: __delay(unsigned long) at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266core_esp8266_wiring.cpp line 55
0x40201079: connectSQL() at D:Moje dokumentyArduinoHyroponikaHydrotest/test.ino line 34
0x40201190: setup() at D:Moje dokumentyArduinoHyroponikaHydrotest/test.ino line 21
0x40203a3c: loop_wrapper() at C:UsersDawidAppDataLocalArduino15packagesesp8266hardwareesp82663.0.0coresesp8266core_esp8266_main.cpp line 198
 

Мой вывод заключается в том, что что-то пошло не так с conn.connect. Чтобы быть более точным, я просмотрел исходный файл mysql.connection. Похоже, что это сокрушительно: подключено = клиент->подключение(сервер, порт);>
Есть идеи, что я могу сделать еще?

Мой код ESP8266:

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

#include <WiFiClient.h> 


const char *ssid = "XXX";      //ENTER YOUR WIFI ssid
const char *password = "XXX";  //ENTER YOUR WIFI password

IPAddress server_addr(X,X,X,X);  // IP of the MySQL *server* here
char sql_user[] = "X";           // MySQL user login username
char sql_password[] = "X";       // MySQL user login password

WiFiClient client;
MySQL_Connection conn(amp;client);
MySQL_Cursor* cursor;

void setup() {
connectWifi();
connectSQL();
}


void loop() {
}

//function to conncectn to SQL
void connectSQL()
{
  delay(1000);
  Serial.print("Connecting to SQL...  ");
  if (conn.connect(server_addr, 3306, sql_user, sql_password)){
    Serial.println("Connected to MySQL");
   }
  else{
    Serial.println("FAILED");
    conn.close();
  }
   // create MySQL cursor object
  cursor = new MySQL_Cursor(amp;conn);
}

//function to connect to wifi
void connectWifi(){
  delay(1000);
  Serial.begin(9600);
  WiFi.mode(WIFI_OFF);        //Prevents reconnection issue (taking too long to connect)
  delay(1000);
  WiFi.mode(WIFI_STA);        //This line hides the viewing of ESP as wifi hotspot
  WiFi.begin(ssid, password);     //Connect to your WiFi router
  Serial.println("");
  Serial.print("Connecting");
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  //If connection successful show IP address in serial monitor 
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());  //IP address assigned to your ESP
}
 

Комментарии:

1. github.com/ChuckBell/MySQL_Connector_Arduino/issues/…