USBX + FileX + ThreadX (USB Host MSC) — RAM minimum?
Hi everyone,
I’m building a coffee machine project using STM32C071 (C0) mainly because it has USB. I need USB Host MSC to:
Mount a USB flash drive (FAT)
Read/write files (params/logs)
Firmware update from USB drive
The “official” ST stack seems to be ThreadX + USBX + FileX. Since there’s no USB Host MSC example for C0, I used an STM32L4R5 example (much larger RAM) as reference and adapted it.
Issue: To pass ThreadX/USBX init, I kept increasing stacks/pools until I’m using ~20 kB of RAM. Then, when I plug the flash drive, enumeration fails with out-of-memory errors (e.g., UX_DEVICE_ENUMERATION_FAILURE / allocation failure).
Questions:
Is ~20 kB RAM just to init (and still fail at enumeration) expected for USBX Host MSC + FileX, or does it strongly suggest misconfiguration?
Is there any official guideline/table (ST/Azure RTOS) for typical/minimum RAM for USBX Host + MSC + FileX (FAT)?
Is there a practical RAM “floor” to enumerate + mount FAT + read/write files (single device, no HUB)? Like “below X kB is unrealistic”?
When enumeration fails due to memory, is it usually related to:
USBX memory pool size,
thread stack sizes,
MSC/FileX buffers (sector/cache/FAT),
enabled features (HUB, multiple devices/classes)?
Which macros/settings would you reduce first for a minimal use case (e.g., UX_MAX_DEVICES, class drivers, HUB, etc.)?
Does using dynamic allocation (properly) make sense here, or is the right approach simply fixed pools/stacks sized conservatively?
Any recommended method/tooling to size memory without pure trial-and-error? (byte pool stats, stack high-water mark, ThreadX/USBX tracing)
Setup: STM32C071, single USB flash drive MSC + FAT (FileX), no HUB, L4 reference code.
If anyone has a known working baseline for small-RAM MCUs (C0 or similar), any pools/stacks/macros values would be extremely helpful. Thanks!
