Example READ ALL BANK problem

Hey,

me again :slight_smile:

I actualy have a problem with the example “Read all blocks”.

Sometimes it works, but most time it doesnt work. what do i wrong? maybe someone has the same problem?

How do i use this example to write to all banks?

there is no sketch to write them all back and a TID bank can not be written. You have to do separate write calls for each bank: writeTagEPC, writeUserData, writeKillPW, writeAccessPW.

However if you still want to change the PC, you will have to change writeTagEPC call as that by default will start at word address 0x2.

To your first question about sometimes working and most of the time not… I would try to increase reading power + add stong enough external power to the Nano.

Hey Thank you, i didnt find the adress to start reading the PC word… :frowning:

But there is a command for writeBlock:

response = nano.writeData(bank, address, myBank, bankLength);

i tried to write Bank 01, so i thought i could chance the PC word this way. It doesnt work. :frowning:

I think i found now the adress to read the PC Word,

but ho do i use writeData? myBank =1

byte myEPC[32]; //Most EPCs are 12 bytes

byte myEPClength;

byte responseType = 0;

while (responseType != RESPONSE_SUCCESS)//RESPONSE_IS_TAGFOUND)

{

myEPClength = sizeof(myEPC); //Length of EPC is modified each time .readTagEPC is called

responseType = nano.readTagEPC(myEPC, myEPClength, 500); //Scan for a new tag up to 500ms

Serial.println(F(“Searching for tag”));

}

//Beep! Piano keys to frequencies: http://www.sengpielaudio.com/KeyboardAndFrequencies.gif

tone(BUZZER1, 2093, 150); //C

delay(150);

tone(BUZZER1, 2349, 150); //D

delay(150);

tone(BUZZER1, 2637, 150); //E

delay(150);

//Print EPC

Serial.print(F(" epc["));

for (byte x = 0 ; x < myEPClength ; x++)

{

if (myEPC < 0x02) Serial.print(F(“0”));

Serial.print(myEPC, HEX);

Serial.print(F(" "));

}

Serial.println(F(“]”));

}

