RFID Click (CR95HF) SPI not responding

General discussion on mikroElektronika development boards.
Post Reply
Author
Message
matheusprom
Posts: 1
Joined: 16 May 2023 20:00

RFID Click (CR95HF) SPI not responding

#1 Post by matheusprom » 16 May 2023 21:21

Hi,

I've been trying to communicate a CR95HF to my development board from Texas Instruments, LP-CC2651P3.
I've downloaded the SPI TI example for the board and added some functions to communicate with the CR95HF. For these functions I followed this (https://libstock.mikroe.com/projects/vi ... rfid-click) MIKROE example.

I'm only trying the simple command ECHO, but my response is constantly being: 0x00 0x20

Those are the functions a adapted from MIKROE example

Code: Select all

void echoCmd(void)
{
    spiTransaction.count = 2;
    memset((void *)transmitBuffer, 0x00, 20);
    memset((void *)receiveBuffer, 0x0, 20);
    transmitBuffer[0] = 0x00;
    transmitBuffer[1] = 0x55;
    GPIO_write(CONFIG_GPIO_SPI_0_SS, GPIO_CFG_OUT_LOW);
    transferOK = SPI_transfer(spi, &spiTransaction);
    GPIO_write(CONFIG_GPIO_SPI_0_SS, GPIO_CFG_OUT_HIGH);
    readCmd();
}

Code: Select all

static void readCmd(void)
{
    uint8_t res = 0, length = 0;
    uint8_t data[50];
    while(1)
    {
        spiTransaction.count = 2;
        memset((void *)transmitBuffer, 0x00, 20);
        memset((void *)receiveBuffer, 0x0, 20);
        transmitBuffer[0] = 0x03;
        transmitBuffer[1] = 0x0;
        GPIO_write(CONFIG_GPIO_SPI_0_SS, GPIO_CFG_OUT_LOW);
        transferOK = SPI_transfer(spi, &spiTransaction);
        GPIO_write(CONFIG_GPIO_SPI_0_SS, GPIO_CFG_OUT_HIGH);
        
        if( ( (receiveBuffer[0] & 0x08) >> 3 ) )
        {
            Display_printf(display, 0, 0, "\n poll %x \n ", receiveBuffer[0]);
            memset((void *)transmitBuffer, 0x00, 20);
            memset((void *)receiveBuffer, 0x0, 20);
            spiTransaction.count = 2;
            transmitBuffer[0] = 0x02;
            GPIO_write(CONFIG_GPIO_SPI_0_SS, GPIO_CFG_OUT_LOW);
            transferOK = SPI_transfer(spi, &spiTransaction);
            GPIO_write(CONFIG_GPIO_SPI_0_SS, GPIO_CFG_OUT_HIGH);
            break;
        }

        usleep(10000);

    }
    GPIO_write(CONFIG_GPIO_SPI_0_SS, GPIO_CFG_OUT_HIGH);
    Display_printf(display, 0, 0, "\n ================ \n ");
    Display_printf(display, 0, 0, "Cmd read: ");
    for(uint8_t i = 0; i < 2; i++)
    {
        Display_printf(display, 0, 0, "%x ",data[i]);
    }

}

Post Reply

Return to “Development Boards”