This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

msc write usb delay

Hi all, I'm using FatFs ChaN R011a and STM32F4 HOST library 2.2.0 relasead on 2015 to develop
a mass storage class usb data logger. I noticed a strange behaviour flushing the logging data
on some usb key devices. I normally save the logging data on a buffer of 4096B, then when it becomes full,
I call first "f_write" and aftewards "f_sync" function, but in some cases this last one takes too
much time to finish (pin toggling to measure the time). The "f_sync" delay is not regular and it takes
up to 800 ms for some usb key. I didn't find any file system errors and these functions return always FR_OK.

my settings clock: STM32F4 core clock = 42MHz, USB clock = 48MHz (PLL).

According to you, could it only depend by the kind of usb key interfaced or by other?
In the file "usbh_msc_fatfs.c", the case CTRL_SYNC of disk_ioctl is not implemented, is it correct? Why?

Thank you,
Fabio

Parents
  • I would think the actual USB thumb drive could be guilty of slow syncs.

    If the thumb drive needs to erase flash blocks before it can write down the new data you try to flush, then that flush will be much slower than if the USB thumb drive already have empty flash blocks so it can directly write down the data.

    I would think lots of USB thumb drives will lack over-provisioning so they then don't have any spare flash blocks that can be kept erased beforehand and instantly allocated when you issue new writes.

Reply
  • I would think the actual USB thumb drive could be guilty of slow syncs.

    If the thumb drive needs to erase flash blocks before it can write down the new data you try to flush, then that flush will be much slower than if the USB thumb drive already have empty flash blocks so it can directly write down the data.

    I would think lots of USB thumb drives will lack over-provisioning so they then don't have any spare flash blocks that can be kept erased beforehand and instantly allocated when you issue new writes.

Children