SparkFun Forums 

Where electronics enthusiasts find answers.

Hi Funions,
I've been messing around with writing to the EPC on the flexible tags: WRL-14147
I'm using the example code you provide, downloaded most recent version from GitHub. (Example3_Write_EPC and Example2_Read_EPC)
I get very inconsistent results. It claims to write to the EPC and the values do change, but not to the values I entered.
Then after about an hour or so of trying to figure out what is going on it still claims to write to EPC but the values no longer change.
I tried with a new RFID tag and am back to getting garbage results, although I can change the values (just not to what I enter).

(I also tried using the commented out code with just HEX values instead of String, same results)

For example:
The tag originally reads:
00 00 FA BB 73 07 01 87 26 30 0F 4C

I wrote "BBBBBB"

Tag now reads:
00 00 FB 50 53 49 01 87 26 30 0F 4C

I am using a 5V 16 mHz Arduino Pro currently, previously tried a Redboard with similar results.

I searched comments and the internet but haven't found anything along these lines.
Any help would be great.
Hi BitsnPieces,

I have a few suggestions that might help you fix this issue. The first would be to make sure you only have a single tag in view of the reader when you are attempting to re-write the EPC. It might be that multiple tags are in view of the M6E and that is causing the garbled data. Another suggestion would be to make sure the tag is close to the antenna (PCB or external) and has as little interference as possible (eg. placing it directly on top of the PCB antenna). If you have sufficient power available, try increasing the write power and that may help get more reliable results.

I hope these suggestions help you write new EPCs to your tags more reliably. If you continue to have issues, please reply to this post and we can troubleshoot further.
Hi mark,

I also get this. When I run the example code to write to the EPC, I get a response saying it has written successfully. When I then read the data, using the example code to read EPC, I get an output similar to the BitsNPieces.

I have followed your advice and have only the 1 tag in view of the M6E and is very close to the antenna. I have also increased the power to try and get more reliable results.

The only difference between me and BitsnPieces is that I am using an Arduino Uno Wifi Rev 2.

Thanks for any advice!
The M6E is very sensitive to power supply. I have used 5v from the Arduino + an extra battery, otherwise the Nano would sometimes not respond. I never put the power higher than 500

What speed are you using to communicate with the Nano ( 38400?)
What messages do you get when you include: nano.enableDebugging(); before setupnano()
What happens if you try to use an example4 and 5 to write and read user data ?
Yeah I'm currently using 38400, I've not changed any of the code in the example code.

I'm sorry, I'm relatively new to this, where in the code should I put nano.enableDebugging(); ??

When running example4 and 5 ... I wrote "ABCD" and got a response back on the serial monitor that the data had been written. When I then run the code to read the tag this is the response I get...

15:43:30.320 -> Size [64] User data[41 43 42 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]

Is the expected output and I need to cast this data array to char ??

EDIT: Just checked and those values are indeed the HEX representations of the ASCII. So the shield is working (?) I just need the output to show the chara values instead of hex.

EDIT EDIT: Okay so I've worked out how to just print data that I write to the user data on the chip and print it out as "ABCD".

The good news: the Nano can write and read correctly the Tag. The only difference between writing user data or EPC is, just a different place (band) in the memory of the tag. The first 2 places an EPC are reserved area for Protocol-Control bits. So you start writing of an EPC always starts at address 2. Written " BBBBBB" should result in 6 times 0x42. However it seems it is writing 0xfb, 0x50, x053, x049 or : 0Xfb = ???, 0x50=P , 0x53 = S, 0x49 = I. what I find weird is that you write 6 characters, but only 4 change. Try HEX-write in the example as and see what happens:
Code: Select all
 char hexEPC[] = {0x41, 0x42, 0x43, 0x44}; //You can only write even number of bytes ABCD
 byte response = nano.writeTagEPC(hexEPC, sizeof(hexEPC));
I just tried this...

When I read an EPC for the first time I get this response ;
epc[E2 00 00 19 63 02 01 85 23 10 28 9D ]
I then write "Hello!" to the EPC getting this response "New EPC Written!"
I then re-read the EPC again and the response is
epc[C0 C0 CF 00 18 08 01 85 23 10 28 9D ]

When I try HEX-write I get the same output (epc[C0 C0 CF 00 18 08 01 85 23 10 28 9D ])
I have just tried this with my nano and MEGA2560. The results are as expected and the right hex values

So try this add nano.enableDebugging(); in setup(), just before the setup nano call (around line 30):
Code: Select all
  if (setupNano(38400) == false) //Configure nano to run at 38400bps
share the print out you get..
Thanks for all these responses. I tried the things you all suggested with the exception of using a MEGA. I tried with Genuinos and RedBoards, neither of which worked for EPC.

User Data works great though, I'll use that instead.

Thanks guys. Please let me know if anyone gets EPC read/write working on regular Arduinos.
Hi again BitsNPieces,

The EPC Read/Write examples were tested on a standard Uno/SparkFun RedBoard so they should have no issues on either of those boards or other AVR-based Arduinos. I have personally tested those examples without issue on a SparkFun RedBoard so something strange might be going on with your setup. It is weird that other examples are working, just not the write/read EPC examples. Are you using tags purchased from SparkFun or another vendor? Also, can you take a few photos of your RFID Reader and attach them to your reply?
I have just connected to my Arduino UNO.

NANO switch to HW-UART.

Nano GND to GND,
Nano VCC to +5V,
Nano TX to pin2,
Nano RX to pin 3.

Works like a charm.. no issues with writing and reading EPC.

It is good to hear that it works on the user bank for you, I just hope there is not a problem that will catch up with you later in your projects.
Hi everyone,

This looks like it was an error discovered in the Arduino library by Paul. We have another discussion about the issue in this post. The error has been fixed and a new version of the library has been pushed on GitHub here so try updating that library to v1.0.7 and that should resolve the issue with writing EPCs.

If anyone has any problems with this specific example, please reply to this or the post linked above and we can help.