-
Notifications
You must be signed in to change notification settings - Fork 13.3k
WDT reset with SD card #1255
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
Comments
did delay(0); fix the issue? |
The referenced code is still in latest git. |
Adding yield or delay means the function can't be used in async code anymore. @igrr I'm not sure what can be done here, and I don't have the hardware to test. Any ideas? |
Don't have hardware to test this at the moment either, moving to 2.5.0 |
Note: if the code here must yield, the correct way is with a delay(0) as originally proposed. That will yield when in CONT, and do nothing when in SYS. In contrast, optimistic_yield() only skips yield when called too soon after loop() entry. |
This requires investigation that won't fit into 2.5.0, mostly due to lack of hardware for testing. Pushing milestone back. |
Assigning to @earlephilhower in view of the new SDFS implementation. |
The code paths are modified and in a different file, but they're generally the same. There are two methods in FatVolume.cpp which can iterate over all clusters on a card that need attention:
Wackypedia lists FAT32 potentially having 268,435,445 clusters, so iterating over them all might take a wee bit of time. A practical example of a 16GB card (formatted w/Linux VFAT default options) shows just under 500,000 clusters (30441472 sectors / 64 (sectors/cluster)). As a simple, brute-force way of handling the WDT I propose calling |
FAT filesystems may have up to ~270 million clusters, and the SdFat library needs to perform a linear scan on them to find free clusters. WDT timeouts will occur on systems that have periodic yield requirements when large scans are needed. Add in a OS yield (no-op unless needed by the specific uController) every 5,000 cluster entries. Fixes esp8266/Arduino#1255
See earlephilhower/ESP8266SdFat#3 for the proposed solution. That repo needs to be merged, then a submodule update done here on the core to pull it in. |
When creating a new file , need a lot of time for search the FAT for free clusters.
If there are a large number of files in SD card, might lead WDT reset
Trigger WDT timeout at here:
https://github.com/esp8266/Arduino/blob/master/libraries/SD/src/utility/SdVolume.cpp : line 58
It found space at 371012 time.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: