GithubHelp home page GithubHelp logo

Can not wake up PICC about rfid HOT 5 CLOSED

miguelbalboa avatar miguelbalboa commented on June 18, 2024
Can not wake up PICC

from rfid.

Comments (5)

mdxs avatar mdxs commented on June 18, 2024

Look at the implementation of MFRC522::PICC_IsNewCardPresent() in the .cpp, from that I guess you will need to use:

  byte bufferATQA[10];
  byte bufferSize = sizeof(bufferATQA);
  byte result;
  ...
  result = mfrc522.PICC_WakeupA(bufferATQA, &bufferSize);
  if (result != STATUS_OK) {
    // report some issue
    return;
  }
  ...
  result = mfrc522.PICC_RequestA(bufferATQA, &bufferSize);
  if (result != STATUS_OK) {
    // report some issue
    return;
  }
  ...

from rfid.

mdxs avatar mdxs commented on June 18, 2024

@omersiar : could this issue be closed now?

from rfid.

omersiar avatar omersiar commented on June 18, 2024

Yes it can be closed.

from rfid.

Lotrax avatar Lotrax commented on June 18, 2024

I have the same problem as @omersiar and have looked at the .cpp but it seems I'm missing something. Currently doing it as follows:

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN         13          // Configurable, see typical pin layout above
#define SS_1_PIN        2         // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 2
#define SS_2_PIN        3          // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 1
#define SS_3_PIN        4
#define SS_4_PIN        5
#define SS_5_PIN        6
#define SS_6_PIN        7

#define NR_OF_READERS   6

byte ssPins[] = {SS_1_PIN, SS_2_PIN, SS_3_PIN, SS_4_PIN, SS_5_PIN, SS_6_PIN};

byte bufferATQA[2];
byte bufferSize = sizeof(bufferATQA);

MFRC522 mfrc522[NR_OF_READERS];   // Create MFRC522 instance.

void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  SPI.begin();        // Init SPI bus
  delay(500);

  for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
    mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Init each MFRC522 card
    delay(100);
    Serial.print(F("Reader "));
    Serial.print(reader);
    Serial.print(F(": "));
    mfrc522[reader].PCD_DumpVersionToSerial();
  }
}

/**
   Main loop.
*/
void loop() {

  for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
    mfrc522[reader].PICC_WakeupA(bufferATQA, bufferSize);

    if (mfrc522[reader].PICC_IsNewCardPresent() && mfrc522[reader].PICC_ReadCardSerial()) {
      Serial.print(F("Reader "));
      Serial.print(reader);
      dump_byte_array(mfrc522[reader].uid.uidByte, mfrc522[reader].uid.size);
      Serial.println();

      mfrc522[reader].PICC_HaltA(); //Remove so cards stay readable
      mfrc522[reader].PCD_StopCrypto1();
    }
  }
}

void dump_byte_array(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    Serial.print(buffer[i], HEX);
  }

I know I can just leave out mfrc522[reader].PICC_HaltA(); but I want more control over it, I want to keep reading all readers except those I have halted. I want to start those readers that are relevant.

from rfid.

Lotrax avatar Lotrax commented on June 18, 2024

Another user, @akellai, has created a fast_reset function, which does exactly what I wanted PICC_WakeupA to do (or expected it to do). It's perhaps a work around, but it works. Since Google led me to this question, I suspect others will find it to, so here is a link to akellai's comment and my own which is an adapted code of akellia's for multiple readers.

from rfid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.