MFRC-522 difficulties reading blocks

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello! First of all, I'm new on this forum, and I hope I don't break any rules posting my question like this

 

I have a problem with ATmega8 and Mifare RC-522 based rfid antenna.

 

I've found a library on github https://github.com/asif-mahmud/M... and changed it a bit for sake of readability (attachment)

 

I've managed thanks to examples create a working UID reader, but I want to be able to read (and write at some point) other blocks of memory, but I can't seem to be able to find any tutorials on that on google.

It may even be that this library lacks function capable of reading and writing blocks. Can someone verify that for me, I'd be grateful, and if possible, help me on this topic :)

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First welcome to the forum.

It would help to understand what your attempting to do, what is the purpose of your rfid reader/writer.

What rfid tags are you using, have you the datasheet for this rfid tag? 

Far too many questions need to be answered before any answers can be provided. 

 

Jim

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your time:

I'm using Mifare Classic 1K, here's the datasheet: http://www.nxp.com/documents/dat...

 

No real purpose, just trying to learn, as a test I wanted just simply read block 1 of sector 0 and write it to attached LCD (LCD part is ready to go)

 

What I need is someone to show me how can reading from card can be achieved, from what I've learned you need to "chain" some commands

Discover cards

Get UID

Authenticate (with A key?)

Read data of specific block

 

the first two, are done. Hope I've answered all your questions

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello! sorry for the double post. I've been studying other libraries I could find online and added two more functions to my lib

mfrc522_auth and MFRC522_Read1

 

the problem is in lines 127-138 it seems that no data are being sent from the card OR are infinite in length (if that's even possible) because the loop always breakes due to i variable running to 0. Any ideas why could this be happening? (for the sake of analyzing i'll say that 'return n+1' in line 135, returns 5 (n==4).

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bump!

 

What I've managed to check for the last few days is that reader, whilst authenticating with the card gives back LoAlertIrq (0x04) interrupt in comIrqReg. And tha's why it won't authenticate properly.

 

Any ideas why is it doing that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey there

Did you finally manage to make it run?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Jooyande - note the date of post you're replying to ... 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Arduino library seems to work (for me at least).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your writing,

did it work even for writing in cards?