chipKIT® Development Platform

Inspired by Arduino™

SD library

Created Mon, 21 Jan 2013 20:05:50 +0000 by spencoid


Mon, 21 Jan 2013 20:05:50 +0000

i have been messing around with the SD card library as ported to chipkit for a while now. it is quite the unreliable thing. cards formatted differently work differently and some times not at all. i need a reliable way to write to SD cards and would prefer something faster than SDfat.

i can not figure out how to get FatFs to work from Arduino and don't have months to figure it out.

is there any reliable option to get SD cards working correctly on the Chipkit? i am ready to go back to Arduino. the few advantages of Chipkit are not worth the trouble of all sorts of problems with libraries not working.


Mon, 21 Jan 2013 22:55:18 +0000

Your best bet is to scrap the MPIDE all together, use MPLAB-X, and use the MDDFS library from Microchip - it's in the Application Library downloadable from MCP.


Mon, 21 Jan 2013 23:19:36 +0000

thanks, i'll check that out. there are many other problems with MPIDE so i have no problem dumping that. i am also looking for an Atmel based board that has good support because i am really tired of trying to get this chipkit stuff to work. i spent two days debugging my code when the problem was yet another bug in the SD library. at least i got the code absolutely perfect :) the behavior was so arbitrary based probably on the location of the file on the card that it seemed totally random and drove me nuts. depending on the formatting of the card, some work and some don't.

also seems that this particular bug is in the read routine only because the data on the card is correct when read with the PC. my emulator had no problem with the files just the read by the micro.


Tue, 22 Jan 2013 00:12:50 +0000

i can not find the application library download. any hints on where to find it? what do you mean by MCP is that microchip or someone else?


Tue, 22 Jan 2013 00:17:27 +0000


Yes, MCP is MicroChiP.


Tue, 22 Jan 2013 19:26:35 +0000



Thu, 22 May 2014 22:31:01 +0000

How complicated would it be to get the SD portion of the Microchip Application Library to work with MPIDE? I tried including a few of the header files into my sketch and it seems to lead to many errors very quickly as I add in more files. Also, the fact that it's written in C causes some problems since I noticed some variables named as keywords like final and private. The reason I'm asking is because I have little to no experience with MPLAB.

I have been working on a project which is written in the C++ format of MPIDE and I'm trying to add the SD functionality to log some sensor data. I've been using MPIDE for convenience since it made serial communications easy. Would MPLAB easily let me port my Classes over or would I have to convert everything to a C format? This is something I don't actually have time for, since there's a deadline to meet.


Thu, 22 May 2014 23:07:37 +0000

It's already been done. You want the chipKITMDDFS library from Digilent. It's on their site somewhere, but I forget where (linked from one of their boards pages). It's part of larger zip file of libraries (including the USB libraries etc).


Fri, 23 May 2014 16:41:21 +0000

Alright, so I found the library you mentioned and apparently it only wraps the sections for use with USB. I have the uC32 board which doesn't appear to have the USB functionality required. I thought I would just simply need to set up the correct defines to get it working with SPI but even the single example provided with for USB doesn't compile out of the box...

The only reason I started investigating this path is because the SD library included with MPIDE hasn't been working for me. I don't think it's the library though since I did manage to get it working on a previous project with this Adafruit breakout board.

Unfortunately I don't have access to this anymore.

I posted in another topic about my current hardware and problem.

I just bought a Wifi shield with an SD card mount on it in the hopes that this will somehow magically fix everything but any help on this subject would also be greatly appreciated.


Wed, 28 May 2014 18:33:05 +0000

Alright so I just received my chipKit Wifi Shield and SanDisk Extreme PLUS 64GB microSD card which I formatted to FAT32 using guiformatter. I inserted my SD card into the shield and mounted the shield onto the chipKit making sure that JP4 was set to RD4 (supposedly pin 10 in sketches). I upload the CardInfo sketch onto my board and voila!... Disappointment and frustration as I no longer seem to have any clue how to get this darn thing to work.

This is done using the 20140316 version of MPIDE for the latest sketches so CardInfo was not modified in any way in terms of pins or otherwise.

Any clues?

EDIT: Jumped the gun on this one. Thanks to a post by Jacob Christ, I switched to pin 4 seeing as this is the correct one for the SD card and 10 is for the WIFI. Working now. Thanks to all those who post on this forum!