FIFO on CLRC632

cancel
Showing results for 
Search instead for 
Did you mean: 

FIFO on CLRC632

111 Views
jbertrand
Contributor I

Hello,

I'm trying to write some functions to read ISO14443a tag with a CLRC632. I have written several functions to read and write registers, to read and write fifo and I'm pretty sure these functions are bug free as I can send a frame to FIFO, compute CRC code and read this CRC code from FIFO (with of course expected value).

Now, I'm triying to transceive a short frame (REQA). My function doesn't work and I have added some traces.

uint8_t
iso14443a_transceive_short_frame(uint8_t commande, iso14443a_atqa_t *atqa)
{
    uint8_t             longueur;

char t[40];
sprintf(t, "%d ", clrc632_read_register(CmdFIFOLength));

    // 7 bits, sans parité
    clrc632_write_register(CmdCommand, C_Idle);
sprintf(t, "%s%d ", t, clrc632_read_register(CmdFIFOLength));
    clrc632_write_register(RfChannelRedundancy, 0x00);
sprintf(t, "%s%d ", t, clrc632_read_register(CmdFIFOLength));
    clrc632_write_register(CtrlBitFraming, 7);
sprintf(t, "%s%d ", t, clrc632_read_register(CmdFIFOLength));

    memset(atqa, 0, sizeof(*atqa));

sprintf(t, "%s%d ", t, clrc632_read_register(CmdFIFOLength));
    clrc632_write(CmdFIFOData, (uint8_t *) &commande, sizeof(commande));
sprintf(t, "%s%d ", t, clrc632_read_register(CmdFIFOLength));
    clrc632_write_register(CmdCommand, C_Transceive);

sprintf(t, "%s%d\n\r", t, clrc632_read_register(CmdFIFOLength));
vfd_send_byte(0x0C);
vfd_print(t);
    longueur = 0;
    hz_set_t0(hz_timeout_nfc);

    do
    {
        if ((longueur = clrc632_read_register(CmdFIFOLength)) == 2)
        {
            break;
        }
    } while(hz_get_ts(hz_timeout_nfc) <= 5);

    if (longueur == 2)
    {
        (*atqa).data[0] = CmdFIFOData;
        (*atqa).data[1] = 0x00;

        clrc632_read((*atqa).data, longueur);

        sprintf(t, "%02X %02X", (*atqa).data[0], (*atqa).data[1]);
        vfd_print(t);
    }
    else
    {
        sprintf(t, "EL=%u", longueur);
        vfd_print(t);
    }

    clrc632_write_register(CmdCommand, C_Idle);
    return(ISO14443A_EXIT_SUCCESS);
}

 Of course, CRLC632 is initialized before this function. I have read datasheet and, for me, this code only pushs one byte in FIFO (0x26).

vfd_printf() prints informations on a VFD sreen and I can see :

0 0 1 1 1 2 1
EL=0

 I don't understand why clrc632_write_register(RfChannelRedundancy, 0x00) writes a byte in FIFO. I have verified that RfChannelRedundancy value is 0x22. Please note that, after clrc632_write(CmdFIFOData, (uint8_t *) &commande, sizeof(commande)), another byte is written in FIFO (0x26).

I suppose I have misunderstood something. Explanation will be welcome.

Best regards,

JB

0 Kudos
1 Reply

104 Views
jbertrand
Contributor I

If I wait for Idle command between write operations, CLRC632 works better. Now FIFO only contains one byte.

0 Kudos