2020-05-19 05:00 AM
I have problem to to read from the chip.
The Datasheet is used is the: DocID018669 from ST
At first i want to try the echo command to know if the chip is available.
Hardware Connections:
SSI_1 to GND
SSI_0 to 3.3V
SPI-Interface(CLK/CS/MISO/MOSI) to MCU
SPI_Interuppt_IN(UART_RX) to MCU GPIO
for the CS/SSI_1/SSI_0/SPI_Interrupt i used a 3.3K pull up resistors
The for the SPI_CLK I try different frequency below 2MHz for example : 800KHz
For the Code I show you some pseudocode so someone can tell me if i make a failure:
MCU_Init();
SPI_start();
/*toggel Intterupt for Boot up Sequence*/
writeGPIO(RFID_Interrupt_In,HIGH);
delayMS(1);
writeGPIO(RFID_Interrupt_In,LOW);
delayMS(1);
writeGPIO(RFID_Interrupt_In,HIGH);
delayMS(20);
/*Sende Echo command*/
txBuffer[0]=0;
txBuffer[1]=CR95HF_CMD.ECHO;/*0x55*/
SPI_Write(txBuffer,2);
while(1){/*never return*/
/*Send Poll Command*/
txBuffer[0]=CR95HF_CMD.POLL;/*0x03*/
SPI_Write(txBuffer,1);
/*wait until Chip respons with ready*/
SPI_Read(rxBuffer,1);
if(rxBuffer[0] & 0x08 >>3){/*never come inside here*/
txBuffer[0]=CR95HF_CMD.READ;/*0x02*/
SPI_Write(txBuffer,1);
SPI_Read(rxBuffer,1);
printf("Echo: %u \r\n",rxBuffer[0]);
break;
}
printf("Inside Loop\r\n");
}
For better understanding I add a picture of the SPI Communication.
In the Picture:
yellow: SPI_CLK
blue: CS
red: MOSI
green: MISO
Can someone help me why the Chip is not responding?
Solved! Go to Solution.
2020-05-26 03:06 AM
Hi,
"I got the Polling and the Echo working." can you share more details about the issue you had and what has been fixed?
Can you confirm the echo reply is 0x55:
MOSI 00 55 02 00
MISO 06 06 0E 55
CS --______----_______--
IRQ_OUT -------____------
Do you use the 0x03 poll control or the IRQ_OUT? I strongly recommend to use the IRQ_OUT (see ST25R95 Datasheet §5.9). I also recommend to use the driver and communication stack from the X-CUBE-NFC3 package. Which MCU do you plan to use?
After sending the IDN command, make sure to assert the nSPI_SS line high, then either wait for nIRQ_OUT being low or poll until bit#3 = 1 (Data can be read from the CR95HF when set) and then send the read control byte 0x02 and read the response code and the Length then read the remaining bytes according to the Length:
MOSI 00 01 00 03 03 03 02 XX XX XX...
MISO 06 06 06 06 06 0E 0C 00 0F 4E...
CS --__________------_________----_____________..._----
IRQ_OUT ---------------------------_____________________------
Rgds
BT
2020-05-19 07:11 AM
Hi,
ST provides an NFC communication stack and a ST25R95/CR95HF driver in X-CUBE-NFC3. This package can be ported on many different MCU. It can also be used as an example for a custom implementation of the driver. The ST25R95/CR95HF driver includes the startup sequence and the echo test command.
Can you provide more information about your setup:
I would suggest to check that:
It is possible as well to poll for readiness by sending a poll control byte (0x03) after the startup sequence, If bit2 of the response byte is 1, the CR95HF is ready to receive commands. When sending the poll control byte to poll for readiness after startup, the usual response is 0x06. See attached screenshot from a logic analyzer with initial poll and then echo command.
Regarding the pull up resistors, I had a look on the X-NUCLEO-NFC03A1 schematics (see UM1799), and I've not seen any pull up on the SPI_CS signal.
Rgds
BT
2020-05-25 11:44 PM
To evaluate the Chip i use a RFID-Click board.
Later we want to design a custom board.
I got the Polling and the Echo working.
Now I want to try to get the ID from the CR95HF.
I send the following to read the ID:
write(0x00) /*to send cmd*/
write(0x01) /*IDN cmd*/
write(0x00) /*length of Message*/
Polling until 0x6 or 0x4
write(0x02)
reading()
but when i read 19 Bytes i just receive 0x6:
recBuf0: 6
recBuf1: 6
recBuf2: 6
recBuf3: 6
recBuf4: 6
recBuf5: 6
recBuf6: 6
recBuf7: 6
recBuf8: 6
recBuf9: 6
recBuf10: 6
recBuf11: 6
recBuf12: 6
recBuf13: 6
recBuf14: 6
recBuf15: 6
recBuf16: 6
recBuf17: 6
Did i send the IDN cmd correct?
2020-05-26 03:06 AM
Hi,
"I got the Polling and the Echo working." can you share more details about the issue you had and what has been fixed?
Can you confirm the echo reply is 0x55:
MOSI 00 55 02 00
MISO 06 06 0E 55
CS --______----_______--
IRQ_OUT -------____------
Do you use the 0x03 poll control or the IRQ_OUT? I strongly recommend to use the IRQ_OUT (see ST25R95 Datasheet §5.9). I also recommend to use the driver and communication stack from the X-CUBE-NFC3 package. Which MCU do you plan to use?
After sending the IDN command, make sure to assert the nSPI_SS line high, then either wait for nIRQ_OUT being low or poll until bit#3 = 1 (Data can be read from the CR95HF when set) and then send the read control byte 0x02 and read the response code and the Length then read the remaining bytes according to the Length:
MOSI 00 01 00 03 03 03 02 XX XX XX...
MISO 06 06 06 06 06 0E 0C 00 0F 4E...
CS --__________------_________----_____________..._----
IRQ_OUT ---------------------------_____________________------
Rgds
BT