Compact Flash Cards for AB Logix

E

Thread Starter

Evan

Found thing out the hard way. Compact flash cards have changed their FAT16 structures somewhat recently. AB told us that there are some subtle differences in the parameters that Windows could probably not change with its tool. Does anyone know of a third party utility that can format CF cards to mimic the system that AB uses? The newer cards seem to load the project into the controller, but start looping the load procedure.
 
M

Michael Griffin

The description you gave of the problem could indicate problems with either the format or the partition table. In addition, I can't tell you what AB wants to see on the card. I can however think of a couple of solutions. There's the easy way, and the hard way.

You asked about how to do things the hard way, which is formatting and/or partitioning the card. I will describe the easy way first though.

For the easy way you need a CF card that is "good" (AB likes it) that is exactly the same size (capacity) as the "bad" card. You also need a program that will let you image and restore a drive without worrying about what is on the drive. A good example of that is "dd" (disk duplicate), which comes with Linux, Mac OS/X, or any Unix or BSD.

1) First make a copy of the "good" card. If you are using "dd", then the following will work "dd if=/dev/sdb of=abgood.img". Substitute "/dev/sdb" for whatever the actual USB device is (e.g. /dev/sda). Change "abgood.img" to whatever it is you want to call the output file.

2) You will now have a file on your PC called "abgood.img" (or whatever you called it).

3) Un-mount (eject) the "good" card and insert the "bad" card.

4) The "bad" card should be auto-mounted. Unmount it, but leave it inserted. To unmount it, left click on the icon on your desktop (assuming you are using Gnome), and select "unmount".

4) Copy the image file onto the "bad" card using "dd" again. "dd if=abgood.img of=/dev/sdb" (again, substitute whatever the actual filename is instead of "abgood.img", and whatever the actual USB device is instead of "/dev/sdb"). MAKE SURE YOU ARE COPY THE IMAGE TO THE CORRECT DEVICE.

5) When this is done, type "sync" to make sure all the changes are written out (instead of being buffered). You should have a new card that is an exact duplicate of the original. Pull out and then re-insert the card to have a look at it.

You will probably want to keep a copy of the image file so you can do this again in future without needing a "good" card to copy. If so, it would be a good idea (but not mandatory) to do the following:

a) Make sure the "good" card is completely empty, or at least as empty as a new card. If you delete any unwanted files, use "shift delete" to make sure the files are really gone (as opposed to being put into a hidden trash bin directory).

b) Fill the "good" card with a large file of "zeros". You can do this as
follows: "cat /dev/zero > /media/abcard/zero.txt" (substitute
for "/media/abcard/" the actual mounted path name for the CF card - i.e. use the name you use to see what is on the disk, not the "/dev/sdb" type name).

c) When you get an error message similar to "cat: write error: No space left on device", then the disk is now full.

d) Delete the "zeros.txt" file completely (i.e. use "shift delete").

e) You should now have a card where all the unused space is filled with zero, as opposed to containing random deleted junk.

f) Make the "good" image file using the means described above. This should compress very nicely (e.g. with gzip) because the resulting image is almost completely filled with "zeros". For example, a 1 Gig USB flash drive image will compress down to about 2 Meg if you zero it out first.

The hard way to do this is to use a partition editor and/or disk formatting utility. This is the hard way because we don't know what settings you have to use so it may take a lot of trial and error.

For a graphical partition editor, try GPARTED-LiveCD. This is a live CD with a minimal Linux OS and a special tiny (and rather ugly) GUI. You run the program by burning it to a CD and then booting a PC from the CD. You would normally be using this type of software to partition and format a hard drive, so it makes sense to do it this way when using it for its intended purpose.

You can download it (free) from http://gparted-livecd.tuxfamily.org/ and burn your own CD. There are also instructions for turning this into a bootable live USB version (to run it from a USB flash drive).

The graphical utility is intended for typical hard drive partitioning duties, so it may not do everything. There are some command line utilities which come on the same disk which may give you more control. These include:

A) parted - disk partitioning. B) fdisk - disk partitioning. C) disfsck - check and repair MS-DOS file systems. D) mkdosfs - create an MS-DOS file system.

The man (manual) files don't seem to be on the CD, so you would need to look up the information on the internet.

I can give you more information on using these if you are interested.

One of these utilities states in its manual " -h number-of-hidden-sectors. Select the number of hidden sectors in the volume. Apparently some digital cameras get indigestion if you feed them a CF card without such hidden sectors, this option allows you to satisfy them." From this it appears that AB is not the only one to have problems with disk format. You might try formatting this card in a camera, and seeing if *that* works (and then making an image of it for future use).

There is also another problem mentioned about how the partition and format utilities which come with MS-DOS 6.x have bugs that cause problems for any software trying to work with them. If you format using certain versions of MS-DOS, that might be part of your problem.

The vfat disk "format" is used pretty widely as a crude but workable way of exchanging information between otherwise incompatible systems. In particular, it was probably the only practical way to have recorded media readable by MS-Windows at the time that digital cameras came out (which was the biggest market for these cards).

However, it isn't really a defined format so much as a reverse engineered one. Microsoft doesn't tend to plan these things out in advance and document them. They just hack away at a product until they think they can ship it, and the "format" is just whatever it happened to be when they shipped it.

This is the same for their a lot of their stuff, whether it was disk formats, file formats, or communications protocols. In a lot of cases Microsoft did no documentation whatsoever, and whatever documentation exists was reverse engineered by outsiders who were trying to work with their products. For their older formats, most of the original programmers have retired or moved on, and *nobody* is left at Microsoft who knows how it works.

Microsoft even has problems with their newer products. They tried to document the new file formats for their newest version of Microsoft Office (MS Office 2007), but the file format specifications turned out to be a pile of rubbish with thousands of errors or missing pieces of information. For what they do have documented, they have numerous definitions like "space like in Word95", which they admit they have no idea what it does. They just paste old code into new software and whatever comes out is what they get.

The end result is problems like the one we are talking about here. I don't really blame AB for this situation. It's pretty much inevitable when things are done this way.
 
Top