I'm still having trouble with the uFat library, so I decided to try some of the other options.
I tried Roland's library but had trouble compiling. It gave a lot of 'outside C99' errors, which I started to go through and fix, but obviously something else is wrong there so I stopped. Should that library not work with the Arduino 0015 compiler?
I then tried the Fat16 library from Greiman. This is a great package, very well documented with many example sketches and I was able to open and compile them with no problems. When running them however I keep getting card errors. I also tried a new SD card and am still having troubles.
I thought there may be problems with the hardware setup and reviewed it several times but it's very simple wiring (the resistor divider design) and I don't see any issues. I put a logic analyzer on it and can observe SPI data which appears to follow what the code is doing. Using 4.7k and 10k resistors I'm getting voltages around 3.4V - does anybody feel that might be too high for the SD cards? Also, any issue with using the 3.3V supplied by the Arduino? I understand that comes from the regulator inside the FTDI chip, which I think is limited to 50mA. I measured the current going to the SD card board and it was only about 6-8mA, but I had trouble using the supply from that chip on another board. It seems others are using that supply for this purpose, so I thought I would be OK.
I'm going to use the scope next to see if I'm having problems with attenuation or anything else that might be interfering with the communications.
Using the Fat16 library I get the following errors:
With the 2G SanDisk SD:
FreeRam: 1288
readCID failed
With the 16MB MMC and 32MB SD cards:
FreeRam: 1288
card.init failed
SD error
errorCode: 2
errorData: 3
or sometimes:
FreeRam: 1288
card.init failed
SD error
errorCode: 1
errorData: FF
According to the SDCard header, error code 1 is "Card did not go into SPI mode", and error code 2 is "Card did not go ready".
This is quite frustrating, since I've seen so many people get these libraries working 'out of the box'. I have some pressing needs now, so I think I will go back to a Flash chip on SPI for the moment, but I would love to have this functionality working for future projects.
Anybody with advice on where to look or what to try, would be greatly appreciated.
Regards,
Angelo