How to initialize internal SPI pins on MKRFOX1200 in Arduino IDE

Hello guys, I recently acquired an MKRFOX1200 board. I was tinkering about with it when I decided to hook up an SPI interface. My choice was an RC522 rfid card reader.
After hooking up the MOSI, MISO & SCK pins as labelled on the MKRFOX, I modified a dumpInfo example with my respective SS & RST on the CCT. Now after uploading the code, I indeed got the RC522 Hex Address, but the reader wont read any tags i placed on the reader. What could I be doing wrong in this setup?
The SPI.h library under the SAMD folder is available but somehow not invoked.

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN         5          // Configurable, see typical pin layout above
#define SS_PIN          4         // Configurable, see typical pin layout above

MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance

void setup() {
	Serial.begin(9600);		// Initialize serial communications with the PC
	while (!Serial);		// Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
	SPI.begin();			// Init SPI bus
	mfrc522.PCD_Init();		// Init MFRC522
	delay(4);				// Optional delay. Some board do need more time after init to be ready, see Readme
	mfrc522.PCD_DumpVersionToSerial();	// Show details of PCD - MFRC522 Card Reader details
	Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
}

void loop() {
	// Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
	if ( ! mfrc522.PICC_IsNewCardPresent()) {
		return;
	}

	// Select one of the cards
	if ( ! mfrc522.PICC_ReadCardSerial()) {
		return;
	}

	// Dump debug info about the card; PICC_HaltA() is automatically called
	mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

I miss the wiring diagram and the link to the breakout board you're using. Take care that you use a board for 3.3V MCUs, most MFRC522 boards available for Arduinos are made for 5V MCUs.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.