This is my code, i m not able to read the PC Word, what do i wrong? :(:frowning: i m trying it now many days

you need to make more changes in Sparkfun_UHF_RFID_Reader.cpp in readTagEPC() and writeTagEPC.

The original start at word address 0x02 :

//Read a single EPC
//Caller must provide an array for EPC to be stored in
uint8_t RFID::readTagEPC(uint8_t *epc, uint8_t &epcLength, uint16_t timeOut)
{
  uint8_t bank = 0x01; //User data bank
  uint8_t address = 0x02; //EPC starts at spot 4

  return (readData(bank, address, epc, epcLength, timeOut));
}

//This writes a new EPC to the first tag it detects
//Use with caution. This function doesn't control which tag hears the command.
uint8_t RFID::writeTagEPC(char *newID, uint8_t newIDLength, uint16_t timeOut)
{
  uint8_t bank = 0x01; //EPC memory
  uint8_t address = 0x02; //EPC starts at spot 4

  return (writeData(bank, address, ( uint8_t *) newID, newIDLength, timeOut));
}

You need to change that to start at word address 0x1 :

//Read a single EPC
//Caller must provide an array for EPC to be stored in
uint8_t RFID::readTagEPC(uint8_t *epc, uint8_t &epcLength, uint16_t timeOut)
{
  uint8_t bank = 0x01; //User data bank
  uint8_t address = 0x01; //PC and EPC starts at spot 2

  return (readData(bank, address, epc, epcLength, timeOut));
}

//This writes a new EPC to the first tag it detects
//Use with caution. This function doesn't control which tag hears the command.
uint8_t RFID::writeTagEPC(char *newID, uint8_t newIDLength, uint16_t timeOut)
{
  uint8_t bank = 0x01; //EPC memory
  uint8_t address = 0x01; //PC and EPC starts at spot 2

  return (writeData(bank, address, ( uint8_t *) newID, newIDLength, timeOut));
}

In your sketch you define byte myEPC[14]; The length should be the EPC length + PC. If you set for 32 it will try to read 32 bytes and fail.

Hello Thanks so much again. Now the READ works. i changed the Write like you told me. but writing 7D 01 to PC Word doesnt work. do i have to change more to write this information?

did you try to write EPC with this funktion?

I have just made the changes in the source code to test and it did work.

The sketch used:

/*
  Reading multiple RFID tags, simultaneously!
  By: Nathan Seidle @ SparkFun Electronics
  Date: October 3rd, 2016
  https://github.com/sparkfun/Simultaneous_RFID_Tag_Reader

  Single shot read - Ask the reader to tell us what tags it currently sees. And it beeps!

  If using the Simultaneous RFID Tag Reader (SRTR) shield, make sure the serial slide
  switch is in the 'SW-UART' position.
*/

#include "SparkFun_UHF_RFID_Reader.h" //Library for controlling the M6E Nano module

// if you plan to use softserial:  initalize that here, else comment it out the 2 lines
#include <SoftwareSerial.h> //Used for transmitting to the device
SoftwareSerial softSerial(2, 3); //RX, TX

// define the serial port to use (E.g. softSerial, Serial1 etc)
#define NanoSerial Serial1

/////////////////////////////////////////////////////////////
/* define driver debug
 * 0 : no messages
 * 1 : request sending and receiving
*////////////////////////////////////////////////////////////
#define DEBUG 1

/////////////////////////////////////////////////////////////
/* define Region for Nano to operate
 * This will select the correct unlicensed frequency to use
 * in you area. Valid options :
 *
 * REGION_INDIA        REGION_JAPAN     REGION_CHINA
 * REGION_KOREA        REGION_AUSTRALIA REGION_NEWZEALAND
 * REGION_NORTHAMERICA REGION_EUROPE    REGION_OPEN
*////////////////////////////////////////////////////////////
#define NANOREGION REGION_NORTHAMERICA

//***************************************************
//       NO CHANGES NEEDED BEYOND THIS POINT        *
//***************************************************

RFID nano; //Create instance

void setup()
{
  Serial.begin(115200);
  while (!Serial); //Wait for the serial port to come online

  Serial.println(F("Example: to read and write EPC"));

  if (DEBUG) nano.enableDebugging(Serial);

  if (setupNano(38400) == false) //Configure nano to run at 38400bps
  {
    Serial.println(F("Module failed to respond. Please check wiring."));
    while (1); //Freeze!
  }

  nano.setRegion(NANOREGION); //Set to the right region

  nano.setReadPower(500); //5.00 dBm. Higher values may cause USB port to brown out
  //Max Read TX Power is 27.00 dBm and may cause temperature-limit throttling
}

void loop()
{
  Serial.println(F("Press a key to scan for a tag"));
  while (!Serial.available()); //Wait for user to send a character
  Serial.read(); //Throw away the user's character

  byte myEPC[14]; //Most EPCs are 12 bytes + PC
  byte myEPClength;
  byte responseType = 0;

  while (responseType != RESPONSE_SUCCESS)  //RESPONSE_IS_TAGFOUND)
  {
    myEPClength = sizeof(myEPC); //Length of EPC is modified each time .readTagEPC is called

    responseType = nano.readTagEPC(myEPC, myEPClength, 500); //Scan for a new tag up to 500ms
    Serial.println(F("Searching for tag"));
    delay(500);
  }

  //Print EPC
  Serial.print(F(" epc["));
  for (byte x = 0 ; x < myEPClength ; x++)
  {
    if (myEPC[x] < 0x10) Serial.print(F("0"));
    Serial.print(myEPC[x], HEX);
    Serial.print(F(" "));
  }
  Serial.println(F("]"));

  // swap bytes..
  byte save = myEPC[12];
  myEPC[12] = myEPC[13];
  myEPC[13] = save;
  
  Serial.print(" length");
  Serial.println(sizeof(myEPC));
  
  responseType = nano.writeTagEPC(myEPC, sizeof(myEPC)); 

  if (responseType == RESPONSE_SUCCESS)
    Serial.println("New EPC Written!");
  else
    Serial.println("Failed write");

}

//Gracefully handles a reader that is already configured and already reading continuously
//Because Stream does not have a .begin() we have to do this outside the library
boolean setupNano(long baudRate)
{
  nano.begin(NanoSerial); //Tell the library to communicate over serial port

  //Test to see if we are already connected to a module
  //This would be the case if the Arduino has been reprogrammed and the module has stayed powered
  NanoSerial.begin(baudRate); //For this test, assume module is already at our desired baud rate
  while(!NanoSerial); //Wait for port to open

  //About 200ms from power on the module will send its firmware version at 115200. We need to ignore this.
  while(NanoSerial.available()) NanoSerial.read();

  nano.getVersion();

  if (nano.msg[0] == ERROR_WRONG_OPCODE_RESPONSE)
  {
    //This happens if the baud rate is correct but the module is doing a ccontinuous read
    nano.stopReading();

    Serial.println(F("Module continuously reading. Asking it to stop..."));

    delay(1500);
  }
  else
  {
    //The module did not respond so assume it's just been powered on and communicating at 115200bps
    NanoSerial.begin(115200); //Start software serial at 115200

    nano.setBaud(baudRate); //Tell the module to go to the chosen baud rate. Ignore the response msg

    NanoSerial.begin(baudRate); //Start the software serial port, this time at user's chosen baud rate
  }

  //Test the connection
  nano.getVersion();
  if (nano.msg[0] != ALL_GOOD) return (false); //Something is not right

  //The M6E has these settings no matter what
  nano.setTagProtocol(); //Set protocol to GEN2

  nano.setAntennaPort(); //Set TX/RX antenna ports to 1

  return (true); //We are ready to rock
}

The results on the monitor:

18:30:46.520 → Press a key to scan for a tag

18:31:01.917 → sendCommand:

18:31:01.917 → [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]

18:31:01.950 → response: [FF] [0E] [28] [00] [00] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [80] [29]

18:31:01.950 → Searching for tag

18:31:02.448 → epc[34 00 E2 00 00 15 86 0E 02 88 15 40 80 29 ]

18:31:02.448 → length14

18:31:02.448 → sendCommand:

18:31:02.448 → [FF] [16] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80] [8E] [AF]

18:31:02.581 → response: [FF] [00] [24] [00] [00]

18:31:02.581 → New EPC Written!

18:31:02.581 → Press a key to scan for a tag

18:31:02.581 → sendCommand:

18:31:02.581 → [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]

18:31:02.614 → response: [FF] [0E] [28] [00] [00] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80]

18:31:02.614 → Searching for tag

18:31:03.111 → epc[34 00 E2 00 00 15 86 0E 02 88 15 40 29 80 ]

18:31:03.111 → length14

18:31:03.111 → sendCommand:

18:31:03.111 → [FF] [16] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [80] [29] [27] [06]

18:31:03.211 → response: [FF] [00] [24] [00] [00]

18:31:03.211 → New EPC Written!

Thank you again :slight_smile:

But my Problem is, why couldn t i write 7D 01 the PC-Word? uinit8_t?

this is the last and only Problem i have. Because i need this configuration for my applikation.

I have some Tags with this configuration and some new Tags.

Here is a snip of the SparkFun_UHF_Reader.h file:

Why do you always use uint8_t but only for "writeTagEPC , char?

 uint8_t readTagEPC(uint8_t *epc, uint8_t &epcLength, uint16_t timeOut = COMMAND_TIME_OUT);
  uint8_t writeTagEPC(char *newID, uint8_t newIDLength, uint16_t timeOut = COMMAND_TIME_OUT);

  uint8_t readData(uint8_t bank, uint32_t address, uint8_t *dataRead, uint8_t &dataLengthRead, uint16_t timeOut = COMMAND_TIME_OUT);
  uint8_t writeData(uint8_t bank, uint32_t address, uint8_t *dataToRecord, uint8_t dataLengthToRecord, uint16_t timeOut = COMMAND_TIME_OUT);

  uint8_t readUserData(uint8_t *userData, uint8_t &userDataLength, uint16_t timeOut = COMMAND_TIME_OUT);
  uint8_t writeUserData(uint8_t *userData, uint8_t userDataLength, uint16_t timeOut = COMMAND_TIME_OUT);

  uint8_t readKillPW(uint8_t *password, uint8_t &passwordLength, uint16_t timeOut = COMMAND_TIME_OUT);
  uint8_t writeKillPW(uint8_t *password, uint8_t passwordLength, uint16_t timeOut = COMMAND_TIME_OUT);

  uint8_t readAccessPW(uint8_t *password, uint8_t &passwordLength, uint16_t timeOut = COMMAND_TIME_OUT);
  uint8_t writeAccessPW(uint8_t *password, uint8_t passwordLength, uint16_t timeOut = COMMAND_TIME_OUT);

  uint8_t readTID(uint8_t *tid, uint8_t &tidLength, uint16_t timeOut = COMMAND_TIME_OUT);
  uint8_t readUID(uint8_t *tid, uint8_t &tidLength, uint16_t timeOut = COMMAND_TIME_OUT);

  uint8_t killTag(uint8_t *password, uint8_t passwordLength, uint16_t timeOut = COMMAND_TIME_OUT);

  void sendMessage(uint8_t opcode, uint8_t *data = 0, uint8_t size = 0, uint16_t timeOut = COMMAND_TIME_OUT, boolean waitForResponse = true);
  void sendCommand(uint16_t timeOut = COMMAND_TIME_OUT, boolean waitForResponse = true);

To your WriteTagEPC()… it is like that in the original Sparkfun library. History : It used to be ‘uint8_t *’ but then a change was made in the .cpp file which caused a bug. That change required a ‘char *’, and when the change was undone, the char * stayed. If you look in WriteTagEPC() you will see it is type-cast to ( uint8_t *) before sending to writetag().

To updating the PC: yes… that works. I have used a sketch to swap the first byte of the PC between 0x34 and 0x24 with each write and read.

10:34:50.169 -> Searching for tag
10:34:50.667 -> sendCommand: 
10:34:50.667 ->  [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]
10:34:50.999 -> response:  [FF] [0E] [28] [00] [00] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80]
10:34:50.999 -> Searching for tag
10:34:51.496 ->  epc[34 00 E2 00 00 15 86 0E 02 88 15 40 29 80 ]
10:34:51.529 ->  length 10
10:34:51.529 -> sendCommand: 
10:34:51.529 ->  [FF] [12] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [24] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [D9] [70]
10:34:51.595 -> response:  [FF] [00] [24] [00] [00]
10:34:51.595 -> New EPC Written!
10:34:51.595 -> Press a key to scan for a tag
10:34:51.595 -> sendCommand: 
10:34:51.595 ->  [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]
10:34:51.629 -> response:  [FF] [0E] [28] [00] [00] [24] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80]
10:34:51.629 -> Searching for tag
10:34:52.126 ->  epc[24 00 E2 00 00 15 86 0E 02 88 15 40 29 80 ]
10:34:52.126 ->  length 14
10:34:52.126 -> sendCommand: 
10:34:52.126 ->  [FF] [16] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80] [8E] [AF]
10:34:52.226 -> response:  [FF] [00] [24] [00] [00]
10:34:52.226 -> New EPC Written!
10:34:52.226 -> Press a key to scan for a tag
10:35:01.619 -> sendCommand: 
10:35:01.619 ->  [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]
10:35:01.667 -> response:  [FF] [0E] [28] [00] [00] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80]
10:35:01.667 -> Searching for tag
10:35:02.183 ->  epc[34 00 E2 00 00 15 86 0E 02 88 15 40 29 80 ]
10:35:02.183 ->  length 10
10:35:02.183 -> sendCommand: 
10:35:02.183 ->  [FF] [12] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [24] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [D9] [70]
10:35:02.231 -> response:  [FF] [00] [24] [00] [00]
10:35:02.250 -> New EPC Written!
10:35:02.250 -> Press a key to scan for a tag
10:35:02.250 -> sendCommand: 
10:35:02.250 ->  [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]
10:35:02.301 -> response:  [FF] [0E] [28] [00] [00] [24] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80]
10:35:02.301 -> Searching for tag
10:35:02.780 ->  epc[24 00 E2 00 00 15 86 0E 02 88 15 40 29 80 ]
10:35:02.780 ->  length 14
10:35:02.780 -> sendCommand: 
10:35:02.780 ->  [FF] [16] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80] [8E] [AF]
10:35:02.872 -> response:  [FF] [00] [24] [00] [00]
10:35:02.880 -> New EPC Written!

