Library Example 1 Constant Read not working; RFID Serial not available

The library example was working before, but ever since I connected the RFID reader to an ESP32, the example has not been working, even after I revert to my original setup using an Arduino Uno. I modified the example code slightly in order to check which part of the code is not working, it seems that the NanoSerial is always not available and therefore the NanoCheck is always false, hence the reader cannot read the tags. The RFID reader should be powered fine because the red light is lit when the Uno is connected. Additionally I have also tried using an external power supply but it made no difference. I have attached images of my current setup, the modified code and the printed results on the serial monitor. Would appreciate any help thanks!

For reference: Product code SEN-14066

To verify, the reader was working with other devices and then didn’t work with the ESP32 and now doesn’t work with any other devices at all, correct?

Are you able to check with an oscilloscope if the data lines are transmitting data?

Also, is there a reason you’re using pins 2 & 3 for serial communication? Try switching to 1 & 0, labeled TX/RX

TS-Brandon:
Also, is there a reason you’re using pins 2 & 3 for serial communication? Try switching to 1 & 0, labeled TX/RX

I followed the tutorial exactly which uses pins 2 and 3. The example code also uses pins 2 and 3.

https://learn.sparkfun.com/tutorials/si … stant-read

TS-Brandon:
To verify, the reader was working with other devices and then didn’t work with the ESP32 and now doesn’t work with any other devices at all, correct?

Are you able to check with an oscilloscope if the data lines are transmitting data?

Yes that sounds about right!

And sorry I don’t have an oscilloscope with me.

JoleneTan:

TS-Brandon:
Also, is there a reason you’re using pins 2 & 3 for serial communication? Try switching to 1 & 0, labeled TX/RX

I followed the tutorial exactly which uses pins 2 and 3. The example code also uses pins 2 and 3.

https://learn.sparkfun.com/tutorials/si … stant-read

An update: my colleague has also tried all the pins, but none of them worked.

I followed the tutorial exactly which uses pins 2 and 3. The example code also uses pins 2 and 3.

Can you modify the sketch to use Hardware Serial (pins 1 & 0) and change the switch the HW?

Also, are the power LEDs coming on when you plug it in?

The original post stated " the NanoSerial is always not available". Is that still the case or doesn’t it work at all on an UNO ?

