hug35
June 22, 2012, 12:16pm
#1
Hi, i’m using an arduino uno board with NFC shield and SD card shield. I’m trying to use these two devices : nfc and sd card , together. But i can’t do it. It seems to be a problem with the pin MISO of the SD Shield. Indeed, immediately i’m wiring the MISO of the SD Shield , The system bugs or crashes. I can’t initialize them
Is there any solution to use the nfc and sd card shield together ?
hug35
They use both the same interface (SPI Pin 10, 11, 12, 13).
arduino.cc/en/Reference/SPI
Look at “Slave Select pin”
hug35
June 26, 2012, 8:19am
#3
Yes, i know this is SPI, but it doesn’t even work for the setup part. Here is my code :
#define SCK 13
#define MOSI 11
#define SS 10
#define MISO 12
File myFile;
File tromb;
int cs_sd = 9;
PN532 nfc(SCK, MISO, MOSI, SS);
void setup(void) {
pinMode(cs_sd, OUTPUT);
Serial.begin(9600);
Serial.println("begin");
Serial.print("Initializing SD card...");
digitalWrite(cs_sd, LOW);
if (!SD.begin(cs_sd)) {
Serial.println(“initialization failed!”);
//return;
}
else {
Serial.println(“initialization done.”);
}
Serial.println(“Creating les 2 fichiers …”);
myFile=SD.open(“histo.txt”, FILE_WRITE);
myFile.close();
tromb=SD.open(“trombi.txt”, FILE_WRITE);
tromb.close();
if (SD.exists("trombi.txt")) {
Serial.println(“trombi.txt exists.”);
}
else {
Serial.println(“trombi.txt doesn’t exist.”);
}
if (SD.exists(“histo.txt”)) {
Serial.println(“histo.txt exists.”);
}
else {
Serial.println(“histo.txt doesn’t exist.”);
}
SPI.end();
delay(5000);
nfc.begin();
Serial.println("getFirmwareVersion");
uint32_t versiondata = nfc.getFirmwareVersion()
;
if (! versiondata) {
Serial.print("Didn't find PN53x board");
while (1); // halt
}
// Got ok data, print it out!
Serial.print("Terminal Fidelite - SILICOM");
Serial.println((versiondata>>24) & 0xFF, HEX);
Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
Serial.print("Supports "); Serial.println(versiondata & 0xFF, HEX);
// configure board to read RFID tags and cards
Serial.println("SAMConfig");
nfc.SAMConfig();
Serial.println("Reading NFC Card ...");
But i don’t know why, i have already some trouble to get work the sd card
hug35:
int cs_sd = 9;
?
Why do you use this Definition? The problem is: both devices use absolut the same pins. This doesn’t work.
hug35
June 26, 2012, 12:08pm
#5
I put the chip select sd card on pin 9 of my arduino uno
and the chip select nfc shield on pin 10 of my arduino uno too
Then, because these two devices work in SPI, they should share the same pins : MISO,MOSI, CLK. Am i wrong ?
How did you do this?
hug35:
Then, because these two devices work in SPI, they should share the same pins : MISO,MOSI, CLK. Am i wrong ?
No you are right. Only SS needs a extra Pin per device
hug35
July 3, 2012, 7:50am
#7
To avoid the problem of chip select, i do not plug the two shields directly to the arduino uno. I did a wiring near the uno.
But i solve my problem, i’ve just had (just ^^) a supply problem. My usb wasn’t strong enough…