The problem is that the RC522 chip documentation doesn’t give a good example of how to do setup and read operations. It describes all of the registers individually, but not the required sequence. So, I’m relying on the old libraries for this - the PiicoDev RFID one and the domdfcoding one linked above.
Regarding my last post, and the error about converting list to int. This was coming from _tocard where it was being sent a [list] but trying to write a byte. The domdfcoding library (which was for CircuitPython) used a little loop in _tocard to send the list elements individually.
for c in send: # send to the FIFO
self._wreg(_REG_FIFO_DATA, c) # reg_fifo_data
self._wreg(_REG_COMMAND, cmd) # reg_command
This seemed to work and now things are running without python errors.
I am getting a different response when a card is held by the reader, but I’m never getting what seems like a valid card read.
detectTag
Start _request
Start _tocard- cmd:12 send:[38]
tocard - wait for interrupt
From tocard - Stat:2 Recv:[] Bits:0
got one? {'type': '', 'id_formatted': '', 'success': False, 'id_integers': [0]}
# tag presented here...
tag present?
readTagID
detectTag
Start _request
Start _tocard- cmd:12 send:[38]
tocard - wait for interrupt
From tocard - Stat:1 Recv:[32] Bits:0
detectTag
Start _request
Start _tocard- cmd:12 send:[38]
tocard - wait for interrupt
From tocard - Stat:1 Recv:[32] Bits:0
got one? {'type': '', 'id_formatted': '', 'success': False, 'id_integers': [0]}
tag present?
readTagID
detectTag
Start _request
Start _tocard- cmd:12 send:[38]
tocard - wait for interrupt
From tocard - Stat:1 Recv:[68, 4] Bits:16
readTagID - Tag present
Start _anticoll
Start _tocard- cmd:12 send:[147, 32]
tocard - wait for interrupt
From tocard - Stat:1 Recv:[136, 24, 101, 5, 5] Bits:40
Finish anticoll - Stat:3 Recv:[136, 24, 101, 5, 5]
got one? {'type': '', 'id_formatted': '', 'success': False, 'id_integers': [0]}
Python is giving me fits with print formatting and integers or hex formatting, so these are mixed.
This pattern repeats while a card is in proximity.
Receive [32], then [68, 4] then [136, 24, 101, 5, 5]. However, it’s never recognised as a valid tag and never returns ‘Success’ or any formatted reply from the card.
None of this part of code has changed from the original PiicoDev RFID library (which worked in uPython), so I can only assume there’s still something that CircuitPython is doing to mangle the response.
I appreciate the steps to success Michael, but without a better understanding of how the 522 works and starting from scratch, I’m not sure that approach is possible.
As a solution, I really only need to be able to read the tag identifier and that is all. Then send that over the USB HID (keyboard) - which should be relatively easy…where have I heard that before?