×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Unhappy Everybody, Mifare 1k please help me!!!!!!!

    Hi everybody, I'm searching for document of Mifare, but I hardly find none. I don't know it will write what in sector 0, and how data will encode , can you explain for me?

    I capture my example, hope you would help me to understand Mifare. Thank you.
    Last edited by kyo00710; 2009-10-05 at 12:32.

  2. #2
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    50

    Re: Everybody, Mifare 1k please help me!!!!!!!

    I invite you to read Mifare 1K/4K specifications in order to get a better idea of how data is written on a Mifare tag.
    You can also experiment writing NFC data in the NFC Manager (with the checkbox "use predefined content" or something like this) and looking at how your data gets written inside the card.

    Basically, the sector 0 holds manufacturer data (serial number and other data) in the first block and application directory management data in the next two blocks. When you create a new "application" (which is just their name for reserved storage area) inside the card, it'll add the id of the application in these blocks so that the card knows in which sector to looks when asked for an application. All this (opening/creating the application directory and creating a new application) can by Nokia's extension to JSR-257 so you don't need to write it directly to the tag.

    Hope that helps.

  3. #3
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Hi Pybel,

    Thanks for your help, I've read the document which you give. But I don't understand clearly about content in this Mifare 1K.

    In sector 0, default block 0 is full of data, but next in block 1, when Tag is written data, I see it fill 4 bytes: C0 01 03 E1, I think it is MAD, but you said it just had 2 bytes. So, what is it?

  4. #4
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    50

    Re: Everybody, Mifare 1k please help me!!!!!!!

    03 E1 is the Application ID for NDEF Content.
    The C0 01 bytes are the MAD header. The first byte is a CRC and the second byte is an "info" byte. More details here.

  5. #5
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Hi Pybel,

    Thanks for your help, it's very useful with me.

    But until now, I don't know how to calculate the CRC and how to write data into Tag.
    Can you show me the way to calculate the CRC byte?

    And, NDEF Message will be started writing at the first byte of block 1 of sector 1, right?

    I use ACR122U NFC Reader to read/write Mifare Tag.

    Hope your help again, thank you

  6. #6
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    50

    Re: Everybody, Mifare 1k please help me!!!!!!!

    The CRC should be explained in the pdf I've linked to in my last post.
    Yes, the NDEF Message should be written from block 1 of sector 1, though there might be some Mifare specific header there too.

    Anyway, I'm not sure but I think that the creation/updateof the MAD is taken care of by the tag itself when receiving a NDEF Message so you probably don't have to care about it and just have your tag writer write NDEF data directly.

  7. #7
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Hi Pybel,

    Do you mean that all data consists of CRC, Info byte, AID and sector trailer of sector 0 is automatically written?

    If not, I am hardly to calculate the CRC byte.

  8. #8
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Do you use ACR122U to read/write Mifare tag?
    When I write data in tag, I can't access sector 0, even nor authentication.I don't know why.

    I don't write data for sector trailer of sector 0 and 1.


    Please help me,

  9. #9
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    50

    Re: Everybody, Mifare 1k please help me!!!!!!!

    No, I use the Nokia 6212 Classic, so I don't know exactly how the ACR122U writes NDEF data on a Mifare tag. So I can't really help you with that.

  10. #10
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Ok, so could you give me an example about calculating CRC byte? I still don't resolve it.

  11. #11
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Re: Everybody, Mifare 1k please help me!!!!!!!

    nobody help me?

  12. #12
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Hi there,

    I was trying to solve the MAD's CRC problem too just now after reading the MAD Application Note. The AN said you gotta use CRC-8 with Algorithm x8 + x4 + x3 + x2 + 1 with preset 0xE3. By prima facie, you may think to use InitialXOR = 0xE3. However so, the result will not tally with the expected result written in the AN.

    After some trials n errors, I finally gotta the result. You gotta use:
    CRC-8 with mentioned algorithm.
    InitialXOR = 0xC7 (bit reversed of 0xE3 )
    FinalXOR = 0x00
    ReflectData = No
    ReflectFinal = No

    Since the App Note only got 1 example (which result is 0x89), I've concluded based on it only. Appreciate if you can share with more sample MAD data so that I can calculate its CRC and check if I'm correct.

  13. #13
    Regular Contributor
    Join Date
    Jul 2006
    Posts
    52

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Could you please share the code? I'm trying the same but not working, even with your modifications

    Quote Originally Posted by chonlias View Post
    Hi there,

    I was trying to solve the MAD's CRC problem too just now after reading the MAD Application Note. The AN said you gotta use CRC-8 with Algorithm x8 + x4 + x3 + x2 + 1 with preset 0xE3. By prima facie, you may think to use InitialXOR = 0xE3. However so, the result will not tally with the expected result written in the AN.

    After some trials n errors, I finally gotta the result. You gotta use:
    CRC-8 with mentioned algorithm.
    InitialXOR = 0xC7 (bit reversed of 0xE3 )
    FinalXOR = 0x00
    ReflectData = No
    ReflectFinal = No

    Since the App Note only got 1 example (which result is 0x89), I've concluded based on it only. Appreciate if you can share with more sample MAD data so that I can calculate its CRC and check if I'm correct.

  14. #14
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Re: Everybody, Mifare 1k please help me!!!!!!!

    Hi

    Quote Originally Posted by chonlias View Post
    After some trials n errors, I finally gotta the result. You gotta use:
    InitialXOR = 0xC7 (bit reversed of 0xE3 )
    Hum... I missed this topic at first when I encountered the very same problem. Since the example was not working and I had a "real" MIFARE card with a "real" MAD and supposely a "real" CRC I brute forced the preset and saw that an initial value of 0x67 was the key to both verify the example CRC and the read card CRC.

    The code was posted here:
    http://www.libnfc.org/community/post/667/

    Mirroring the preset bits would have been an acceptable answer to my problem, however
    0xC7 = 1100 0111 | 1110 0011 = 0xE3
    0x67 = 0110 0111 | 1110 0110 = 0xE6

    I also tried to mirror the poly but got no result.

    jlanza, can you give setting the preset to 0x67 a try and tell us if it does the trick? chonlias, can you provide your CRC implementation so that we can compare and see where mine and yours are different: your preset is more fine than mine so I might have made something wrong in my CRC computation function.

    Thanks!
    Romain

Similar Threads

  1. Mifare Classic 1k or 4k NDEF mapping
    By Korexio in forum Near Field Communication
    Replies: 4
    Last Post: 2009-05-15, 20:55
  2. Reading data from an External MiFare 1k card
    By shug94 in forum Near Field Communication
    Replies: 4
    Last Post: 2009-04-01, 17:56
  3. SimpleTagConnection and Mifare 1k
    By kwong802 in forum Near Field Communication
    Replies: 0
    Last Post: 2008-01-31, 09:41
  4. Reading Mifare 1K contents after autolaunching the midlet
    By sujithjoseph in forum Near Field Communication
    Replies: 1
    Last Post: 2007-11-27, 14:13
  5. External reader for Emulated Mifare 1k (3220)
    By airodri1 in forum Near Field Communication
    Replies: 0
    Last Post: 2007-05-10, 09:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×