
NXP Semiconductors
UM11038
OM27642 Smart Lock KIT
UM11038
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2018. All rights reserved.
User manual
COMPANY PUBLIC
Rev. 1.1 — 11 October 2018
407611
24 of 38
12. Structure of the PN Firmware
PN firmware is split into two tasks:
1) CLIF – RFID task (implemented in
smart_lock_clif.c
)
2) HIF – UART task (implemented in
smart_lock_hif.c
)
The tasks are created in the
appMain
function in
src/smart_lock.c
.
Common code for retrieving the token and door opening is
smart_
lock_token.c
.
12.1 Token retrieval
Token retrieval is done by
smart_lock_retrive_token
function from
s
mart_lock_token.c
. The
function uses
phalMfdf
functions of the
NxpRdLib
to retrieve the token and is independent of
the underlying implementation of
PAL
and
HAL
layers.
Before
phalMfdf
functions can be used one must instantiate and configure the
NxpRdLib
stack.
This action is performed in
smart_lock_init_mfdf
function, which takes pointer to
PAL
and
HAL
layers.
In case you would like to change the card type from
MIFARE DESFire
to some other card from
MIFARE family
these two functions (
smart_lock_init_mfdf
and
smart_lock_retrive_token
)
should be replaced.
After the token is retrieved it is passed to
smart_lock_process_token
function which in turn
validates its content and perform the correct action (error/door opening).
12.2 Task CLIF
Task CLIF is implemented in the
smart_lock_task_clif.c.
It uses standard
NxpRdLib
to initialize
the RFID reader chip and set up the correct
NxpRdLib
stack.
The task uses a timer to schedule itself. When timer lapses it initializes the discovery loop to
search and activate
ISO14443 Type A
cards (with
smart_lock_clif_init_discovery_loop
) and run
the discovery loop. If valid target gets activated the correct
PAL
needs to be initialize and then
we can perform the token retrieval.
The poll loop is performed a finite number of times. Number of tries and time in-between can
be set in
smart_lock_cfg.h
by setting:
•
SMART_LOCK_CFG_TIMER_WAKE_UP_COUNT – how many times we should poll
•
SMART_LOCK_CFG_TIMER_WAKE_UP –time in-between polls
4.
Task CLIF NxpRdLib component stack for activation:
phhalHw_Nfc_Ic_DataParams_t
phacDiscLoop_Sw_DataParams_t
phpalI14443p3a_Sw_DataParams_t
phpalI14443p4a_Sw_DataParams_t
phpalI14443p4_Sw_DataParams_t