We are still working to isolate the problem, and hope to provide an example project that shows the issue, but for now I just want to share what we are seeing:
Code: Select all
/* application writes to RTC memory */
*((uint32_t*)(0x50001FF0))=0x1badbabe
ESP_LOGI(TAG, "before: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
ESP_LOGI(TAG, "before: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
ESP_LOGI(TAG, "before: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
ESP_LOGI(TAG, "before: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
/* deep sleep reset */
esp_deep_sleep(1000 /* 1 ms */);
/* now, from the bootloader */
ESP_LOGI(TAG, "after: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
ESP_LOGI(TAG, "after: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
ESP_LOGI(TAG, "after: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
ESP_LOGI(TAG, "after: 0x%" PRIx32, *((uint32_t*)(0x50001FF0)));
The 4x "after" prints all print the same value. So it seems that the memory is getting corrupted through the reset, rather than being unreliably read. -- But there may be some caching involved?
We use RTC memory to signal a change in bootloader behavior to jump to the OTA image rather than the factory image --- so the corruption causes a bootloop!