RFID Module Assistance Needed

Okay i have this rfid module which has a serial UART interface
Its been a pain in the backside for three days now and i'm getting really fraustrated so it's time to call in the LMR professionals!
My problem consists of two, maybe more issues which i'm having a hard time with and im sure you would to if you was a noob with rfid modules so here is my problem
Here is the module http://www.elechouse.com/elechouse/images/product/13.56MHZ_RFID_Module/13.56MHZ_RFID_Manual.pdf
I'm trying to figure out how to write properly to the card

Here is some code i wrote:

void write_string_to_card(unsigned char key_type, unsigned char *key, unsigned char block_number, unsigned char *string)
{
    unsigned char command_buf[30];
    unsigned char i;

    command_buf[0] = 0xAB; /** data frame head */
    command_buf[1] = 0x1A; /** data frame length */
    command_buf[2] = 0x04; /** COMMAND: write data to a block */
    command_buf[3] = block_number;
    command_buf[4] = key_type;

    /** frame key area initialize */
    for(i=0; i<8; i++)
    {
        command_buf[5+i] = key[i];
    }

    /** frame data area initilize */
    for(i=0; i<16; i++)
    {
        command_buf[12+i] = string[i];
    }

    /** send frame through serial port*/
    for(i=0; i<27; i++)
    {
        Serial3.write(command_buf[i]);
    }
    Serial.println("Written to card");
}


void setup()
{
  Serial.begin(9600);
  Serial3.begin(9600);
}

void loop()
{
    unsigned char string[16] = "HI, RFID";
    unsigned char key[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,};
    /** send string use 0 type key to 3rd block */
    write_string_to_card(0, key, 3, string);
    delay(2000); /** Delay to write to the card next time */
}

Now even after i do this it writes to the card but i'm also having an issue reading the cards 3rd block
So i'm wondering if anyone can help me out by creating two arduino sketches to read/write to/from the same area of the rfid tag

Please let me know if y need more information!

-Elitism

I’m no expert on uart or

I’m no expert on uart or rfid (havent actually used either yet); but have you tried modifiying the code so instead of this:

void loop()
{
    unsigned char string[16] = “HI, RFID”;
    unsigned char key[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,};
    /** send string use 0 type key to 3rd block /
    write_string_to_card(0, key, 3, string);
    delay(2000); /
* Delay to write to the card next time /
}

you do this:

void setup()
{
  Serial.begin(9600);
  Serial3.begin(9600);

    unsigned char string[16] = “HI, RFID”;
    unsigned char key[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,};
    /* send string use 0 type key to 3rd block */
    write_string_to_card(0, key, 3, string);

}

and then use loop to try to read it?

 

Just taking a guess that writing it over and over might cause an issue. Ill go do some googleing but that was my first thought

I put it in a loop because

I put it in a loop because it’s just the write code that i posted

as this is my first time playing with rfid i’ve seperated them into loops, so looping will write

then i can reprogram the arduino with a new sketch to read from the same sector of the card

I’m just having issues actually reading the string i put inside the card at sector block 3

and wondering if the code i posted actally does write to that sector

Sample Rfid Read Code

I don’t know if you already saw this or not but here is the sample code for reading From it. I attempted to copy it here but it looks like you’ll have to retype it manually. Their pdf is password protected or something.:

http://www.elechouse.com/elechouse/images/product/13.56MHZ_RFID_Module/RFID%20with%20Arduino.pdf

That is just to read the

That is just to read the serial number of the card, not the block in the card i wrote to, it’s much more complex than that

I’ve tried modifying my write_card code but it only returns a 172267-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1

after i wrote to the card

changing the string and reading from it again displays the same nmber so i’m confused and need help with an experienced person