Tuesday, February 22, 2011

SDCARDmodded library

I was looking for raw SDcard code, of the type that does not create, write and/ or append files. I was looking for something simple that would allow me to increase the memory space of my arduino and would provide a simple interface to save bytes to the card.

There are quite a few SD card libraries but they are all way more complex than what I needed, but some days ago I came across the SDCARD library at the arduino forums. I love what carl47 writes in the forum:

It reads and writes directly to sectors on a sd card.
It's use is for mass storage on the arduino platform. 
It's not to store data and then load it(without a special program) to a PC.

It's a dream, exactly what I needed!

It had all I wanted but just a small problem: it defaulted to the basic SPI comms using D10 of the arduino as the SS pin. Furthermore, it used its own implementation of SPI comms. I needed to easily hange the SS pin to whatever Digital pin I wanted and I needed it all the work with the other SPI devices.

Because the other SPI devices are using the SPI library that comes with the arduino IDE, I had to change the SDCARD library to allow me to:

1. use the standard SPI.h lib instead of its own implementation
2. Allow me to use any digital pin

So I changed it to the SDCARDmodded library that you can download here (unzip, place folder on your arduino/libraries folder ans restart the IDE.

library tested with IDE022.

Have fun.

No comments: