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.
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.
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…
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:
char hexEPC[] = {0x41, 0x42, 0x43, 0x44}; //You can only write even number of bytes ABCD
byte response = nano.writeTagEPC(hexEPC, sizeof(hexEPC));
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.
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?
Nothing fancy for a setup- literally just the shield plugged into the micro. I turned up the gain on the antennae, it didn’t help. Same issue/results described above by LukeDJ and Paul, tried both HEX and String. Tags were purchased from you guys.
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.