ATrappmann / PN5180-Library

PN5180 library for Arduino
GNU Lesser General Public License v2.1
105 stars 92 forks source link

issueISO15693Command hangs on receiving more than 50+ bytes #38

Open ddv2005 opened 3 years ago

ddv2005 commented 3 years ago

Hello,

I tried to implement read multiple blocks (0x23) command and found that it hangs on reading more than 57 bytes. I found that it is because issueISO15693Command reads RX_STATUS (to check received data length) but RF data still in fly and received data length not correct. If I put some delay before reading RX_STATUS then I can read more data without hangs but it should be some procedure to find out exact moment when all data received and buffered.

ddv2005 commented 3 years ago

I found correct way - check RX_IRQ_STAT bit before reading RX_STATUS :

sendData(cmd, cmdLen); delay(10);

uint32_t irqR = getIRQStatus(); if (0 == (irqR & RX_SOF_DET_IRQ_STAT)) { return EC_NO_CARD; }

while(!(irqR & RX_IRQ_STAT)) { delay(1); irqR = getIRQStatus(); }

uint32_t rxStatus; readRegister(RX_STATUS, &rxStatus);