M7E Hecto not working with Arduino

I could read using PL2303 and URA.

I used my Python file to controle M7E-HECTO via USB-UART.
My program is wrong? will check.

The GND pour on the top layer does not connect to that via you indicated:

So no short from VIN to GND should exist. If you use a multimeter and find an actual short on an actual physical board, then there’s some manufacturing defect.

The board was designed in Eagle, but looks like KiCad imported the design fine on your end.

1 Like

FYI the 2.5V is expected: Logic level M7E Hecto - #16 by SparkFro

If you have program can perform well, could you provide me the source code?
First, I want to read the version information by PC or M5Stack.

This source code cannot work well.

That Arduino library is what I would recommend, because it has been tested and verified to function with the M7E module.

Be sure to read the hookup guide closely: Arduino Examples - SparkFun Simultaneous RFID Reader - M7E Hookup Guide Specifically, make sure you change the module in the example from M6E to M7E, and make sure the serial port is set up correctly for whatever platform you’re using.

If you’re still having trouble, could you please provide more information about what specifically you’re having trouble with? Are you getting error messages? If so, at what step? What microcontroller are you using? How are the TX/RX pins connected? How are you powering the board?

Here is my code and environment.
Im glad if you tell me some advise.

Getting version…
Version response: 00 14 03 00 00 23 01 06 00 38
Setting protocol…
Setting antenna port…
Setting region…
Setting power…
Setup complete!
Scanning for tag…
Response type: 0C
Tag error, retrying…

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

// Library for controlling the RFID module
#include <M5StickC.h>
#include "SparkFun_UHF_RFID_Reader.h"

// M5StickC GroveポートのピンをRFIDリーダーに割り当て
//#define RFID_SERIAL_TX 33  // Grove白線
//#define RFID_SERIAL_RX 32  // Grove黄線
#define RFID_SERIAL_TX 0  // Grove白線
#define RFID_SERIAL_RX 26  // Grove黄線
#define RFID_SERIAL_BAUDRATE 115200
#define moduleType ThingMagic_M7E_HECTO

RFID nano;
HardwareSerial rfidSerial(1);

boolean setupNano(long baudRate) {
    Serial.println("Starting setup...");
    
    rfidSerial.begin(baudRate, SERIAL_8N1, RFID_SERIAL_RX, RFID_SERIAL_TX);
    delay(250);

    nano.begin(rfidSerial, moduleType);
    delay(250);

    while (rfidSerial.available()) {
        Serial.printf("%02X ", rfidSerial.read());
    }
    Serial.println();

    // バージョンチェック
    Serial.println("Getting version...");
    nano.getVersion();
    
    Serial.print("Version response: ");
    for(int i = 0; i < 10; i++) {
        Serial.printf("%02X ", nano.msg[i]);
    }
    Serial.println();

    if (nano.msg[0] == ERROR_WRONG_OPCODE_RESPONSE) {
        Serial.println("Stopping continuous read...");
        nano.stopReading();
        delay(1500);
    }

    //Test the connection
    nano.getVersion();
    if (nano.msg[0] != ALL_GOOD) {
        Serial.printf("Version check failed. Expected %02X, got %02X\n", ALL_GOOD, nano.msg[0]);
        return false;
    }

    Serial.println("Setting protocol...");
    nano.setTagProtocol(); //Set protocol to GEN2
    delay(250);

    Serial.println("Setting antenna port...");
    nano.setAntennaPort(); //Set TX/RX antenna ports to 1
    delay(250);

    return true;
}

void setup() {
    M5.begin();
    Serial.begin(115200);
    delay(100);

    M5.Lcd.setRotation(3);
    M5.Lcd.setTextSize(1);
    Serial.println("RFID Reader Test");
    M5.Lcd.println("RFID Reader Test");

    if (setupNano(RFID_SERIAL_BAUDRATE) == false) {
        Serial.println("Module failed to respond. Please check wiring.");
        M5.Lcd.println("Module failed!");
        while (1); //Freeze!
    }

    Serial.println("Setting region...");
    nano.setRegion(REGION_JAPAN);
    delay(250);

    Serial.println("Setting power...");
    nano.setReadPower(500); //27.00 dBm
    delay(250);

    // 初期化完了メッセージ
    Serial.println("Setup complete!");
    M5.Lcd.fillScreen(BLACK);
    M5.Lcd.setCursor(0, 0);
    M5.Lcd.println("Ready to scan!");
}