Just for the fun of it I have written a new PC code 7D01… and that also works… of course I restore my original EPC code…

11:34:22.932 -> sendCommand: 
11:34:22.932 ->  [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]
11:34:22.932 -> response:  [FF] [0E] [28] [00] [00] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80]
11:34:22.965 -> Searching for tag
11:34:23.463 ->  epc[34 00 E2 00 00 15 86 0E 02 88 15 40 29 80 ]
11:34:23.463 ->  length 10
11:34:23.463 -> sendCommand: 
11:34:23.463 ->  [FF] [12] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [7D] [01] [E2] [00] [00] [15] [86] [0E] [02] [88] [F3] [7C]
11:34:23.529 -> response:  [FF] [00] [24] [00] [00]
11:34:23.529 -> New EPC Written!
11:34:23.529 -> Press a key to scan for a tag
11:34:23.529 -> sendCommand: 
11:34:23.529 ->  [FF] [08] [28] [01] [F4] [01] [00] [00] [00] [01] [07] [86] [FB]
11:34:23.596 -> response:  [FF] [0E] [28] [00] [00] [7D] [01] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80]
11:34:23.596 -> Searching for tag
11:34:24.074 ->  epc[7D 01 E2 00 00 15 86 0E 02 88 15 40 29 80 ]
11:34:24.107 ->  length 14
11:34:24.107 -> sendCommand: 
11:34:24.107 ->  [FF] [16] [24] [07] [D0] [00] [00] [00] [00] [01] [01] [34] [00] [E2] [00] [00] [15] [86] [0E] [02] [88] [15] [40] [29] [80] [8E] [AF]
11:34:24.207 -> response:  [FF] [00] [24] [00] [00]
11:34:24.207 -> New EPC Written!

Here is the quick sketch I used…

/*
  Reading multiple RFID tags, simultaneously!
  By: Nathan Seidle @ SparkFun Electronics
  Date: October 3rd, 2016
  https://github.com/sparkfun/Simultaneous_RFID_Tag_Reader

  Single shot read - Ask the reader to tell us what tags it currently sees. And it beeps!

  If using the Simultaneous RFID Tag Reader (SRTR) shield, make sure the serial slide
  switch is in the 'SW-UART' position.
*/

#include "SparkFun_UHF_RFID_Reader.h" //Library for controlling the M6E Nano module

// if you plan to use softserial:  initalize that here, else comment it out the 2 lines
#include <SoftwareSerial.h> //Used for transmitting to the device
SoftwareSerial softSerial(2, 3); //RX, TX

// define the serial port to use (E.g. softSerial, Serial1 etc)
#define NanoSerial Serial1

/////////////////////////////////////////////////////////////
/* define driver debug
 * 0 : no messages
 * 1 : request sending and receiving
*////////////////////////////////////////////////////////////
#define DEBUG 1

/////////////////////////////////////////////////////////////
/* define Region for Nano to operate
 * This will select the correct unlicensed frequency to use
 * in you area. Valid options :
 *
 * REGION_INDIA        REGION_JAPAN     REGION_CHINA
 * REGION_KOREA        REGION_AUSTRALIA REGION_NEWZEALAND
 * REGION_NORTHAMERICA REGION_EUROPE    REGION_OPEN
*////////////////////////////////////////////////////////////
#define NANOREGION REGION_NORTHAMERICA

//***************************************************
//       NO CHANGES NEEDED BEYOND THIS POINT        *
//***************************************************

RFID nano; //Create instance

void setup()
{
  Serial.begin(115200);
  while (!Serial); //Wait for the serial port to come online

  Serial.println(F("Example2: read EPC"));

  if (DEBUG) nano.enableDebugging(Serial);

//  digitalWrite(BUZZER2, LOW); //Pull half the buzzer to ground and drive the other half.

  if (setupNano(38400) == false) //Configure nano to run at 38400bps
  {
    Serial.println(F("Module failed to respond. Please check wiring."));
    while (1); //Freeze!
  }

  nano.setRegion(NANOREGION); //Set to the right region

  nano.setReadPower(500); //5.00 dBm. Higher values may cause USB port to brown out
  //Max Read TX Power is 27.00 dBm and may cause temperature-limit throttling
}

