I am trying to read the SD card information (4G SHDC) using IO_IOCTL_FREE_CLUSTERS and IO_IOCTL_GET_CLUSTER_SIZE. I am using MQX 3.7. The first time that I try to do that is too slow,
almost 2 minuts. The second time is immediate..
Solved! Go to Solution.
I tested the IO_IOCTL_FREE_CLUSTERS with a 8G SD card on mqx 4.0. The first time it cost 8s and second 2ms. I think it is normal.The first time the the drive' information FREE_COUNT has a signiture of FSI_UNKNOWN indicating that work need to be done to count the free clusters. It is a normal value of 8s to count the free clusters on the SD card because as many as 2M bytes FAT need to be read on MFS. The reason why the second time call is fast is that the FREE_COUNT is available and the app can directly use the value preserved in the mfs cache without a extra compute.
Ok Zhiyang Zhang. Thank you for your information, it makes sense to me.
So I guess the only way to reduce that time would be to increase clock speed on the SD bus ?
I am using a Kinetis K60 on our prototype board, running with the SDHC driver.
For your information, I manage to get rid of the unknown error: I was probably misusing the IO_IOCTL_FREE_CLUSTERS function. This piece of code is now working properly.
Still, I have the issue mentionned by Oscar when the first access is very long (something like 20+ sec.) whereas further accesses are quite fast (1-2 sec), although using MQX 4.0.
I'm using the MCF54417 and we're experiencing the same issue using IO_IOCTL_FREE_SPACE.
I never bothered calling it a second time to see if it ran any faster though.
I am using MQX 4.0 and though, have the same issue : at first use IO_IOCTL_FREE_CLUSTERS lasts a bunch of seconds, while on the next calls, its execution is rather quick. I get the same behavior with IO_IOCTL_FREE_SPACE as well.
Besides, these functions always return "UNKNOWN ERROR !!!" so I did not manage to know the remaining space on my SD device! Any idea?
Did you manage to have the IO_IOCTL_FREE_CLUSTERS function working?
Thank you for your help,