Hi.
I'm writing the code to manage the PN7150 with a 32-bit microcontroller.
I have found an example code for Arduino in the following link: https://github.com/ElectronicCats/ElectronicCats-PN7150 which I am taking as a guide to write my own code.
The first step is to "wake up NFC" using the CORE_RESET_CMD command. This I understand correctly.
uint8_t NCICoreReset[] = {0x20, 0x00, 0x01, 0x01};
uint16_t NbBytes = 0;
// Reset RF settings restauration flag
(void)writeData(NCICoreReset, 4);
After sending those four bytes (Command), proceed to read the response as follows;
getMessage(15);
NbBytes = rxMessageLength;
if ((NbBytes == 0) || (rxBuffer[0] != 0x40) || (rxBuffer[1] != 0x00))
{
return ERROR;
}
My questions are:
How many bytes should it read? Apparently there are only 2.
Why must the first byte be equal to 0x40 and the second byte equal to 0x00?
Where do I get information on the responses to the commands?
I've been looking at the NCI spec, but can't find it.
Similarly, after reading the response, you must wait for the notification, in this case the first and second bytes must be 0x60 and 0x07, respectively.
Any comment or suggestion is welcome
Solved! Go to Solution.
I answer to myself.
The response frame must satisfy the following:
So in the payload (which is 3 bytes) there would be the Status, NCI Version and Configuration Status
Regards
I answer myself, in this table is what is answered to that command, and it is 3 bytes (RSP) and 2 bytes (NTF), I still have to verify what values it really returns
Again I answer to myself.
The response from the NFC has been exactly the one that generates an error in the Arduino example code in the OP. (0x40, 0x00 and 0x03)
The first byte, which is 0x40, is supposed to be looked up in table 94, but there is no code status value.
The same happens for the second and third byte. These values don't indicate the possible cause of the problem
I answer to myself.
It seems that I just understood
I think that 0x40 is the header of the frame, it indicates a response to a command sent from the DH (microcontroller)
I answer to myself.
The response frame must satisfy the following:
So in the payload (which is 3 bytes) there would be the Status, NCI Version and Configuration Status
Regards