void loop()
{
  Serial.println(F("Press a key to scan for a tag"));
  while (!Serial.available()); //Wait for user to send a character
  Serial.read(); //Throw away the user's character

  byte myEPC[14]; //Most EPCs are 12 bytes + PC
  byte myEPClength;
  byte responseType = 0;

  while (responseType != RESPONSE_SUCCESS)//RESPONSE_IS_TAGFOUND)
  {
    myEPClength = sizeof(myEPC); //Length of EPC is modified each time .readTagEPC is called

    responseType = nano.readTagEPC(myEPC, myEPClength, 500); //Scan for a new tag up to 500ms
    Serial.println(F("Searching for tag"));
    delay(500);
  }

  //Print EPC
  Serial.print(F(" epc["));
  for (byte x = 0 ; x < myEPClength ; x++)
  {
    if (myEPC[x] < 0x10) Serial.print(F("0"));
    Serial.print(myEPC[x], HEX);
    Serial.print(F(" "));
  }
  Serial.println(F("]"));

  // swap bytes..
  if (myEPC[0] == 0x34) {
    myEPC[0] = 0x7D;
    myEPC[1] = 0x01;
    myEPClength = 10;   // new length is 10
  }

  // RESTORE ORIGINAL EPC
  else {
    //epc[34 00 E2 00 00 15 86 0E 02 88 15 40 29 80 ]
    myEPC[0] = 0x34;
    myEPC[1] = 0x00;
    myEPC[2] = 0xE2;
    myEPC[3] = 0x00;
    myEPC[4] = 0x00;
    myEPC[5] = 0x15;
    myEPC[6] = 0x86;
    myEPC[7] = 0x0E;
    myEPC[8] = 0x02;
    myEPC[9] = 0x88;
    myEPC[10] = 0x15;
    myEPC[11] = 0x40;  
    myEPC[12] = 0x29;
    myEPC[13] = 0x80;  
    myEPClength = 14;
  }
  
  Serial.print(" length ");
  Serial.println(myEPClength);
  
  responseType = nano.writeTagEPC(myEPC, myEPClength); 

  if (responseType == RESPONSE_SUCCESS)
    Serial.println("New EPC Written!");
  else
    Serial.println("Failed write");

}

//Gracefully handles a reader that is already configured and already reading continuously
//Because Stream does not have a .begin() we have to do this outside the library
boolean setupNano(long baudRate)
{
  nano.begin(NanoSerial); //Tell the library to communicate over serial port

  //Test to see if we are already connected to a module
  //This would be the case if the Arduino has been reprogrammed and the module has stayed powered
  NanoSerial.begin(baudRate); //For this test, assume module is already at our desired baud rate
  while(!NanoSerial); //Wait for port to open

  //About 200ms from power on the module will send its firmware version at 115200. We need to ignore this.
  while(NanoSerial.available()) NanoSerial.read();

  nano.getVersion();

  if (nano.msg[0] == ERROR_WRONG_OPCODE_RESPONSE)
  {
    //This happens if the baud rate is correct but the module is doing a ccontinuous read
    nano.stopReading();

    Serial.println(F("Module continuously reading. Asking it to stop..."));

    delay(1500);
  }
  else
  {
    //The module did not respond so assume it's just been powered on and communicating at 115200bps
    NanoSerial.begin(115200); //Start software serial at 115200

    nano.setBaud(baudRate); //Tell the module to go to the chosen baud rate. Ignore the response msg

    NanoSerial.begin(baudRate); //Start the software serial port, this time at user's chosen baud rate
  }

  //Test the connection
  nano.getVersion();
  if (nano.msg[0] != ALL_GOOD) return (false); //Something is not right

  //The M6E has these settings no matter what
  nano.setTagProtocol(); //Set protocol to GEN2

  nano.setAntennaPort(); //Set TX/RX antenna ports to 1

  return (true); //We are ready to rock
}

The last comment : To have successful write I needed to apply an extra Lipo battery to the Nano.

Become desperate,…

Is it possible to send me your sketch with die .h and .ccp file via Email?

I dont know what i m doing wrong.

drop me a PM… better than to flush the board :slight_smile: