Read SD card size information

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Read SD card size information

Jump to solution
2,004 Views
oscar
Contributor I

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..

 

Any idea?

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,635 Views
DavidS
NXP Employee
NXP Employee

Fixed in the MQX3.8.1 release per the release notes.

Regards,

David

View solution in original post

0 Kudos
Reply
8 Replies
1,635 Views
zhiyangzhang
Contributor III

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.

0 Kudos
Reply
1,635 Views
sgqo
Contributor I

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 ?

Regards,

0 Kudos
Reply
1,635 Views
sgqo
Contributor I

Hi David,

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.

Regards,

S.

0 Kudos
Reply
1,635 Views
t_k
Contributor II

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.

Thanks,

Travis

0 Kudos
Reply
1,635 Views
DavidS
NXP Employee
NXP Employee

Hi S.,

What Kinetis device are you using?  Are you using Tower kit?

Are you accessing SD Card with SPI or SDHC controller?

Regards,

David

0 Kudos
Reply
1,636 Views
DavidS
NXP Employee
NXP Employee

Fixed in the MQX3.8.1 release per the release notes.

Regards,

David

0 Kudos
Reply
1,635 Views
sgqo
Contributor I

Hi David,

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?

Hi Oscar,

Did you manage to have the IO_IOCTL_FREE_CLUSTERS function working?

Thank you for your help,

S.

0 Kudos
Reply
1,635 Views
oscar
Contributor I

Good news!

Is it easy to import this changes to MQX 3.7.1?

Regards,

Oscar

0 Kudos
Reply