Hello,
I am working on a small project that uses an Arduino compatible board (Teensy 3.2), an RFID module (Velleman VMA405) and the microSD module from an LCD display (Velleman VMA412) .
I can't make the RFID and SdFat libraries working together. Here is a simple test code:
#include "spi4teensy3.h"
#include "RFID.h"
#include <SdFat.h>
#define RFID_CS 10 // RFID board ChipSelect signal
#define RFID_RST 9 // RFID board Reset signal
#define SD_CS 16 // SDcard ChipSelect signal
RFID rfid(RFID_CS,RFID_RST);
SdFat SD;
void setup() {
Serial.begin(9600);
SPI.begin();
delay (100);
rfid.init();
delay (100);
//SD.begin (SD_CS, SD_SCK_MHZ(10));
}
void loop() {
while (true) {
if (rfid.isCard()) {
char msg[50];
rfid.readCardSerial();
sprintf (msg,"RFID: %i,%i,%i,%i,%i",rfid.serNum[0],rfid.serNum[1],rfid.serNum[2],rfid.serNum[3],rfid.serNum[4]);
Serial.println (msg);
}
}
}
As soon as I uncomment the "SD.begin() line", I can't no longer read any RFID tags. Even if I physically disconnect the microSD module. I tried to swap RFID and SDFat initialisation code, but same result.
Also, if I remove the "delay()" after the "SPI.begin()", the reader is no longer working
I am using SDFat 1.0.5 from Bill Greiman and the RFID Library from Miguel Balboa (Jan, 2012).
Thanks for any suggestion.