FAT INIT ERROR using FAT32 Library

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

FAT INIT ERROR using FAT32 Library

#1 Post by Rotary_Ed » 17 Oct 2014 17:06

I have incorporated a data logger in my latest project using external FRAM memory chip. To download the data I use a Flash Drive and the PIC32MX795F512H OTG USB module as well as the MK USB Host, FAT32 libraries. Progress was made (if somewhat painfully and slowly), but finally got to the point of downloading the data to the flash drive. That all went well until the first time I tried to use a different Flash Drive (same manufacture and model) and I would receive a "FAT INIT ERROR" message.

I tried a number of different Flash drives and got the same error on all - but the one I had been using. After some research this is what I found was necessary to use a Flash Drive with the MK FAT32 Library.

The Flash Drive had to be formatted using the FAT32 format with 512 bytes/sector and the partition of the Flash Drive had to be designated "PRIMARY" - if designed "LOGICAL" - it would not function properly with my implementation of the FAT32 library. But, there was one other requirement that caught me a bit by surprise. I had noticed that when I got format information from my one "good" flash drive, it was showing 16384 bytes/Cluster.

Well, it was not until I had also formatted the new drives with the parameter Bytes/Cluster (some times the formatters use Bytes/Allocation unit) set to 16K that they worked with my project.

Don't know if anyone else has encounter this problem, but this is what worked for me and thought I would share it.

Apparently with the much larger capacity (multi GB) of the newer flash drives, the manufactures are going to larger size clusters to speed things up a bit.

In any case, this was my experience
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: FAT INIT ERROR using FAT32 Library

#2 Post by phil31 » 18 Oct 2014 21:52

thanks for your feedback !

regards

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: FAT INIT ERROR using FAT32 Library

#3 Post by Rotary_Ed » 18 Oct 2014 22:46

Welcome, Phil

I must admen my previous message. Later on, I tried a different Flash Drive and formatted it with 4K per cluster and found it worked as well as the ones I had formatted at 16K per cluster. So perhaps the cluster requirement is not the critical parameter I thought it was. The MK FAT32 recognized and reported the later drive as 4096 or a nominal 4K and the drive worked just fine.

All formatting was done with Windows 7 64 bit operating system.
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Post Reply

Return to “mikroPascal PRO for PIC32 General”