请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TRF7970A 您好!
我正在编写 sloc297c 示例代码。 我主要了解 trf7970a 的工作原理。 我无法理解是对 IC 进行 SPI 原始写入。
uint8_t ISO14443A_sendPollCmd(uint8_t cmd)
{
uint8_t offset = 0;
uint8_t status = STATUS_FAIL;
g_pui8TrfBuffer[offset++] = 0x8F; // Reset FIFO
g_pui8TrfBuffer[offset++] = 0x90; // Send without CRC
g_pui8TrfBuffer[offset++] = 0x3D; // Write Continuous
g_pui8TrfBuffer[offset++] = 0x00; // Length of packet in bytes - upper and middle nibbles of transmit byte length
g_pui8TrfBuffer[offset++] = 0x0F; // Length of packet in bytes - lower and broken nibbles of transmit byte length
g_pui8TrfBuffer[offset++] = cmd; // Send the polling command from function input - either REQA (0x26) or WUPA (0x52)
// Issue the ISO14443A Polling Command
TRF79xxA_writeRaw(g_pui8TrfBuffer, offset);
g_sTrfStatus = TRF79xxA_waitRxData(3, 10); // 3 millisecond TX timeout, 10 millisecond RX timeout
if (g_sTrfStatus == RX_COMPLETE) // Tag detected - could be either a single or collided tag
{
status = STATUS_SUCCESS;
}
else if (g_sTrfStatus == COLLISION_ERROR)
{
status = STATUS_SUCCESS; // "A PCD detecting a collision in any bit of (b16 to b1) shall commence with the first step of the anticollision loop."
}
return status;
}
上面的函数向 PICC 发送 REQ 命令。 但在 Req cmd 之前、有5 个额外的字节。 写入该数据时未指定寄存器地址。 如何处理该数据。 例如、第一个数据是0x8F、它会重置 FIFO、看起来它是一个命令、但我们不为此过程指定寄存器。 您能否解释或提供任何资源来帮助我理解它?
此致。