miguelbalboa / rfid

Arduino RFID Library for MFRC522
The Unlicense
2.77k stars 1.44k forks source link

After PCD_PerformSelfTest() card can`t be read #402

Closed saloid closed 3 years ago

saloid commented 6 years ago

Step 1: Describe your environment

Step 2: Describe the problem

After using PCD_PerformSelfTest() I should init (call PCD_Init()) module again, because without this it doesn't reads cards (PICC_IsNewCardPresent() always returns "false").

Maybe it will be better to init module again inside selftest function?

Relevant Code:

doesn`t works:

  rfid.PCD_Init();
  Serial.println(rfid.PCD_PerformSelfTest() ? "ok" : "ERROR!");

works:

  rfid.PCD_Init();
  Serial.println(rfid.PCD_PerformSelfTest() ? "ok" : "ERROR!");
  rfid.PCD_Init();
Rotzbua commented 6 years ago

Thanks for using the issue template :+1:

  rfid.PCD_Init();

Makes a reset. So everthing should work no matter what PCD_PerformSelfTest() makes wrong :)

I guess the selftest function of the library does not unset the selftest mode. The datasheet says:

Remark: for default operation the self test must be disabled by value 0000b

HenrikSte commented 5 years ago

Thanks for posting this. Spent an hour to find out why I am not reading anything... Adding a init after self test fixed it.

fmuntean commented 4 years ago

Same issue here: the SelfTest is leaving the board in an unusable state until init is called again.