Go Down

Topic: ESP8266 .c_str() problem (Read 242 times) previous topic - next topic

gunahmt

May 25, 2018, 12:50 pm Last Edit: May 25, 2018, 01:23 pm by gunahmt
Hi everyone

I use arduino idle for programming ESP8266. I want to take wifi name and password from serial port and save in eeprom. I took data from serial port and storaged it correctly but when i tried to send data to wifi.begin(string.c_str(),string.c_str()), esp8266 stuck there and sent error messages then it reboot itself. Here you may finde the code

Code: [Select]

int connectWifi(){
    WiFi.mode(WIFI_STA);
    String ssid;
    String password;
    char i,ssid_length,password_length;
    ssid_length = char(EEPROM.read(30));
    password_length = char(EEPROM.read(70));
    for(i = 0;i<ssid_length;i++){
        ssid+= char(EEPROM.read(i));
      }
    for(i = 0;i<password_length;i++){
        password+= char(EEPROM.read(i+40));
      }
    WiFi.begin(ssid.c_str(),password.c_str()); // there is esp8266 blowing up
    Serial.println("Connecting to ");
    Serial.print(ssid);
    i = 0;
    while (WiFi.status() != WL_CONNECTED && i<10) {
        delay(500);
        Serial.print(".");
        i++;
    }
}

 
Thats the error message on serial port:

Code: [Select]

Exception (3):
epc1=0x401003e9 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4004b541 depc=0x00000000

ctx: cont
sp: 3ffefaa0 end: 3ffeff00 offset: 01a0

>>>stack>>>
3ffefc40:  feefeffe feefeffe feefeffe feefeffe 
3ffefc50:  feefeffe feefeffe feefeffe 3ffefde0 
3ffefc60:  0000049c 0000049c 0000007d 401004f4 
3ffefc70:  40004b31 00001000 0000007d 40106ec0 
3ffefc80:  40105aac feefeffe feefeffe 4022b8bd 
3ffefc90:  40106719 4022b9a7 3fff0edc 0000049c 
3ffefca0:  0000007d 3ffefde0 3fff0edc 4022b98a 
3ffefcb0:  ffffff00 55aa55aa 00000012 00000020 
3ffefcc0:  00000020 000000ee 0000000b aa55aa55 
3ffefcd0:  0000007f 4022be74 3fff0edc 3fff0edc 
3ffefce0:  000000ff feefeffe feefeffe feefeffe 
3ffefcf0:  40106719 00000001 3fff0eec 4022c08e 
3ffefd00:  00000008 3fff0edc 000000ff 3ffefde0 
3ffefd10:  3ffefe00 3fff0f13 00000012 00000020 
3ffefd20:  3fff0f9c 3ffefe41 00000001 4022c13e 
3ffefd30:  3ffefde0 40237e10 00000000 00000004 
3ffefd40:  3fff12dc 3ffefe00 3fff7214 4022c10d 
3ffefd50:  3fff0edc 4022c174 3fff097c 3fff0964 
3ffefd60:  40202887 3fff0964 3fff097c 402027b3 
3ffefd70:  31333031 31313731 31373930 30313430 
3ffefd80:  36313139 00000a00 0000015d 00000005 
3ffefd90:  30353934 32353135 34353335 36353535 
3ffefda0:  00000000 00000001 3ffe88b9 40204128 
3ffefdb0:  00000010 0000000f 3ffe8a23 00000008 
3ffefdc0:  3ffeecd8 00000010 3ffeef1c 40203761 
3ffefdd0:  f8027800 3f964420 40203c18 00000000 
3ffefde0:  616e7567 00746d68 00000000 3ffeee8c 
3ffefdf0:  00000010 00000010 00000000 4010053d 
3ffefe00:  34333231 38373635 3ffeee00 00000030 
3ffefe10:  00000000 3fffdad0 3ffeeed8 00000008 
3ffefe20:  00000010 3ffefe80 3ffefe80 402038df 
3ffefe30:  3ffe8984 00000000 3ffefe80 40203a0f 
3ffefe40:  00000000 3fffdad0 3ffefe81 00000000 
3ffefe50:  00000000 3ffeec68 00000001 40203a48 
3ffefe60:  3ffe0038 00000001 3ffe88b9 00000008 
3ffefe70:  3ffeec90 3ffeec68 00000030 40202143 
3ffefe80:  3fff097c 0000000f 00000008 3fff0964 
3ffefe90:  0000000f 00000007 3ffeeba8 4020395d 
3ffefea0:  00000006 3ffeeeac 3ffeeba8 402039d1 
3ffefeb0:  3ffe8984 3ffeeeac 3ffeeeac 00000008 
3ffefec0:  3ffeec90 3ffeeeac 3ffeeba8 402022d6 
3ffefed0:  00000000 00000000 00000001 3ffeeed8 
3ffefee0:  3fffdad0 00000000 3ffeeed0 40203c38 
3ffefef0:  feefeffe feefeffe 3ffeeee0 40100710 
<<<stack<<<

gunahmt

I solved the problem. I was chosed card Generic ESP8266 module i changed it NodeMcu 1.0. but i dont have nodemcu esp8266. lol

Go Up