2024-06-26 12:18 AM
Hello team,
Is there any way to format the external flash of microcontroller, the reason is that that flash is acting as USB MSC Device. As soon as it connects to PC a popup will arise for disk format. Am planning to do complete mass erase of flash , along with that do i need FATfs system so that windows can recognize it as a device. Kindly guide me sample code or example for the same.
Thanks & regards,
Shikamaru
2024-07-17 07:00 AM - edited 2024-07-17 07:00 AM
Hello @Shikamaru ,
you can use STM32CubeProgrammer , it is an excellent tool for programming and erasing internal & external flash memory. Here’s how you can use it to perform a mass erase and format the external flash:
Download and Install STM32CubeProgrammer:
Connect Your Microcontroller:
Open STM32CubeProgrammer:
Select the Target:
Mass Erase:
Br
2024-07-17 07:28 AM
> flash is acting as USB MSC Device.
No, it is the STM32 acting as USB MSC Device towards the host (PC) and interpreting the host requests. The flash is acting as "dumb memory" (unless it is a SD/MMC card).
> do i need FATfs system so that windows can recognize it as a device.
No, the Windows (host) will act as the flesystem. You need filesystem on the STM32 side (FATFS or other) only if the STM32 program itself is the user of the storage. (but they can take turns: STM32 can mount the storage and deal with the files while the host is not looking).