-
Notifications
You must be signed in to change notification settings - Fork 25
NCI
The NFC Forum has standardized the communication between the MCU (they call it Device Host - DH) and the NFC device (PN7150 in this case).
To summarize this standard, you have : Data messages and Control messages. Control messages come in 3 types:
- Command : instruct the PN7150 to do something
- Response : The PN7150 responds to your command
- Notification : The PN7150 let's you know, something happened
The syntax of all these messages has been defined by the NFC Forum
On top of the formatting of messages, the standards define some standard behaviour, eg. which messages are needed to initialize the NFC device what messages sequence is needed to start polling for NFC smartCards, etc.
This is all defined through use of a State Machine. The NCI part of the driver helps you with this state machine.
Because each Command to the PN7150 requires a Response, I decided to create extra states for this. An example: in NCI-State 'RF_Idle' the MCU sends 'Discover_CMD'. According to NCI, the state should move to 'RF_Discovery'. But only if the 'Discover_CMD' was succesful, which you can only know from the 'Discover_RSP' response. So an additional state is , needed, where we wait for a response. With the correct response we move the state to 'RF_Discover', if not, we return or handle it as an error.