cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement "Delete" function in "usbd_storage_if.c", since when deleting files from windows, the icon disappears, but when refreshed, file appears again with zero size.

HSh..1
Associate II

Hi.

I`m generating a project from stm32cudemx version 6.1.2

The MCU I use is a stm32f407v with my own designed board

The f4 series firmware package version I use is 1.25.2

My project consists of usb msc device only, with sd card connecting through SDIO, DMA enabled, using fatfs library

What I wanna do is to create files through fatfs into the sdcard, and handle these file in windows, while the board is connected to my PC through usb.

I can cut and copy files from\to sdcard, but when I press "delete" in windows, the file icon disappears like it is removed, but when I press refresh, or when I disconnect and connect again the usb, or when I connect the card to pc through a card reader, the deleted file appears again with size of zero.

Can any body tell me whats wrong here?????

3 REPLIES 3
HSh..1
Associate II

Also formatting the drive is not possible, gives the error "windows was unable to complete the format"

gbm
Lead III

There is no "delete" at sector level. Either your write doesn't work or you don't sync ("eject") the volume before disconnecting it from the host, so the relevant write command is not sent to it from the host.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
HSh..1
Associate II

to gbm

Thanks for the answer

how should I do the "sync" from windows?