Hello,
I have a question about the flow of card emulation.
Do not point me to the NFC reader library example HCE_T4T, I have PNEV5180 and already know about the existence of that example.
This is the flow I came up with after going through the example.
1. Initialize SPI connection with PN5180
2. Reset the PN5180 IC using RST pin and wait for IDLE IRQ to set, then clear IRQ
3. Disable EMD in EMD_CONTROL register by using writeRegisterWithAndMask(0xFFFFFFFE)
4. Switch to IDLE mode - writeRegisterWithAndMask(SYSTEM_CONFIG, 0xFFFFFFF8)
5. Turn off RF.
6. Clear IRQ status - clearIRQStatus(0x000FFFFF);
7. Enable RX IRQ
8. Declare 4 byte buffer.
uint8_t buf[4];
buf[0] = 0x0B; SWITCH MODE command
buf[1] = 0x02; Autocoll mode
buf[2] = 0x01; NFC-A masking , RF technologies
buf[3] = 0x02; Autonomous mode used without entering standby mode, Autocoll parameter
transceiveCommand(buf, 4, 0, 0))
9. Now in while loop constantly scan for RX IRQ and wait for it to be set.
10. After bringing the phone RX IRQ is being set. reading the RX_STATUS register's first 9 bits it gives us the number of received bytes. which is 2.
11. Use the ReadData command to read the data into buffer which is - 0xE0, 0x80. After this clear the IRQ_STATUS register
12. Use the SendData command to send the buffer of 0x09 - SendData command, 0x00 - number of valid bits, and 5 bytes of ATS so the buffer looks like {0x09, 0x00, 0x05, 0x75, 0x00, 0x88, 0x00}.
13. After this wait for the TX IRQ to be set and then wait for RX IRQ to be set ( waiting for select command)
14. Once the RX IRQ gets set and when I read the data in it, it returns 0xF0, 0x25, 0xD4. which is garbage value and i think some error occured. I am stuck in this part.
Again, please don't refer me to the NFC reader library example. Just please if you know what I am doing wrong just tell me what I am doing wrong in this flow and I will correct it.
Thank you in advance.
I am stuck in same problem. i wish someone have done custom CE mode and can help us