Go Down

Topic: SD: different hardware and different libraries SOLVED (Read 1 time) previous topic - next topic

cantore

Jul 05, 2011, 04:46 pm Last Edit: Jul 05, 2011, 05:47 pm by cantore Reason: 1
Hello. I am using sdFatLib (the one included with arduino version>22 ) with the ethernet shield http://www.arduino.cc/en/Main/ArduinoEthernetShield and it works perfectly.
I am using fat16 lib (william greiman ) http://code.google.com/p/fat16lib/ on the seeeduino stalker (v1 and v2) and it works very well.
But if I try fat16 lib on the ethernet shiled or the SD lib included in arduino ide on the stalker in both cases they don't work.
I have checked pins on both boards and they seems to be the same. Any idea of what must be changed to adapt the libraries with the different hardware?
thanks in advance

cantore

#1
Jul 05, 2011, 04:58 pm Last Edit: Jul 05, 2011, 05:46 pm by cantore Reason: 1
ok, the problem is that on ethernet shield the CS is on pin 4 on the stalker on pin 10. So if you want to use fat16lib with eternet shield go on SdCard.h and change
Code: [Select]
uint8_t const SPI_SS_PIN   = 10;
with
Code: [Select]
uint8_t const SPI_SS_PIN   = 4;

if you want to use the included Sd library with the stalker change
Code: [Select]
SD.begin(4)
with
Code: [Select]
SD.begin(10)

fat16lib

For the Fat16 library you can also change the cs pin in the card init call.

For SPI at 8MHz on an Uno:
Code: [Select]
  card.init(0, csPin);

For SPI at 4 MHz on a Uno:
Code: [Select]
  card.init(1, csPin);

SPI is always 4 MHz for SD.begin(csPin).

Go Up