Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD card basic R/W check + folder/file presence check #2085

Merged
merged 4 commits into from
Feb 28, 2023

Conversation

Slider0007
Copy link
Collaborator

@Slider0007 Slider0007 commented Feb 26, 2023

Implement a basic SD card check at boot to ensure proper SD card functionaliy -> feature request #1886

  • check function 1:

    • Create file
    • Write file with some generic text
    • Read file back
    • Verify CRC
    • Delete file
      --> After error occured it boots to reduced WebUI show and error code
  • check function 2:

    • Verify presence of some folders / files
    • The following folders / files get check at boot:
      /sdcard/config
      /sdcard/html
      /sdcard/demo --> created automatically in firmware
      /sdcard/firmware --> created automatically in firmware
      /sdcard/img_tmp --> created automatically in firmware
      /sdcard/log --> created automatically in firmware
      /sdcard/wlan.ini
      /sdcard/config/config.ini
      /sdcard/html/index.html
      /sdcard/html/ota_page.html
      /sdcard/html/log.html
      /sdcard/html/common.js
      /sdcard/html/gethost.js
      /sdcard/html/version.txt
      --> If one or more are not present -> load reduced WebUI and show error code
  • Check indication in boot log (all OK):
    image

  • LED indication for the respective error cases:
    image

###################################################
Questions:

  • Shall we stop the boot process in this early phase when SD card RW check fails or is it better to continue to reduced web interface?
    --> Load reduced web interface and show error code
  • Presence check of some folders is not garantuee that everthing on SD is OK, but could give early indication that something is at least present (only warnings, no reaction). What do you think about this? Does this make sense?
    --> Load reduced web interface and show error code

TODO:

  • Update documentation

@Slider0007 Slider0007 marked this pull request as draft February 26, 2023 12:09
@Slider0007 Slider0007 marked this pull request as ready for review February 26, 2023 13:24
@jomjol
Copy link
Owner

jomjol commented Feb 26, 2023

Shall we stop the boot process in this early phase when SD card RW check fails or is it better to continue?

Yes, we should do this, as this is a basic need of the firmware.

Presence check of some folders is not garantuee that everthing on SD is OK, but could give early indication that something is at least present (only warnings, no reaction). What do you think about this? Does this make sense?

It does make sense and we can write a problem into the log file. I would not stop the firmware in this case

@Slider0007
Copy link
Collaborator Author

Shall we stop the boot process in this early phase when SD card RW check fails or is it better to continue?

Yes, we should do this, as this is a basic need of the firmware.

Presence check of some folders is not garantuee that everthing on SD is OK, but could give early indication that something is at least present (only warnings, no reaction). What do you think about this? Does this make sense?

It does make sense and we can write a problem into the log file. I would not stop the firmware in this case

Thanks for your feedback. Implementation completed:

  • Failed SD card basic check --> abort booting
  • Folder check --> continue booting, only warning

@caco3
Copy link
Collaborator

caco3 commented Feb 26, 2023

 Shall we stop the boot process in this early phase when SD card RW check fails or is it better to continue?

Yes, we should do this, as this is a basic need of the firmware.

We could instead show a basic website (contained in the firmware) which documents the issue.

And like an idea I had before, we also could contain a basic OTA page so one could still update in case the web UI got deleted.

@caco3
Copy link
Collaborator

caco3 commented Feb 26, 2023

I actually already implemented this for the index page: https://github.com/jomjol/AI-on-the-edge-device/blob/rolling/code/main/server_main.cpp#L236

@caco3
Copy link
Collaborator

caco3 commented Feb 26, 2023

keep in mind, if the web UI does not initialized, the users can only check the log using USB!

@Slider0007
Copy link
Collaborator Author

 Shall we stop the boot process in this early phase when SD card RW check fails or is it better to continue?

Yes, we should do this, as this is a basic need of the firmware.

We could instead show a basic website (contained in the firmware) which documents the issue.

@caco3: Thanks for reminding to the reduced web interface. I wasn't thinking about this during design, but I like the idea to have the chance to get remote visual feedback in error case. If we do not get to this point, we still have at least local indication (console log and board status LED).

@caco3, @jomjol: The updated design approach could be to following:

  • SD card basic check failed (not able to read, write or delete a file on SD card):
    --> Continue booting and open reduced web interface
    --> Recommendation in the error description: Check / format or replace SD card (because with such an error case it's potentially impossible to recover with only doing OTA)
    --> Does it makes sense to split the error to write, read and delete errors or combine them and just having one error?

  • SD basic folder structure check (check availability of some folders / files):
    --> Continue booting and also open only reduced web interface
    --> Recommendation in the error description: Check log and redo OTA

@Slider0007 Slider0007 marked this pull request as draft February 27, 2023 08:07
@caco3
Copy link
Collaborator

caco3 commented Feb 27, 2023

  • SD card basic check failed (not able to read, write or delete a file on SD card):
    --> Continue booting and open reduced web interface
    --> Recommendation in the error description: Check / format or replace SD card (because with such an error case it's potentially impossible to recover with only doing OTA)
    --> Does it makes sense to split the error to write, read and delete errors or combine them and just having one error?

I think we could keep the reduced web page minimalistic (to save flash memory).
It should be enough to show the error code and a link to https://jomjol.github.io/AI-on-the-edge-device-docs/Error-Codes/

With just working read we could continue with the normal UI, but I would not as it could be misleading.

  • SD basic folder structure check (check availability of some folders / files):
    --> Continue booting and also open only reduced web interface
    --> Recommendation in the error description: Check log and redo OTA

I would also just go to a reduced web page.
If you want I can write a minimalistic OTA page which could be contained as a fallback.

Files which IMO should be available (resp. checked for):

  • config.ini -> although the device should work without it
  • wlan.ini
  • index.html
  • ota.html
  • Log.html
  • common.js
  • gethost.js
  • version.txt (not really needed, but a good indication that the Web UI got properly installed. Some users just copy it from the repo but that does no longer work as we modify the Web UI during the build)

and should we check for at least one tfl file each (analog/digit)?

@Slider0007
Copy link
Collaborator Author

Slider0007 commented Feb 28, 2023

@caco3: Thanks for your input. I revised the logic to benefit from reduced web interface.

@caco3, @jomjol:

  • After SD R/W error occured it boots to reduced WebUI and show error code.
  • The following folders / files get check at boot. If one or more are not present -> load reduced WebUI and show error code:

/sdcard/config
/sdcard/html
/sdcard/firmware --> created automatically in firmware
/sdcard/img_tmp --> created automatically in firmware
/sdcard/log --> created automatically in firmware
/sdcard/demo --> created automatically in firmware
/sdcard/wlan.ini
/sdcard/config/config.ini
/sdcard/html/index.html
/sdcard/html/ota_page.html
/sdcard/html/log.html
/sdcard/html/common.js
/sdcard/html/gethost.js
/sdcard/html/version.txt

@Slider0007 Slider0007 changed the title SD card basic RW check + folder structure check SD card basic RW check + folder/file presence check Feb 28, 2023
@Slider0007 Slider0007 marked this pull request as ready for review February 28, 2023 08:55
@Slider0007 Slider0007 changed the title SD card basic RW check + folder/file presence check SD card basic R/W check + folder/file presence check Feb 28, 2023
@jomjol jomjol merged commit 2dd2d03 into rolling Feb 28, 2023
@jomjol jomjol deleted the sdcard-basic-check branch February 28, 2023 17:25
@caco3 caco3 mentioned this pull request Mar 11, 2023
31 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants