Fatal exception 9

Aleix
Posts: 8
Joined: Tue Mar 08, 2016 5:21 am

Fatal exception 9

Postby Aleix » Wed Nov 09, 2016 12:18 am

Hi everyone,

After extensive testing and trials, there's a persistent issue while storing a freshly received network settings. For some reason, after 6-7 write times the device starts throwing a fatal exception 9 and no further operations are possible.

I attach the code and the exception print to see if you can point us to the right direction.
Another useful info: flash size 4Mb, DIO mode part name AT25SF041

Thanks.

Code: Select all

void ICACHE_FLASH_ATTR flashmem_save_network_settings (const phoneap_network_settings_t *settings) {
/*
  struct station_config *config = (struct station_config *)os_zalloc(sizeof(struct station_config));
  os_strncpy (config->ssid, settings->ap_ssid, sizeof(settings->ap_ssid)-1);
  os_strncpy (config->password, settings->ap_wpa2_key, sizeof(settings->ap_wpa2_key)-1);
*/

  char ssid[32] = "";
  char pwd[64] = "";
  os_strncpy (ssid, settings->ap_ssid, sizeof(ssid));
  os_strncpy (pwd, settings->ap_wpa2_key, sizeof(ssid));
 
  wifi_set_opmode(STATION_MODE);
  struct station_config st_conf;
  st_conf.bssid_set = 0;
  os_memcpy (&st_conf.ssid, ssid, 32);
  os_memcpy (&st_conf.password, pwd, 64);
  //os_delay_us(500);
  //os_printf ("WILL NOW SAVE: %s, %s\r\n", st_conf.ssid, st_conf.password);

  if (wifi_station_set_config (&st_conf)) {
    os_printf ("[flashmem_save_network_settings] Saved new network settings: SSID = %s, PWD = %s\r\n", 0x3ffffe30, st_conf.password);
  }
  else {
    os_printf ("[flashmem_save_network_settings] ERROR saving new network settings: SSID = %s, PWD = %s\r\n", 0x3ffffe50, st_conf.password);
  }

}

void ICACHE_FLASH_ATTR flashmem_clear_network_settings () {

  char ssid[32] = "phoneap";
  char pwd[64] = "0000";

  struct station_config config;
  config.bssid_set = 0;
  os_memcpy (&config.ssid, ssid, 32);
  os_memcpy (&config.password, pwd, 64);

  if (wifi_station_set_config (&config)) {
    os_printf ("[flashmem_clear_network_settings] Cleared network settings: SSID = %s, PWD = %s\r\n", config.ssid, config.password);
  }
  else {
    os_printf ("[flashmem_clear_network_settings] ERROR clearing new network settings: SSID = %s, PWD = %s\r\n", config.ssid, config.password);
  }

}



Serial print



[interrupt_handler] Action button was pressed for 3 seconds.
[device_on] Device turning "on" now... [Waking up the device from radio sleep]
[device_on] Will load defaults...
force slp disable
fpm close 3
[led_show_feedback] ACTION_ON!
mode : sta(18:fe:34:ed:a0:12)
add if0
sleep enable,type: 1
[led_show_feedback] ACTION_CONNECTING!
[wifi_handle_event_cb] Will poweroff after timeout if no reconnect.
f r0, [wifi_init] Connecting to "phoneap" with password = phoneap0000 [connecting using default network settings]
[main_init] Ready
scandone
no phoneap found, reconnect after 1s
[wifi_handle_event_cb] Disconnected
reconnect
f 0, scandone
no phoneap found, reconnect after 1s
[wifi_handle_event_cb] Disconnected
reconnect
f -180, scandone
no phoneap found, reconnect after 1s
[wifi_handle_event_cb] Disconnected
reconnect
f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt

connected with phoneap, channel 1
dhcp client start...
[wifi_handle_event_cb] Connected to SSID phoneap
[wifi_handle_event_cb] Stopping poweroff timer.
ip:192.168.43.73,mask:255.255.255.0,gw:192.168.43.1
[wifi_handle_event_cb] Got IP address.
[wifi_handle_event_cb] Gateway is = 192.168.43.1
[tcp_client_connect_cb] Connected to TCP Server
[device_network_setup] Entering network setup mode...
[device_network_setup] chip_id = 15573010
[device_network_setup] Sent request for setup: "SETUP_REQ:15573010" [asking for user data to the App]
[device_network_setup_receive_cb] Received 128 bytes: "{"type":"RESPONSE SETUP","user_id":"ae252bbf-2c38-4371-b1f9-48f436f00463","birth_day":"01","birth_mon":"01","birth_year":"2011"}" [ssid is phoneap + day of birth, passwd is user date of birth]
32, 64
[device_network_setup] New network configuration: [new network config to be stored]
SSID: phoneap-01
KEY: 01012011
[device_network_setup] Sent acknowledge for setup: "SETUP_ACK" [Telling App network info exchange was sucessful]
[wifi_apply_new_settings] Disconnecting from WiFi to apply new settings.
[tcp_client_disconnect] TCP disconnect successful.
[tcp_client_disconnect_cb] Disconnect callback reached
[wifi_disconnect] Disconnecting from AP...
state: 5 -> 0 (0)
rm 0
[wifi_handle_event_cb] Disconnected

Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x40100c79, epc2=0x00000000, epc3=0x00000000, excvaddr=0x31313036, de
pc=0x00000000
r,R*)vAl55*e n*U"hIA,rNr,R*5vA.9A~A.-n*E"InA,p%nA,p%rf[112] : 03
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4(baaeaebb) compiled @ May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1

Aleix
Posts: 8
Joined: Tue Mar 08, 2016 5:21 am

Re: Fatal exception 9

Postby Aleix » Wed Nov 09, 2016 12:21 am

Sorry for the multipost, i deleted the other noes.

Aleix
Posts: 8
Joined: Tue Mar 08, 2016 5:21 am

Re: Fatal exception 9

Postby Aleix » Fri Nov 11, 2016 6:59 pm

Can some throw in some input on this subject please?

rith87

Re: Fatal exception 9

Postby rith87 » Thu Nov 17, 2016 5:24 pm

You might want to get a bit more information about the crash:

Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x40100c79, epc2=0x00000000, epc3=0x00000000, excvaddr=0x31313036, de
pc=0x00000000


From https://github.com/SuperHouse/esp-open-rtos/wiki/Crash-Dumps, exception 9 is

Attempt to read/write memory with an unaligned address (for example, trying to read/write a 32-bit word at an address that is not a multiple of 4)


You can probably get the function that is crashing by looking for 0x40100c79 in your binary too.

Aleix
Posts: 8
Joined: Tue Mar 08, 2016 5:21 am

Re: Fatal exception 9

Postby Aleix » Thu Nov 24, 2016 4:04 pm

Thanks Rith,

Sorry for the delay, i went all the way in and contacted Espressif directly, but i'll take a closer look at it.

I'll post back the thing once we find it, hope noone has to deal with this alone again :P

Who is online

Users browsing this forum: No registered users and 58 guests