Interaction between built-in SD card and MFRC522

Status
Not open for further replies.
I'm having an issue with SdFat using the in-build SD card, an attached RFID reader using the MFRC522 library.

The project has been migrated from an Arduino, where it has been running for several years using the MFRC522 and an I2C memory chip.

I'm now switching to using the built-in SD card on the Teensy 3.5.

The RC522 module is being read, and tag scans being logged to the SD card.

However the issue I'm getting is as soon as the SD card writes, the MFRC522 library dies and no further reads are possible.

Using the old I2C chip everything is fine, so I know the core of the system is functional on the Teensy.

I'm guessing it might be due to them both using the same SPI interface, but I cannot find out conclusively how the Teensy talks to the SD card.

I'll put together a small test program to show what I'm doing (no way it can be posted at the moment due to the size of the project!).

In the meantime, is this a known issue?

How can I make the MFRC522 library use a different SPI interface, or is there a different library that's capable of that?



Jim
 
Are you starting the SD card with code similar to this?
Code:
  if (!SD.begin(BUILTIN_SDCARD)) {
    Serial.println("initialization failed!");
    while (1);
  }
  Serial.println("initialization done.");
If you use SD.begin(10), Teensy will use the normal SPI interface on pins 10, 11, 12, 13 which will conflict with the MFRC522.

Pete
 
Are you starting the SD card with code similar to this?
Code:
  if (!SD.begin(BUILTIN_SDCARD)) {
    Serial.println("initialization failed!");
    while (1);
  }
  Serial.println("initialization done.");
If you use SD.begin(10), Teensy will use the normal SPI interface on pins 10, 11, 12, 13 which will conflict with the MFRC522.

Pete

Note is SdFat is in use so one examples for SdFat shows this:
Code:
[B]// SDCARD_SS_PIN is defined for the built-in SD on some boards.[/B]
#ifndef SDCARD_SS_PIN
const uint8_t SD_CS_PIN = SS;
#else  // SDCARD_SS_PIN
[B]const uint8_t SD_CS_PIN = SDCARD_SS_PIN;[/B]
#endif  // SDCARD_SS_PIN

With current TD 1.54 Beta SdFat is now included - that code is from an example there
 
Note is SdFat is in use so one examples for SdFat shows this:
Code:
[B]// SDCARD_SS_PIN is defined for the built-in SD on some boards.[/B]
#ifndef SDCARD_SS_PIN
const uint8_t SD_CS_PIN = SS;
#else  // SDCARD_SS_PIN
[B]const uint8_t SD_CS_PIN = SDCARD_SS_PIN;[/B]
#endif  // SDCARD_SS_PIN

With current TD 1.54 Beta SdFat is now included - that code is from an example there

Thanks for the sense-check, SDCARD_SS_PIN is defined as 62, SdFatConfig.h confirms this is for the built in SD.

The card is working fine with straight calls, it's when I'm in the RFID reading loop things fail.

Will do some more digging.
 
For sure as el_supremo noted though - using that builtin SD card path uses nothing of any shared SD pins - it has distinct 4 bit data SDIO pins for access.

Accessing the SD card will make some 'noise' and use a good deal of extra power to feed the card's function.
 
Status
Not open for further replies.
Back
Top