SPI multi slave with NFC PN532 and SD Card

maxouille

  • Newbie
  • *
    • Posts: 3
    • View Profile
Hi guys !

I encountered some problems with TinyDuinos.

So I want to connect a PN532 from adafruit (http://www.adafruit.com/products/789) in SPI and a SD card from Tiny-Circuits (https://www.tiny-circuits.com/tiny-shield-micro-sd.html) which is already in SPI on pin 10.

I put the SS pin of the NFC board on IO4. When i use the NFC board or the SD Card separately it works fine.
However, when i try to initialize both, the SD Card failed and the NFC board too.
I suppose it's because SD use pins that NFC need or inverse.

Here is my code, very simple sketch :

Code: [Select]
#include "PN532_SPI.h"
#include "PN532.h"
#include "NfcAdapter.h"

#include <SPI.h>
#include <SD.h>

/** NFC ATTRIBUTES */
PN532_SPI interface(SPI, 4); // create a PN532 SPI interface with the SPI CS terminal located at digital pin 10
NfcAdapter nfc = NfcAdapter(interface); // create an NFC adapter object

void setup() {
  Serial.begin(9600);


 if (!SD.begin(10)) {
  Serial.println(F("failed"));
 }
 else {
  Serial.println(F("success"));
 }

  nfc.begin();
}

void loop() {
  // put your main code here, to run repeatedly:

}

I use this libraries :
NFC : Seed studio
SD : Adafruit SD

Thank you very much !

Maxouille


 

SMF spam blocked by CleanTalk