Looking through the forums here and on parallax it looks like several people have had trouble getting the Parallax RFID Read/Write Module 28440 to correctly interface with the Arduino. The read/write module is a vast improvement over the old, read only module. The old module has numerous examples of how to code it for an Arduino. The new module is 4 times as fast, backwards compatible with with old reader tags and also supports write functionality.

I finally got it working so I thought I'd share my code. Note that this is a very rough and ugly code, but it works. I will be refining it over the next few days, but figured I'd post it as soon as I got it working to relieve frustration and also let others play with the code.

Note that if you have a rectangular read/write tag from parallax like I have, they come pre loaded with 0xFEEDBEEF in the first data address. If you didn't get your tags from there, or have a round tag, it should show up as 4 zeros. Alternately just change the the mySerial.print(3, BYTE); to mySerial.print(33, BYTE); which will read the unique serial ID. One thing that screwed me up for a long time is that the first byte of data in the ID could be a 1 which I was thinking was the error code. Hence why I went to this ugly code explicitly stating what the bytes I was getting.

I haven't gotten around to sketching any code to write to RFID tags, but from the documentation provided for the 28440, it should be fairly easy. Just have to watch that the data you're writing is in byte.

I tried your code exactly and I can't get anything to happen, well the led on the rfid flashes from red to green(or yellow) when a tag gets close but it doesn't print out... a little help please. Maybe I connected it wrong

In UberDude's code above (1st post), he shows the serial number of 2 of the tags he was using (they're commented out) 0800E28C60 and 0800D9E43E. Both of these serial numbers have 10 digits (5 Bytes) but he is only reading 4 bytes with the code, and the .PDF on the tag states that the tag's serial number is 32 bit (4 bytes). I'm lost...

In UberDude's code above (1st post), he shows the serial number of 2 of the tags he was using (they're commented out) 0800E28C60 and 0800D9E43E. Both of these serial numbers have 10 digits (5 Bytes) but he is only reading 4 bytes with the code, and the .PDF on the tag states that the tag's serial number is 32 bit (4 bytes).

Fair enough to say, a legacy read gets you the serial number of a legacy tagheader+10 bytes(40 bits)+footer

So if you were using legacy tags, you would need to code for it.

A read of a read/write tag gets you a the data from the specified address (1-33) status + 4 bytes(32 bits)

Each of the 33 data locations has 4 bytes!Of these locations, 3-31 are writable!

So you need to write to a tag, before you will see anything meaningful

the status codes all not explicitly mentioned anywhere in the datasheet, are in the stamp example code.http://www.parallax.com/Portals/0/Downloads/docs/prod/rf/28440-RFIDReadWrite-v1.0.pdfPage 10 at the top

ERR_OK 0x01 ' No errors ERR_LIW 0x02 ' Did not find a listen window ERR_NAK 0x03 ' Received a NAK, could be invalid command ERR_NAK_OLDPW 0x04 ' Received a NAK sending old password (RFID_SetPass), could be incorrect password ERR_NAK_NEWPW 0x05 ' Received a NAK sending new password (RFID_SetPass) ERR_LIW_NEWPW 0x06 ' Did not find a listen window after sending old password (RFID_SetPass) ERR_PARITY 0x07 ' Parity error when reading data

The two tags that are commented out are from an earlier program which reads the legacy tags. You can also see the hex code for reading a legacy code (0x0F) also commented out. You can pretty much just use the code from the old read only module:

http://www.arduino.cc/playground/Learning/PRFID

To get a read on a legacy tag, hence I didn't bother posting that since its pretty much a solved problem. But as far as I could tell, no one had written any code for the read/write module. Good luck

here is my slightly modified & (in my opinion) more elegant-looking version of uberdude's "read" code for the new (black) parallax RFID readers. I modified his code to suppress the "null reads" which occur when no card is present and quickly take up the whole monitor. I also suppressed the error codes, as I saw no real need for them.

if(mySerial.available() > 0) { val = mySerial.read(); //The mySerial.read() procedure is called, but the result is not printed because I don't want the "error message: 1" cluttering up the serial monitorif (val != 1) //If the error code is anything other than 1, then the RFID tag was not read correctly and any data collected is meaningless. In this case since we don't care about the resultant values they can be suppressed {suppressAll();} }

after some more work, i was able to get the write operation working. Here is the code i used:

Quote

//Code to write data to Parallax RFID reader/writer 28440 from Arduino//Program writes to one of the 29 user-defined addresses (3-31) as define by whichSpace//The four bytes to be written are defined by first, second, third, and fourth//Coded by vgrhcp

I just have one problem now...my code writes data as bytes, as it must for the RFID writer to understand it (i tried writing as DEC and HEX, but it did not work). However, the read code that uberdude wrote and i modified prints the values it reads as HEX. So the issue is that if you write, say, 26 as one of the bytes onto a card and then read it, it will come up as 1A, which is the HEX value that corresponds to 26. To solve this, you must change the read procedure form printing HEX to DEC like so:

Quote

//Code to read data from Parallax RFID reader/writer 28440 via Arduino//Program reads data from one of the 29 user-defined addresses (3-31) as define by whichSpace//Writen by vgrhcp based on code by uberdude

if(mySerial.available() > 0) { val = mySerial.read(); //The mySerial.read() procedure is called, but the result is not printed because I don't want the "error message: 1" cluttering up the serial monitorif (val != 1) //If the error code is not 1, then there has been an error and the RFID tag was not read correctly.In this case we don't really care about the resultant values, so they can be suppressed {suppressAll();} }

When posting code, select the code and hit the # icon not the quote icon next to it. Then you get a nice scrolling box and the software doesn't mess up square brackets and interpreted them as formatting.