Closed felixstorm closed 4 years ago
Thank your for submiting, please be sure you followed template or your issue may be dismissed.
More info: I just now did have more reboots when uploading a file to the SD card (although refresh, create folder etc. had already worked without issues in the same session). After commenting out the part that checks the free space in Web_Server::SDFile_direct_upload
(src/web_server.cpp
lines 1438-1448) uploading did work fine, so it seems to be connected with ESP_SD::card_used_space
.
The SD card is a standard 8GB card (it might even be the one that originally came with the Ender 3 printer) and it is empty (I formatted it just before testing this).
Just tried with two different SD cards (16GB & 32GB), but the reboot does happen as well when refreshing.
Marlin SD lib is limited and the ESP_SD::card_used_space
and ESP_SD::card_total_space
code is not used in normal Marlin usage, I am thinking to try to move to ESP32 SD Lib or even better SDFat for this and a proper support of long name.
That said I do not reproduce it I only have 2GB/4GB/16G and this will follow SD response time I think
@felixstorm How did you formated your SD ? Do you use https://www.sdcard.org/downloads/formatter/ ?
Just tried with two different SD cards (16GB & 32GB), but the reboot does happen as well when refreshing.
@felixstorm does this happen even you comment ESP_SD::card_used_space
or if your return hardcoded value in these 2 functions :
https://github.com/luc-github/ESP3DLib/blob/master/src/sd_ESP32.cpp#L305-L313
I did format the cards from Windows with a default cluster size, I had not tried a different formatter yet.
And I hadn't even thought of just returning a fixed value yet, but always returning 0 from ESP_SD::card_used_space()
does indeed work very well for me - no issues anymore during any SD card operation (refresh, up- and download of a 10 MB file etc.).
Support for long file names seems like a very good idea (this would have been one of my first feature requests anyway :wink:), so if that's best accomplished by using a differnt SD/FAT library then returning "0 bytes used" in the meantime is a very feasible workaround for me. So IMHO this issue may very well be closed then - just do as you like.
A bit off topic, but maybe you know the answer anyway: SD card access seems to be a bit slow (I get around 100 kBit/s on downloads). Is that just how much it is in this setup or should I try to tweak my SPI speed a bit (100 kBit/s sound like only ~1MHz SPI speed)? If so, do you know by heart which settings I would have to change in the Marlin config to tune SPI speed?
Thanks, Felix
Please do not use windows for SD card formating, better use link I gave
ok so I will disable theses functions until proper fix is implemented. need also to comment for upload to avoid not enough space failure
About SD card speed: Marlin SD lib is not really optimised for esp32, also webserver is not best currently to upload, I did not test download performance to be honest. Here some bench I did on ESP3D 3.0 and SD lib and FTP server instead of webserver https://github.com/luc-github/ESP3D/issues/383#issuecomment-548695909
about speed setting, all depend of sdcard reader and also SDCard itself
I just bought a new 16GB / 32GB/ 64GB SD cards today - will try to do some tests during my vacations free time
@luc-github No real need to worry about this one anymore, I did some more debugging and filed a PR to properly fix it inside Marlin: https://github.com/MarlinFirmware/Marlin/pull/16690
My guess is that it largely depends on cluster size (the smaller the cluster size, the more FAT sectors/entries need to be read to calculate free cluster count) and on the speed of the SD card used. If the formatter you linked uses a larger clusters size than Windows, it may work ok but if all sums up to more than 5 seconds, the watchdog will trigger.
About SD card speed: I did an upload test now (around 30 kBit/s) and looking at the other issue you had linked this seems to be pretty much ok for the setup.
thank you - I like such kind of issue ^_^
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This stale issue has been automatically closed. Thank you for your contributions.
Description When accessing the SD card (i.e. refresh, create folder etc.) through the web UI for the first time after Marlin starts, Marlin's task watchdog triggers and causes a reboot.
To Reproduce
http://marlinesp.local/
)Marlin Firmware:
ESP3DLib :
Board used (please complete the following information):
Additional context After the reboot, the call e.g. to
http://marlinesp.local/upload?path=/&PAGEID=0
seems to complete, but sometimes Marlin responds withSD init fail
before then reportingSD card ok
. Thereafter SD card access seems to be fine for the session - both from ESP3D (create folder) as well as from Marlin itself. But after the next reboot (power cycle or hard reset) any SD access will again trigger a reboot.My guess would be that it has something to do with concurrent SD card access - if Marlin gets access first, then ESP3DLib will timeout (and the task wdt triggers a reboot), but if ESP3DLib gets access first, then Marlin seems to get access a bit later and both seem to be happy...
Decoded stack trace:
If there is anything else that I can do to help you trace this down please let me know!
Thanks,
Felix