Formatting FAT16 under Mac OSX
Moderators: adafruit_support_bill, adafruit

Formatting FAT16 under Mac OSX

by tankstar on Sat Sep 13, 2008 2:13 am

Hi there,

Let begin by saying that I'm really excited that you're making this shield.
Now for the issues. I soldered together the board as specified. I've downloaded the digital audio player example. When I first run it, I got an error saying that the file format was not supported. I had popped in an SD card that I'd been using in an Edirol MP3 recorder. So then I went back and read the instructions some more and realized that the card needed to be formated as FAT. Then I spent 2-3 hours figuring out how to that on a Mac OSX Leopard
-disk utility formated it as FAT32
-tried the command line without success(never been particularly good at it)
-purchased i-partition and formated it to FAT16

I'm still getting the following message:


"Wave test!
Couldn't open filesys"

Is this a formating porblem or should I be checking my soldering at this point?
tankstar
 
Posts: 3
Joined: Sat Sep 13, 2008 2:03 am

by adafruit on Sat Sep 13, 2008 2:18 am

if its at the file system check it is talking to the card just fine but it cant find the partition. im planning on rewriting some of this code to at least provide better feedback but unfortunately i cant do that for a week because im out of town :(
User avatar
adafruit
 
Posts: 11689
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by tankstar on Sat Sep 13, 2008 2:22 am

No problem,

What's the best solution. Should I get another card that I know it FAT16 formated. Or should I try to just format the card I have on a PC?
tankstar
 
Posts: 3
Joined: Sat Sep 13, 2008 2:03 am

Solved!

by tankstar on Sat Sep 13, 2008 2:56 am

Got it. I'm playing your hello world. This is probably helpful for other Mac users so here is the link for how to reformat your SD card for FAT16:

http://discussions.apple.com/thread.jsp ... ID=1302331

Here is the instructions by infogeek2:

To format the SD card, you will need the path to the SD card device and the SD card device number.
1. Insert the SD Card into a card reader.
2. If you don't know how to find the device number of the SD Card, here is one way to do it:
2b. Open Disk Utility
2c. Highlight the SD Card device (upper icon), not the SD Card volume (lower icon)
2d. Click Erase at the top of the window
2e. Select Volume Format: MS-DOS (FAT) Click Erase... > Click Erase
The SD Card Volume Name will change to the UNIX device number e.g. "disk5s1". Note this number as it will change by itself to "Untitled". It is now formatted in MS-DOS FAT 32. We need to reformat it in FAT 16.

Once you have the device number of the SD Card, you need the path to the SD card device.
3. For my Mac, the path to devices is "/dev". In a terminal window: type "cd /dev" and hit the "Return" key to go to the "dev" directory. Then type "ls" (with a lower case L) and "Return" key. You should see the SD Card device number listed.

Formatting the SD Card in FAT 16:
4. In Disk Utility, highlight the SD Card device and click Unmount at the top, not Eject. The desktop icon of the SD card will disappear.
5. Go to the Terminal window. Be careful to type the following command with the correct letter case and spacing. Again, make sure you type the correct device number and path as you can very easily erase your hard drive in UNIX.
Type the command:
newfs_msdos -F 16 (path to SD Card device)/(SD Card device number)
e.g. newfs_msdos -F 16 /dev/disk5s1
and hit the "Return" key.
6. If you get just a new prompt (or a prompt with some warnings, e.g. below), the command executed successfully. You can remove the SD Card; it is now formatted in FAT 16. You can verify this in Disk Utility after mounting the SD Card.
If you get some instructions on the newfs_msdos command with a new prompt, the command did not execute. Make sure you enter the command with the correct case and spacing. Hint: to re-enter a previous command you typed, hit the up arrow repeatedly. For more information, type: "man newfs_msdos". Scroll with arrow keys. Type "q" to quit and return to prompt.

Warnings Example
newfs_msdos: warning: /dev/disk5s1 is not a character device
/dev/disk5s1: 1998208 sectors in 62444 FAT16 clusters (16384 bytes/cluster)
bps=512 spc=32 res=1 nft=2 rde=512 mid=0xf0 spf=244 spt=32 hds=128 hid=0 bsec=1998738
tankstar
 
Posts: 3
Joined: Sat Sep 13, 2008 2:03 am

by adafruit on Sat Sep 13, 2008 5:56 pm

wow thanks, that is excellent advice! i will sticky it
User avatar
adafruit
 
Posts: 11689
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Formatting FAT16 under Mac OSX

by halley on Wed Dec 24, 2008 2:41 pm

Simpler yet, a Wii homebrew board suggested the following single command line:

Code: Select all | TOGGLE FULL SIZE
diskutil partitionDisk /Volumes/WII 1 MBRFormat "MS-DOS FAT16" "WII" 1000M


This assumes the SD was formatted in some format, but the old format doesn't matter. The /Volumes/WII mentioned above refers to the OLD name already given the card, this directory is where Mac OS X mounted the old file system. The NEW name given the card is the second "WII" string shown above. The 1000M number is arbitrary, the whole SD will be given to one partition. It will be remounted automatically, so don't forget to tell Mac OS X to "Eject" it before yanking it from the card reader.

(Due to the fat16 support in AF_Wave, it will return the volume name, e.g., "WII", as a filename, but it will find a size of 0 bytes. The "correct" way to deal with this is to notice that it's got the volume name attribute. Even without that, it's a benign sort of error.)
[ e d @ h a l l e y . c c ]
User avatar
halley
 
Posts: 72
Joined: Fri Nov 21, 2008 11:07 pm

Re: Formatting FAT16 under Mac OSX

by salsaman on Sun Jan 11, 2009 3:15 pm

I'm trying to get a test sketch working, but receive the "Can't open filesystem" error, with three flashes...:(

UPDATE: I get the same error with a "fresh" 16MB SD card, formatted the same way with diskutil... [scratches head]

I'm running a Mac so unfortunately can't try the Panasonic program mentioned in the other thread. I formatted it (256MB card) with the command-line diskutil, and it checks out as FAT16. I wonder, though, if the Mac is messing it up with the dotfiles? "reformat" doesn't seem to get rid of them. Poking around in a shell:

Code: Select all | TOGGLE FULL SIZE
salsabook2:~ salsa$ diskutil reformat /Volumes/LOGGER/
Started erase on disk disk3s1 LOGGER
Erasing
Mounting disk
[ + 0%..10%..20%..30%..40%..50%..60%..70%..80%..90%..100% ]
Finished erase on disk disk3s1 LOGGER
salsabook2:~ salsa$ diskutil info /Volumes/LOGGER/
   Device Identifier:        disk3s1
   Device Node:              /dev/disk3s1
   Part Of Whole:            disk3
   Device / Media Name:      Untitled

   Volume Name:              LOGGER
   Mount Point:              /Volumes/LOGGER
   File System:              MS-DOS FAT16

   Partition Type:           Microsoft Basic Data
   Bootable:                 Is bootable
   Media Type:               Generic
   Protocol:                 USB
   SMART Status:             Not Supported

   Total Size:               243.0 Mi (254758912 B) (497576 512-byte blocks)
   Free Space:               242.5 Mi (254312448 B) (496704 512-byte blocks)

   Read Only:                No
   Ejectable:                Yes
   Whole:                    No
   Internal:                 No

salsabook2:~ salsa$ ls -lat /Volumes/LOGGER/
total 64
drwxrwxrwx  1 salsa  salsa   4096 Jan 11 11:07 .fseventsd
drwxrwxrwx@ 1 salsa  salsa   4096 Jan 11 11:07 .Trashes
drwxrwxrwx  1 salsa  salsa  16384 Jan 11 11:07 .
drwxrwxrwt@ 6 root   admin    204 Jan 11 11:07 ..
drwxrwxrwx  1 salsa  salsa   4096 Jan 11 11:07 .Spotlight-V100
-rwxrwxrwx  1 salsa  salsa   4096 Jan 11 11:07 ._.Trashes
salsabook2:~ salsa$


So, no "regular" files, but the Finder won't seem to let it be really empty. I'm stumped...

Any ideas would be greatly appreciated!
salsaman
 
Posts: 25
Joined: Thu Sep 27, 2007 2:53 am
Location: sf ca

Re: Formatting FAT16 under Mac OSX

by salsaman on Wed Jan 14, 2009 1:21 am

FWIW tankstar's method worked perfectly for formatting the SD cards-- I'm logging temperatures right now! The shorter version posted by halley resulted in the initialization error.

Lesson: try everything!
salsaman
 
Posts: 25
Joined: Thu Sep 27, 2007 2:53 am
Location: sf ca

Re: Formatting FAT16 under Mac OSX

by kmarinelli on Tue May 05, 2009 6:36 pm

MacOS in its wisdom assumes that there are a few necessary files that need to be included in each file system. These files help MacOS with its book keeping for the Finder.

Another useful hint about finding the device name easily is to use the "df -h" command to get a list of mounted disk devices.
kmarinelli
 
Posts: 5
Joined: Tue May 05, 2009 6:33 pm

Re: Formatting FAT16 under Mac OSX

by jmsaavedra on Tue Dec 01, 2009 4:33 am

you know when you google "format sd card fat16 osx" this thread is the second result. thanks for saving my ass ;)
jmsaavedra
 
Posts: 10
Joined: Sat Nov 28, 2009 10:05 pm
Location: NYC

Re: Formatting FAT16 under Mac OSX

by adafruit on Tue Dec 01, 2009 1:30 pm

we have a lot of g00glef00 here - great posts by customers :)
User avatar
adafruit
 
Posts: 11689
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc