Go Down

Topic: RDM880 connection problem (Read 1 time) previous topic - next topic


I am having the same issue using the posted code. There are a few bugs in the code though, so this is what I changed:

  • The data length calculation must be done over both the CMD and the DATA array. sizeof(DATA) returns the number of bytes in the array, no need to divide it by 2 and you always have to add 1 for the CMD byte.

  • Somehow I had issues with sizeof() and the array passed as variable so I moved the CMD and DATA variables into the send_command method so they will be used locally only

  • I also changed the while loop condition to use the datalength variable (i don't think this was necessary in the end)

  • Added code to use the RESET pin to enable/disable the reader

When issuing the 0x83 command you don't need additional data in the array. This command will ask for the serial number of the reader itself (this should always give a result) if I understand this document http://neophob.com/files/rfid/PROTOCOL-821-880%20_2_.pdf correctly.

If you want to read the serial number of a Mifare RF card issue command 0x25 and put {0x26, 0x00} in the DATA array.

Anyway in both situations I don't get any response at all. I am using the Duemilanove (Atmega328) and have tried this cvode with both the NewsoftSerial and the SoftwareSerial without any luck.

I am wondering if there is a problem with the pin layout in the datasheet or command protocol. Can anyone please crack this puzzle  :0

Here is my code:
Code: [Select]
#include <NewSoftSerial.h>


This program tests communication with the Seeeduino 13.56 RFID Reader by sending a request for the unit's serial number and getting a response.

www.coolcomponents.co.uk 2010

We need 4 pins connected from the RFID to the Arduino : These all come from connector J2

TX    -> RX (pin 3)
RX    -> TX (pin 4)
+5V   -> +5V
GND   -> GND


1.Debug info and received data will be sent through the Arduino to your serial monitor. You should have it open to see anything!

You should see something like this :

The RFID test program has started
Header = AA
Station ID = 00
Data Length = 1
Command = 83
Checksum = 82
Footer = BB
Listening for response...
I received: AA
I received: 0
I received: A
I received: 0
I received: 0
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: A
I received: BB

NOTES (Continued)
2.The reset pin on the RFID should be tied to GND, either on the RFID or the Arduino
3.Please note that this test program outputs debug data with no trailing zero : so for example '00' becomes '0' and '0A' becomes 'A'
4.If you're not seeing any response from the RFID unit, chances are that you have your RX and TX pins round the wrong way.
5.This code uses the 'NewSoftSerial' library to set up another serial port on pins 3+4 of your Arduino. You must download the library and 'include' it in your code (using Sketch:Import Library from the Menu bar). Library can be found at : arduiniana.org/libraries/newsoftserial/
6.The code used to send the data section of the packet has not been properly tested.


int rfidEnable = 2;
int rxPin = 3;
int txPin = 4;

NewSoftSerial rfid(rxPin,txPin);

void setup()
  pinMode(rfidEnable, OUTPUT);
  //pinMode(rxPin, INPUT);
  //pinMode(txPin, OUTPUT);

  //start serial port at 9600 bps: This is for the debug info we send to your PC/Mac
  //start a NewSoftSerial serial port at 9600bps : This is to talk to the RFID.
  Serial.println("Initializing reader with reset cycle");
  //initialize reader with reset cycle
  digitalWrite(rfidEnable, LOW);
  digitalWrite(rfidEnable, HIGH);
  digitalWrite(rfidEnable, LOW);
  Serial.println("The RFID test program has started");

void loop()
  digitalWrite(rfidEnable, LOW);
  send_command();   //This command is requests the serial number of the RFID unit
  read_response();            //This just displays the raw data recieved
  digitalWrite(rfidEnable, HIGH);
  while(1) {}                 //loop forever

void send_command()
  int i;  //an index for the data send loop
  int checksum;
  byte STX=0xAA;
  byte ETX=0xBB;
  byte STATIONID = 0x00;
  byte CMD = 0x83;
  byte DATA[] = {};
  Serial.print("Header = ");
  Serial.print(STX,HEX);           //STX command begin code
  Serial.print("Station ID = ");
  Serial.print("00");             //RFID reader address use zero for all readers to respond)
  DATALENGTH = sizeof(DATA)+1;
  Serial.print("Data Length = ");
  Serial.println(DATALENGTH,DEC);   //send the length of the data section
  Serial.print("Command = ");
  Serial.print(CMD,HEX);          //send the command word
  checksum = (STATIONID ^ DATALENGTH ^ CMD);

  while (i<(DATALENGTH-1))
    Serial.print("Data Word ");
    Serial.print(" = ");
    Serial.print(DATA[i],HEX);    //send each byte of the data
    checksum = checksum ^ DATA[i];
  Serial.print("Checksum = ");
  Serial.print(checksum,HEX);      //
  Serial.print("Footer = ");
  Serial.print(ETX,HEX);          //ETX command end code

void read_response()
  byte incomingByte;
  Serial.println("Listening for response...");
while (rfid.available() > 0)
  // read the incoming byte:
  incomingByte = rfid.read();

  // say what you got:
  Serial.print("I received: ");
  Serial.println(incomingByte, HEX);
  Serial.println("Not listening anymore");

Go Up