Hey guys am trying to interface SD Card with Coldfire V1 uC. The problem is dat I have written da code for little endian and later realized dat the uC am working with is big endian, as a result am not able to read boot sector and the program shows error 'NOT_FAT32'. Is thr any way to change uC from big endian mode to little endian mode!!!
Plz help....
The FAT File System of freescale with some bug fixes was posted on:
http://code.google.com/p/brtos/downloads/list
Now supports up to 512 MB and the list function is working correctly.
The corruption of files was also fixed.
Best Regards,
Gustavo
SIr,
I downloaded your latest Fat file system for use in logging data. In that circumstance it has a problem with the cluster calculation when opening a file larger than 8K for write. The calculation u16Temporal =fileSize % (Sector_Size<<4) gives a sector index from 0-15 when it instead should be 0-63. Using a u16 for the intermediate value, also poses an inherent 512Meg size limit.
This problem only happens when opening an existing file for writing. You can open a new file, write 500K to it close it and read it fine. But I do lots of appends, and then it corrupts the file system.
In FAT_FileOpen() line 662
u16Temporal=(INT16U)FAThandle->WHandler.File_Size % (FAThandle->u16FAT_Sector_Size<<4);
FAThandle->WHandler.ClusterIndex= u16Temporal/FAThandle->u16FAT_Sector_Size;
Change this to
u32Temporal=FAThandle->WHandler.File_Size % (FAThandle->u16FAT_Sector_Size<<6);
FAThandle->WHandler.ClusterIndex= u32Temporal/FAThandle->u16FAT_Sector_Size;
Thank you for this bug correction. However, right now i'm using a better FAT file system implementation. This new file system supports FAT32 and directory structures. You can download the code in this links:
Coldfire JM128 Demo:
http://brtos.googlecode.com/files/TWR-LCD-FatFS.rar
Coldfire QE128 Demo:
http://brtos.googlecode.com/files/BRTOS%20CFV1%20SD%20Card%20%2B%20FatFS.rar