Question about Send and Read of ST25R3916
Hello,
I am using the X-NUCLEO-NFC06A1 board to test the NFC functions, and to develop our prototyp NFC reader. I write the Firmware with other micro controller, and find it is really difficult to understand the ST25 Embeeded NFC library (STSW-ST25R16_v1.3.0). The codes are complicate and are not possible to use in my controller.
So read some other Q&A and try to use direct commands and set the registers and to realize the NFC read and write. The following is the current code. ST25R3916 can read and transmit some bytes, because the main interrupt register shows start of receive, end of receive and end of transmission. But it can only receive 2 Bytes like 0x0008.
My question is How can I read the UID and complete data of tag? and how to write data to the tag correctly. Can anyone give a help? Thank you very much.
ST25R3916_Init(void)
{
ST25R3916_Set_CMD(0xC1);//Set default
ST25R3916_Set_CMD(0xDF);//Measure power supply
ST25R3916_Set_Register(0x00,0x07);//Differential, SPI and MCU_CLK disabled
ST25R3916_Set_Register(0x01,0x1C);
ST25R3916_Set_Register(0x02,0xCF);//enable oscillator
/*Wait until the interrupt shows that the oscillator is stable (IRQ when oscillator frequency is stable)*/
ST25R3916_Set_Register(0x03,0x08);
ST25R3916_Set_Register(0x08,0x50);
//ST25R3916_Set_Register(0x0A,0x10);
ST25R3916_Set_Register(0x0B, 0x08);
ST25R3916_Set_Register(0x0F, 0x0E);
ST25R3916_Set_Register(0x11, 0x23);
ST25R3916_Set_Register(0x12, 0x20);
ST25R3916_Set_Register(0x13, 0x02);
ST25R3916_Set_Register(0x14, 0xC8);
ST25R3916_Set_Register(0x15, 0x80);
ST25R3916_Set_Register(0x16, 0x83);
ST25R3916_Set_Register(0x17, 0xBF);
ST25R3916_Set_Register(0x18, 0x0F);
ST25R3916_Set_Register(0x19, 0xFB);
ST25R3916_Set_Register(0x23, 0x30);
ST25R3916_Set_Register(0x25, 0xDD);
ST25R3916_Set_Register(0x26, 0x82);
ST25R3916_Set_Register(0x27, 0x82);
ST25R3916_Set_Register(0x28, 0x70);
ST25R3916_Set_Register(0x29, 0x5F);
ST25R3916_Set_Register(0x2A, 0x11);
ST25R3916_Set_Register(0x31, 0x10);
ST25R3916_Set_Register(0x2A, 0x11);
}
while(1)
{
ST25R3916_FIFO_Write(); // write data to the fifo to send
Write_CMD(0xC2);// Stop all activities
Write_CMD(0xD5);//Reset RX gain
Write_CMD(0xC6);//Transmit REQA
delay_ms(500);
}
