This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TRF7962A: 读取标签多个块数据

Part Number: TRF7962A

麻烦帮忙看下如下问题:

问题背景:

根据官方给的MSP430的例程移植到STM32F207上,在读取多个块数据时会出现下列问题:

1.移动天线的位置会导致读取不到;

2.长时间运行运行标签会漏读;

下面是相关代码:

uint8_t Iso15693ReadMbTransceive(struct RFBuffer *pi)
{
uint8_t j = 1, command[2], no_slots;
uint8_t *p_slot_no, slot_no[17];

slot_no[0] = 0x00;

//BUG FIX
TRF796xCheckRXWaitTime();

//if ((flags & BIT5) == 0x00) //flags = 0x06
if ((buf[6] == 0x01) && ((flags & BIT5) == 0x00))
{
no_slots = 16;
Trf796xEnableSlotCounter(); //使能无响应中断B0位
}
else
{
no_slots = 1;
}

p_slot_no = &slot_no[0]; //0x00

buf[0] = 0x8F;
buf[1] = 0x91;
buf[2] = 0x3D;

buf[3] = (char)(pi->RFLength >> 8);
buf[4] = (char)(pi->RFLength << 4);

memcpy(&buf[5], pi->RFData, pi->RFLength);

Trf796xResetIrqStatus();

//设置20ms的定时器

//清除外部中断标志位
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_11);

Trf796xRawWrite(&buf[0], 5 + pi->RFLength); //完成数据交换

i_reg = 0x01;
irq_flag = 0x00;
//在这里开启计数器
// delay_ms(10);
HAL_TIM_Base_Start_IT(&htim2);

while(irq_flag == 0x00)
{
}

for (j = 1; j <= no_slots; j++)
{
//这里需要20ms计数器
delay_ms(20);

command[0] = RSSI_LEVELS;
Trf796xReadSingle(command);
switch(i_reg)
{
case 0xFF:
foundTag = 1;
testdata = rxtx_state - 1;
memcpy(&pi->RFData[0], &buf[1], testdata);
break;
case 0x02:
p_slot_no++;
*p_slot_no = j;
break;
case 0x00:
break;
default:
break;
}

Trf796xReset();
if ((no_slots == 16) && (j <16))
{
Trf796xStopDecoders();
Trf796xRunDecoders();
Trf796xTransmitNextSlot();
}
else if ((no_slots ==16) && (j == 16))
{
Trf796xStopDecoders();
Trf796xDisableSlotCounter();
}
else if (no_slots == 1)
{
break;
}
}//end for

if (foundTag == 1)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_11); //清除 LINE1 上的中断标志
foundTag = 0;
rxtx_state = 1;
return 0x01;
}

//关闭外部中断
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_11); //清除 LINE1 上的中断标志
foundTag = 0;
rxtx_state = 1;
return 0x00;
}