ST25R3911B and Arduino SPI not working
Hi,
I am trying to get an SPI connection working with my Arduino UNO and the ST25R3911B. I am trying to read the identity register 3Fh but am not getting a response on MISO.
My setup is as follows:
*VDD & VDD_IO connected with 5V from the Arduino UNO without filtering.
*Ground provided by Arduino since it provides the 5V too.
*Pins AGD, VSS, VSP_A, VSN_A, VSP_D, VSN_D, VSP_RF, VSN_RF, and pin 33 VSS are grounded as shown in Figure 2 or 3 in the datasheet using decoupling capacitors of 10nF and 2.2uF as stated in the DISCO and layout documents.
*13.56MHz crystal is not connected for now since I am only trying to get an SPI connection working for an inital test.
*Using a 10k pull-down resistor from MISO to GND since without it I saw a lot of noise on MISO after and while sending the 3Fh command to read the identity register.
*I am sending 10h to register 01h before the 3Fh command so that the RFID IC knows a pull-down resistor is being used.
*I am not using a particular SPI frequency since I should be slow enough and not going too fast for the IC.
*ST25R3911B IC is soldered to a breakout board with male headers and then placed in a breadboard.
*Arduino to ST25R3911B pin connections:
-Arduino SS GPIO pin 10 -> ST25R pin 32
-Arduino MOSI GPIO pin 11 -> ST25R pin 31
-Arduino MISO GPIO pin 12 -> ST25R pin 29
-Arduino SCK GPIO pin 13 -> ST25R pin 31
Below is my Arduino code (probably not that helpful) and a screenshot of the commands being sent using a logic analyzer:
CODE:
const byte SS_PIN = 10;
const byte MOSI_PIN = 11;
const byte SCK_PIN = 13;
byte bitArray[16] = {0x01, 0b00010000, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
// Function is only run once
void setup() {
Serial.begin(115200);
pinMode(SS_PIN, OUTPUT);
pinMode(MOSI_PIN, OUTPUT);
pinMode(SCK_PIN, OUTPUT);
digitalWrite(SS_PIN, HIGH);
digitalWrite(SCK_PIN, LOW);
}
void loop() {
delayMicroseconds(500);
digitalWrite(SS_PIN, LOW);
for (int n = 0; n < 2; n++){
for (int m = 7; m >= 0; m--){ // reverse byte for MSB first
digitalWrite(MOSI_PIN, bitRead(bitArray[n], m));
digitalWrite(SCK_PIN, HIGH);
digitalWrite(SCK_PIN, LOW);
}
}
digitalWrite(SS_PIN, HIGH);
delayMicroseconds(100);
digitalWrite(SS_PIN, LOW);
for (int n = 2; n < 6; n++){
for (int m = 7; m >= 0; m--){ // reverse byte for MSB first
digitalWrite(MOSI_PIN, bitRead(bitArray[n], m));
digitalWrite(SCK_PIN, HIGH);
digitalWrite(SCK_PIN, LOW);
}
}
digitalWrite(SS_PIN, HIGH);
delayMicroseconds(500);
}LOGIC:
Any answers as to what I may be doing wrong to not get a response would be very appreciated.
