这种情况偶尔会发生。
运行了一段时间时候,具体多长时间确定,感觉也没规律。
中断出现的频率是54us左右(示波器观察)。
进入中断之后
sSpiInformation.ulSpiState = eSPI_STATE_READ_IRQ;
/* IRQ line goes down - we are start reception */
ASSERT_CS();
// Wait for TX/RX Compete which will come as DMA interrupt
SpiReadHeader();
sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;
SSIContReadOperation();
在SpiReadHeader();中会收到10个字节02 00 ff 00 00 00 00 00 00 00而且每次都是这十个。
在SSIContReadOperation中
if (!SpiReadDataCont())
{
// All the data was read - finalize handling by switching to the task
// and calling from task Event Handler
SpiTriggerRxProcessing();
}
会进入SpiTriggerRxProcessing。
最终进入
void SpiReceiveHandler(void *pvBuffer)
{
tSLInformation.usEventOrDataReceived = 1;
tSLInformation.pucReceivedData = (unsigned char *)pvBuffer;
if(tSLInformation.usRxEventOpcode == HCI_EVNT_RECVFROM)
{
if(!hci_unsolicited_event_handler())
{
rt_sem_release(g_event_semaphore);
}
}
else
hci_unsolicited_event_handler();
}
上面这段被我改了下用在rtthread里。
watch看到tSLInformation.usRxEventOpcode 的值是 0x1003,查看了定义这个应该是HCI_EVNT_SEND。
之后进入hci_unsolicited_event_handler()中
hci_unsolicited_event_handler(void)
{
unsigned long res = 0;
unsigned char *pucReceivedData;
if (tSLInformation.usEventOrDataReceived != 0)
{
pucReceivedData = (tSLInformation.pucReceivedData);
if (*pucReceivedData == HCI_TYPE_EVNT)
{
// In case unsolicited event received - here the handling finished
if (hci_unsol_event_handler((char *)pucReceivedData) == 1)
{
// There was an unsolicited event received - we can release the buffer
// and clean the event received
tSLInformation.usEventOrDataReceived = 0;
res = 1;
SpiResumeSpi();
}
}
}
return res;
}
*pucReceivedData的值是0直接退出。
之后就是一直进行这个循环。
由于程序不是很好调试,tSLInformation.usRxEventOpcode 的值是 0x1003。还没找到在哪个send的地方出现的这种情况,待下次补充。
望根据上述信息能否判断我这个是什么问题。谢谢。