If constant no reaction:

  • is the switch set to SW (looks like that on the picture) Try to shift to HW and back to SW (bad contact ?)

  • Share you sketch just to make sure there is not a small typo

  • Is the power 5V and thepower led is on?
  • if intermittent : the fact that it does not work sometimes is normally the power supply. You mention you added external supply. Was that directly to the Nano or to the Uno ? It should be directly to the Nano

    Connecting to ESP32, did you use a level-shifter ?

    TS-Brandon:

    I followed the tutorial exactly which uses pins 2 and 3. The example code also uses pins 2 and 3.

    Can you modify the sketch to use Hardware Serial (pins 1 & 0) and change the switch the HW?

    Also, are the power LEDs coming on when you plug it in?

    Hello, tried that but does not work. Power does come on.

    paulvha:
    The original post stated " the NanoSerial is always not available". Is that still the case or doesn’t it work at all on an UNO ?

    If constant no reaction:

  • is the switch set to SW (looks like that on the picture) Try to shift to HW and back to SW (bad contact ?)

  • Share you sketch just to make sure there is not a small typo

  • Is the power 5V and thepower led is on?
  • if intermittent : the fact that it does not work sometimes is normally the power supply. You mention you added external supply. Was that directly to the Nano or to the Uno ? It should be directly to the Nano

    Connecting to ESP32, did you use a level-shifter ?

    Hello,

    That is still the case, the code is not working on the Uno.

    • It is set to SW, and I have also tried switching it back and forth before

    • Unlikely to be typo, coz it is an example code from the library, only very slightly modified to check the different stages of the code, I will attach it below

    • Yes the power is 5V and the power LED turns On

    paulvha:
    The original post stated " the NanoSerial is always not available". Is that still the case or doesn’t it work at all on an UNO ?

    If constant no reaction:

  • is the switch set to SW (looks like that on the picture) Try to shift to HW and back to SW (bad contact ?)

  • Share you sketch just to make sure there is not a small typo

  • Is the power 5V and thepower led is on?
  • if intermittent : the fact that it does not work sometimes is normally the power supply. You mention you added external supply. Was that directly to the Nano or to the Uno ? It should be directly to the Nano

    Connecting to ESP32, did you use a level-shifter ?

    I'm having trouble uploading the coded in txt format (HTTP error), and copy pasting into the message field isn't working either because it disappears when I submit the reply post. Sorry but I'll try to send the sketch somehow.

    /*

    Reading multiple RFID tags, simultaneously!

    By: Nathan Seidle @ SparkFun Electronics

    Date: October 3rd, 2016

    https://github.com/sparkfun/Simultaneou … Tag_Reader

    Constantly reads and outputs any tags heard

    If using the Simultaneous RFID Tag Reader (SRTR) shield, make sure the serial slide

    switch is in the ‘SW-UART’ position

    */

    #include <SoftwareSerial.h> //Used for transmitting to the device

    SoftwareSerial softSerial(2, 3); //RX, TX

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

    RFID nano; //Create instance

    void setup()

    {

    Serial.begin(115200);

    while (!Serial); //Wait for the serial port to come online

    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(REGION_NORTHAMERICA); //Set to North America

    nano.setReadPower(500); //5.00 dBm. Higher values may caues USB port to brown out

    //Max Read TX Power is 27.00 dBm and may cause temperature-limit throttling

    Serial.println(F(“Press a key to begin scanning for tags.”));

    while (!Serial.available()); //Wait for user to send a character

    Serial.read(); //Throw away the user’s character

    Serial.println(“OK”); //Not in original example code

    nano.startReading(); //Begin scanning for tags

    Serial.println(“Start reading”); //Not in original example code

    }

    void loop()

    {

    //Original example doesn’t have the following from here

    if (!softSerial.available()){

    Serial.println(“softSerial not available”);

    delay (2000);

    }

    Serial.println(“Check nano”);

    while (nano.check() == false){

    Serial.println(“Nano check false”);

    delay(1000);

    }

    // to here

    if (nano.check() == true) //Check to see if any new data has come in from module

    {

    // Serial.println(“Nano check true”); //Not in original example code

    byte responseType = nano.parseResponse(); //Break response into tag ID, RSSI, frequency, and timestamp

    if (responseType == RESPONSE_IS_KEEPALIVE)

    {

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

    }

    else if (responseType == RESPONSE_IS_TAGFOUND)

    {

    //If we have a full record we can pull out the fun bits

    int rssi = nano.getTagRSSI(); //Get the RSSI for this tag read

    long freq = nano.getTagFreq(); //Get the frequency this tag was detected at

    long timeStamp = nano.getTagTimestamp(); //Get the time this was read, (ms) since last keep-alive message

    byte tagEPCBytes = nano.getTagEPCBytes(); //Get the number of bytes of EPC from response

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

    Serial.print(rssi);

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

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

    Serial.print(freq);

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

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

    Serial.print(timeStamp);

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

    //Print EPC bytes, this is a subsection of bytes from the response/msg array

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

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

    {

    if (nano.msg[31 + x] < 0x10) Serial.print(F(“0”)); //Pretty print

    Serial.print(nano.msg[31 + x], HEX);

    Serial.print(F(" "));

    }

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

    Serial.println();

    }

    else if (responseType == ERROR_CORRUPT_RESPONSE)

    {

    Serial.println(“Bad CRC”);

    }

    else

    {

    //Unknown response

    Serial.print(“Unknown error”);

    }

    }

    }

    //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(softSerial); //Tell the library to communicate over software 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

    softSerial.begin(baudRate); //For this test, assume module is already at our desired baud rate

    while (softSerial.isListening() == false); //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 (softSerial.available()) softSerial.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

    softSerial.begin(115200); //Start software serial at 115200

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

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

    delay(250);

    }

    //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

    }

    HI

    I have taken my Uno, my Nano and your sketch. It worked.

    I have connected the lose wires as follows to the Serial connectors (that is where you normally connect USB/ serial adapter):

    Nano serial ---- UNO

    GND ------------- GND

    NC

    VCC ------------- 5V

    RXD ------------ pin 2

    TXD ------------ pin 3

    NC

    I took a tag and moved that over the on-board antenna. I got output like :

    Press a key to begin scanning for tags.
    OK
    Start reading
    softSerial not available
    Check nano
     rssi[-34] freq[921600] time[289] epc[E2 00 00 15 86 0E 02 72 15 40 80 09 ]
    Check nano
    Nano check false
    softSerial not available
    Check nano
    Nano check false
    Nano check false
    Nano check false
    Nano check false
    softSerial not available
    Check nano
    

    The check “softSerial.available()” is checking to see whether there was atleast one character received on SoftSerial. If not it your sketch prints “softSerial not available”. However the Nano will sent regular data. Either the data from the detected tag, or data telling the library that it has NOT detected a tag.

    For test do the following: on line 24 in your sketch, just before calling setupnano(), add the following line : nano.enableDebugging(Serial);

    This will cause debug messages to be shown. Can you share the output (copy/paste) to where your sketch is failing ?

    Hello,

    The Serial Monitor Output from the test is as follows:

    sendCommand: [FF] [00] [03] [1D] [0C]

    Time out 1: No response from module

    sendCommand: [FF] [04] [06] [00] [00] [96] [00] [E0] [41]

    sendCommand: [FF] [00] [03] [1D] [0C]

    response: [FF] [14] [03] [00] [00] [14] [12] [08] [00] [30] [00] [00] [02] [20] [18] [07] [18] [01] [09] [00] [1B] [00] [00] [00] [00]

    sendCommand: [FF] [02] [93] [00] [05] [51] [7D]

    response: [FF] [00] [93] [01] [01]

    sendCommand: [FF] [02] [91] [01] [01] [70] [3B]

    response: [FF] [00] [91] [01] [01]

    sendCommand: [FF] [01] [97] [0D] [4B] [B0]

    response: [FF] [00] [97] [01] [01]

    sendCommand: [FF] [02] [92] [01] [F4] [40] [AD]

    response: [FF] [00] [92] [01] [01]

    Press a key to begin scanning for tags.

    sendCommand: [FF] [03] [9A] [01] [0C] [00] [A3] [5D]

    response: [FF] [00] [9A] [01] [01]

    sendCommand: [FF] [10] [2F] [00] [00] [01] [22] [00] [00] [05] [07] [22] [10] [00] [1B] [03] [E8] [01] [FF] [DD] [2B]

    response: [FF] [00] [2F] [01] [01]

    The RFID Reader still isn’t reading tags.

    Thanks,

    Jolene

    hi

    There is a problem with your reader. It does connect on the serial speed with your sketch and on a certain moment returns :

    response: [FF] [14] [03] [00] [00] [14] [12] [08] [00] [30] [00] [00] [02] [20] [18] [07] [18] [01] [09] [00] [1B] [00] [00] [00] [00]

    This means :

    boot loader version 14 12 08 00

    hardware version 30 00 00 02 TMR_SR_MODEL_M6E_NANO

    firmware date 20 18 07 18 (yy yy mm dd)

    firmware release 01 09 00 1b

    protocol bits 00 00 00 00 supported protocols:

    The issue is with protocol bits, this indicates that the Nano is NOT supporting a protocol.

    My nano returns with protocol bits :

    protocol bits 00 00 00 10 supported protocols: PROTOCOL_GEN2

    In your trace, from that moment on any request is returned with an error 01 01 (e.g. [FF] [00] [93] [01] [01]). This means TMR_ERROR_INVALID_OPCODE.

    With the Universal Reader Assistant (URA) on windows you can burn the firmware 1.9 again to the Nano. You should only select the com-port and NOT connect. On the next screen, bottom right it will show options to update firmware. The link on the document space on https://www.sparkfun.com/products/14066 to the firmware is not working anymore. It will get you to Jadak (company that acquired ThingMagic who originally made the Nano). Still you should be able to request access from Jadak to obtain the firmware following this link https://www.jadaktech.com/resources/rfi … e=firmware