- Mon Jun 11, 2018 9:52 am
#199459
Hello
I'm having an issue connecting SparkFun's Simultaneous RFID Reader to my Adafruit Feather M0 Bluefruit LE.
Here's my connections (I have the switch set to HW-UART):

Higher quality image: https://imgur.com/a/8ZGW0XB
I'm using the example code SparkFun provides, with some modifications:
Adafruit says that I should be using hardware Serial over SoftwareSerial, and to use Serial1 (which corresponds to the TX/RX pins on the feather):
Here's the quote from their support:
I'm definitely getting into the setupNano function (at least sometimes), as I'm occasionally getting the "Module failed to respond. Please check wiring" error in the Serial monitor.
Is there something wrong with my code, or is it just that I need a logic level converter?

I'm having an issue connecting SparkFun's Simultaneous RFID Reader to my Adafruit Feather M0 Bluefruit LE.
Here's my connections (I have the switch set to HW-UART):

Higher quality image: https://imgur.com/a/8ZGW0XB
I'm using the example code SparkFun provides, with some modifications:
Adafruit says that I should be using hardware Serial over SoftwareSerial, and to use Serial1 (which corresponds to the TX/RX pins on the feather):
Here's the quote from their support:
As a first step, use the hardware Serial pins instead of a SoftwareSerial connection.SparkFun support sent me this information:
The Feather M0 handles USB communication internally, so its TX/RX pins are free to talk to other devices, and hardware Serial is always a better choice than SoftwareSerial if it's available. In code, you'd use the Serial1 interface.
The Feather M0 is a 3.3V logic device and all of the serial lines on the Simultaneous RFID Reader are level shifted since the intended use for this is either with a standard, 5V Arduino like an Uno or through the serial header with a 5V USB-to Serial converter board like this Serial Basic Breakout (https://www.sparkfun.com/products/14050). As you can see in the schematic (https://cdn.sparkfun.com/datasheets/Sen ... Reader.pdf), Vcc needs to be above 3.3V and while you are doing that, there’s probably still an issue with your 3.3V serial lines from the Feather. At the very least, the TXO line going to your RX line on the Feather is at 5V so you run the risk of damaging that serial line. You may need to shift that voltage back down to 3.3v using either another level shifter (https://www.sparkfun.com/categories/361) or a voltage divider.Here's the modified code:
Code: Select all
I commented out the SoftwareSerial lines at the beginning, because I'm using hardware Serial, and replaced the areas that used softSerial with Serial1./*
Reading multiple RFID tags, simultaneously!
By: Nathan Seidle @ SparkFun Electronics
Date: October 3rd, 2016
https://github.com/sparkfun/Simultaneous_RFID_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
nano.startReading(); //Begin scanning for tags
}
void loop()
{
if (nano.check() == true) //Check to see if any new data has come in from module
{
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(Serial1); //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
Serial1.begin(baudRate); //For this test, assume module is already at our desired baud rate
while(!Serial1); //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(Serial1.available()) Serial1.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
Serial1.begin(115200); //Start software serial at 115200
nano.setBaud(baudRate); //Tell the module to go to the chosen baud rate. Ignore the response msg
Serial1.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
}
I'm definitely getting into the setupNano function (at least sometimes), as I'm occasionally getting the "Module failed to respond. Please check wiring" error in the Serial monitor.
Is there something wrong with my code, or is it just that I need a logic level converter?