Open olicooper opened 1 month ago
The wear levelling docs state that the default WL sector size is 512
but also says that it is 4096
when used with FATFS?
The wear levelling component, together with the FAT FS component, uses FAT FS sectors of 4096 bytes, which is a standard size for flash memory
My project made CONFIG_FATFS_SECTOR_4096=y
and CONFIG_WL_SECTOR_SIZE_4096=y
by default which conflicts with what I see in the demo: https://github.com/espressif/esp-idf/blob/59e18382702b6986be3d3f55e9ac7763c1397cf7/examples/peripherals/usb/device/tusb_msc/sdkconfig.defaults#L10
Hi @olicooper,
Thanks for the information. I can see that the fs was mounted with error (based on the attached log). The USB MSC class provides only a transport layer here to read and write data from the storage. So, if the storage wasn't mounted then any read/write operation will end up with an error.
Have you tried to run the wear-leveling example itself? Does it have the same problem on desired settings?
I haven't run the wear-levelling example but I can test that too. The code that causes the reboot loop is the MSC code, but maybe the partition is being corrupted by FATFS or wear-levelling, I'm not sure.
The mount fails because it fails to format the partition (I assume after writing the first 512 bytes), then panics and reboots. If I erase the whole flash and try the demo again it does not fail to mount (because there is nothing to mount) but I assume the format process corrupts the partition table after the first attempt.
Currently experiencing same issue, ran the tinyusb msc example on the esp32 s3 devkit and got flooded with same errors. Any new info on the issue, or way to resolve it?
Hello everyone, I'm sorry for the delay, we will try to investigate by end of November
Answers checklist.
IDF version.
v5.3.0
Espressif SoC revision.
ESP32-S3
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
Waveshare ESP32 S3 Nano
Power Supply used.
USB
What is the expected behavior?
The format/mount procedure should write the sector information in 512 chunks rather than failing or the procedure should fail gracefully.
What is the actual behavior?
Application fails here: https://github.com/espressif/esp-usb/blob/d32baca40a25966f274d190a71f508d33b799a71/device/esp_tinyusb/tusb_msc_storage.c#L199
With the following logs repeated until the device is rebooted:
Steps to reproduce.
Using the MSC demo with SPI flash: https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/device/tusb_msc
With partition table (16MB flash in QIO mode @ 80Mhz):
sdkconfig (using default values):
Debug Logs.
More Information.
This bug can be fixed by setting
CONFIG_TINYUSB_MSC_BUFSIZE=4096
(becausesize % sector_size == 0
).. but if the user formats the storage device using a larger sector size then it will still fail and I have no control over users formatting the drive.It seems that the default sdkconfig is not compatible with the MSC demo and it is not clear how to fix the problem (I can't find any documentation about this restriction).
Even if this is expected behaviour, I am not sure why this doesn't fail gracefully? Instead it floods the log with the error seen above.