spi_flash_read panic'ed
Posted: Tue Dec 20, 2016 9:01 am
Error when using core 1 to test spi_flash_read:
Error message:
How to solve?
Code: Select all
void testTask(void *arg)
{
const uint32_t cpuid = (uint32_t) arg;
assert(cpuid == xPortGetCoreID());
vTaskDelay(100 / portTICK_PERIOD_MS);
const uint32_t sector = cpuid + 6;
const uint32_t n = SPI_FLASH_SEC_SIZE;
ets_printf("t%d\n", cpuid);
uint32_t val_read;
for (uint32_t offset = 0; offset < n; offset += 4) {
if (spi_flash_read(sector * SPI_FLASH_SEC_SIZE + offset, (uint8_t *) &val_read, 4) != ESP_OK) {
ets_printf("Read failed at offset=%d\r\n", offset);
break;
}
}
ets_printf("td%d\n", cpuid);
vTaskDelete(NULL);
}
void app_main()
{
nvs_flash_init();
tcpip_adapter_init();
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
wifi_config_t save_sta_config;
ESP_ERROR_CHECK(esp_wifi_get_config(WIFI_IF_STA, &save_sta_config));
if (save_sta_config.sta.ssid[0] == '\x0') {
wifi_config_t sta_config = {
.sta = {
.ssid = "ssid",
.password = "password",
.bssid_set = false
}
};
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) );
}
ESP_ERROR_CHECK( esp_wifi_start() );
ESP_ERROR_CHECK( esp_wifi_connect() );
xTaskCreatePinnedToCore(testTask, "TestTask", 2048, (void *) 1, 1, NULL, 1);
}
Code: Select all
[0;32mI (840) heap_alloc_caps: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (840) heap_alloc_caps: At 3FFC18BC len 0001E744 (121 KiB): DRAM[0m
[0;32mI (848) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM[0m
[0;32mI (858) heap_alloc_caps: At 4009B9B0 len 00004650 (17 KiB): IRAM[0m
[0;32mI (868) cpu_start: Pro cpu up.[0m
[0;32mI (874) cpu_start: Starting app cpu, entry point is 0x40080ba0[0m
[0;32mI (0) cpu_start: App cpu up.[0m
[0;32mI (889) cpu_start: Pro cpu start user code[0m
[0;32mI (1118) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0[0m
[0;32mI (1638) cpu_start: Starting scheduler on PRO CPU.[0m
[0;32mI (765) cpu_start: Starting scheduler on APP CPU.[0m
tcpip_task_hdlxxx : 3ffc6144, prio:18,stack:2048
I (769) wifi: frc2_timer_task_hdl:3ffc7c34, prio:22, stack:2048
I (784) wifi: pp_task_hdl : 3ffca494, prio:23, stack:8192
I (785) wifi: mode : sta (24:0a:c4:00:3d:6e)
t1
Guru Meditation Error: Core 0 panic'ed (Double exception)
Register dump:
PC : 0xffffffff PS : 0x00060036 A0 : 0x7fffffff A1 : 0x3ff81fa0
A2 : 0x3ff82010 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x3ffb0000
A6 : 0x00009058 A7 : 0x00004001 A8 : 0x8005a2a2 A9 : 0x00000000
A10 : 0x3ff96162 A11 : 0x3ff9c357 A12 : 0x00000000 A13 : 0x00000000
A14 : 0x00000301 A15 : 0x00060223 SAR : 0x00000017 EXCCAUSE: 0x00000002
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace: 0x00000000:0x3ff81fa0
CPU halted.