void loop() {
    M5.update();
    
    static bool waitingForButton = true;

    if (waitingForButton) {
        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setCursor(0, 0);
        M5.Lcd.println("Press BtnA to scan");
        waitingForButton = false;
    }
    
    if (M5.BtnA.wasPressed()) {
        Serial.println("Scanning for tag...");
        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setCursor(0, 0);
        M5.Lcd.println("Scanning...");

        byte myEPC[12];
        byte myEPClength;
        byte responseType = 0;
        unsigned long startTime = millis();
        bool timeout = false;

        while (responseType != RESPONSE_SUCCESS && !timeout) {
            myEPClength = sizeof(myEPC);
            responseType = nano.readTagEPC(myEPC, myEPClength, 500);
            Serial.printf("Response type: %02X\n", responseType);

            if (responseType == 0x0C) {  // General Tag Error
                Serial.println("Tag error, retrying...");
                delay(250);
            }
            
            if (millis() - startTime > 10000) {
                timeout = true;
            }
        }

        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setCursor(0, 0);

        if (timeout) {
            Serial.println("Scan timeout - No tag found");
            M5.Lcd.println("No tag found");
            M5.Lcd.println("Try again");
        }
        else if (responseType == RESPONSE_SUCCESS) {
            Serial.print(F(" epc["));
            M5.Lcd.print("EPC:");
            for (byte x = 0 ; x < myEPClength ; x++) {
                if (myEPC[x] < 0x10) {
                    Serial.print(F("0"));
                    M5.Lcd.print("0");
                }
                Serial.print(myEPC[x], HEX);
                M5.Lcd.print(myEPC[x], HEX);
                Serial.print(F(" "));
                M5.Lcd.print(" ");
            }
            Serial.println(F("]"));
            M5.Lcd.println();
        }
        else {
            Serial.printf("Failed with response: %02X\n", responseType);
            M5.Lcd.println("Scan failed");
            M5.Lcd.printf("Error: %02X", responseType);
        }
        
        delay(1000);
        waitingForButton = true;
    }
    
    delay(10);
}

This code also cannot work.
No RF signal are shown on tiny SA (Spectrum Analyzer)
In case URA, RF signal shown on tiny SA.

Getting version…
Version response: 00 14 03 00 00 23 01 06 00 38
Setting protocol…
Setting antenna port…
Setting region…
Setting power…
Setup complete!
Scanning for tag…
Response type: 0C
Tag error, retrying…

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

// Library for controlling the RFID module
#include <M5StickC.h>
#include "SparkFun_UHF_RFID_Reader.h"

// M5StickCのUARTピン定義
#define RFID_SERIAL_TX 0  // M5StickC UART TX
#define RFID_SERIAL_RX 26   // M5StickC UART RX
#define RFID_SERIAL_BAUDRATE 115200
#define moduleType ThingMagic_M7E_HECTO

RFID nano;
HardwareSerial rfidSerial(1);  // UART1を使用
boolean setupNano(long baudRate);

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

  if (setupNano(RFID_SERIAL_BAUDRATE) == false)
  {
    Serial.println(F("Module failed to respond. Please check wiring."));
    while (1); //Freeze!
  }

  nano.setRegion(REGION_JAPAN); //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 if (responseType == RESPONSE_IS_HIGHRETURNLOSS)
    {
      Serial.println("High return loss, check antenna!");
    }
    else
    {
      //Unknown response
      Serial.println("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)
{
  rfidSerial.begin(baudRate, SERIAL_8N1, RFID_SERIAL_RX, RFID_SERIAL_TX);
  delay(250);

  nano.begin(rfidSerial, moduleType);
  delay(250);

  //About 200ms from power on the module will send its firmware version at 115200. We need to ignore this.
  while (rfidSerial.available())
    rfidSerial.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
    rfidSerial.begin(115200); //Start serial at 115200

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

    rfidSerial.begin(baudRate); //Start the 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 module 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
}

Let’s start with the good news: The M7E communication is working. It is not a matter of TX/RX etc.

I am concerned that the power that is provided is not enough. The M7E (like the M6E) is very sensitive to that, it needs a supply that can handle burst/spikes on power demand. As soon as you start scanning it starts to use that power. I don’t know whether the AXP192 chip in the M5Stick can provide the necessary power. It looks you power from the BAT connection. Why not use the 5V out ? Else try using a strong external 5V or a3v7 LIPO.

I agree that it may be a power issue. The response code 0x0C corresponds to the error code RESPONSE_FAIL, which means communication was lost, likely because the M7E had a brownout. Please try @paulvha’s suggestions (I’m guessing the 5V output pin of the M5Stick may work, though I’m not familiar with the M5Stick).

Thank you @paulvha and @SparkFro

I also used 5V ping but result is same.
Further more, I used outer 5V source (DCDV Concerter 3.7V to 5V, TPS61088), but not improved.

I tried Arduino, then works fine.

Will check why M5StickC cannot work well.
Will try softSerial and improve the 5V power line.

A dc-dc converter does not provide enough power, nor does many of the standard wall warts. It needs good capacitors to handle the burst power demand. If not the logic in M7E module “goes bananas”.

Switching to softSerial does not make the change.

Only case1 works fine.
I understand the need of large capacity 5V source in spite of lower RF output level.
Though I dont know why “SoftwareSerial softSerial(0, 26)” cannot work, no problem. I dont use this pin for UART.

Thank everyone for helping me.

Case1: OK, fine until +24dBm

RFID Reader M5StickC
RX TX / 33
TX RX / 32
VIN 3.7V
Ground Ground

Case2 : NG
cannot work (AXP192 cannot provide large capacity current)

RFID Reader M5StickC
RX TX / 33
TX RX / 32
VIN 5V
Ground Ground

Case3: NG

RFID Reader M5StickC
RX TX / 0
TX RX / 26
VIN 3.7V
Ground Ground