2022-10-20 00:52:55 [显示全部楼层]
2070浏览
查看: 2070|回复: 0

[讨论] SPIFFS 引起ESP32 反复启动怎么办?

[复制链接]
各位好。
有一个简单的 SPIFFS 管理程序,上传到 ESP32-WROOM 后导致反复启动, 确实也列出了 SPIFFS 文件,但是反复列出,其他程序没有这个问题,应该怎么办?
谢谢。


  1.   
  2. #include "SPIFFS.h"
  3. void listAllFiles(){
  4.   File root = SPIFFS.open("/");
  5.   File file = root.openNextFile();
  6.   while(file){
  7.       Serial.print("FILE: ");
  8.       Serial.println(file.name());
  9.       file = root.openNextFile();
  10.   }
  11. }
  12. void setup() {
  13.   Serial.begin(115200);
  14.   if (!SPIFFS.begin(true)) {
  15.     Serial.println("An Error has occurred while mounting SPIFFS");
  16.     return;
  17.   }
  18.   File file = SPIFFS.open("/test.txt", FILE_WRITE);
  19.   if (!file) {
  20.     Serial.println("There was an error opening the file for writing");
  21.     return;
  22.   }
  23.   if (file.print("some content")) {
  24.     Serial.println("File was written");
  25.   } else {
  26.     Serial.println("File write failed");
  27.   }
  28.   file.close();
  29.   Serial.println("\n\n---BEFORE RENAMING---");
  30.   listAllFiles();
  31.   SPIFFS.rename("/test.txt", "/renamed.txt");
  32.   Serial.println("\n\n---AFTER RENAMING---");
  33.   listAllFiles();
  34. }
  35. void loop() {}
复制代码

ERROR:
  1. 12:49:57.010 -> ELF file SHA256: 0000000000000000
  2. 12:49:57.010 ->
  3. 12:49:57.010 -> Rebooting...
  4. 12:49:57.010 -> ets Jul 29 2019 12:21:46
  5. 12:49:57.010 ->
  6. 12:49:57.010 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
  7. 12:49:57.010 -> configsip: 0, SPIWP:0xee
  8. 12:49:57.010 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  9. 12:49:57.010 -> mode:DIO, clock div:2
  10. 12:49:57.010 -> load:0x3fff0030,len:1344
  11. 12:49:57.010 -> load:0x40078000,len:13836
  12. 12:49:57.010 -> load:0x40080400,len:3608
  13. 12:49:57.010 -> entry 0x400805f0
  14. 12:49:57.247 -> File was written
  15. 12:49:57.247 ->
  16. 12:49:57.247 ->
  17. 12:49:57.247 -> ---BEFORE RENAMING---
  18. 12:49:57.315 -> FILE: hello.txt
  19. 12:49:57.349 -> FILE: renamed.txt
  20. 12:49:57.349 -> FILE: test.txt
  21. 12:49:57.383 ->
  22. 12:49:57.383 ->
  23. 12:49:57.383 -> ---AFTER RENAMING---
  24. 12:49:57.485 -> FILE: hello.txt
  25. 12:49:57.485 -> FILE: renamed.txt
  26. 12:49:57.485 -> FILE: test.txt
复制代码




您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4 备案

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail