NXP Semiconductors OM27642 User Manual Download Page 21

 

 

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 

21 of 38 

the QN is ready to accept commands from PN like reconfiguring the device name 
(e.g. room number is changed). 

 
The main handlers in active state are the functions 

 

pn_uart_rx_ind_handler()

 It processes messages sent from the pn driver and 

thus evaluates the commands received from PN. 

 

pn_ble_rx_ind_handler()

 It forwards response APDUs from the Bluetooth Low 

Energy client to the PN 

 

11.2  src\driver\pn_nfc.c 

This driver is responsible for: 

 

wake-up QN in case PN wants to communicate 

 

power on PN 

 

receive and evaluate data from PN, build messages from incoming data and 
forward these messages to the PN TASK 

 

build and send messages to the PN 

 
When PN starts a transaction (e.g. is powered due to proximity sensor) it will trigger a 
GPIO interrupt on line BLE_DETECT. The GPIO interrupt handler calls 

pn_nfc_gpio_interrupt_cb()

. This callback function processes the event and sends the 

message PN_NFC_ACTIVATE_REQ to the PN TASK. Before it will block additional 
GPIO events to avoid sending multiple messages (

allow_wakeup=0

). 

 
ATTENTION: To be sure that the QN OS Kernel is active, the library function 

sw_wakeup_ble_hw()

 must be called. Otherwise the sent message could be processed 

only after a considerable delay. 
 
The PN_TASK will then activate the UART by calling the function 

pn_nfc_activate()

 

 
The original uart driver from the QN SDK is modified to work with pn_nfc.c. The define 

UART0_PN_EN 

activates a different receive mode in uart.c (in contrast to the original QN 

SDK procedure). All characters being received via UART are forwarded via callback 
function to pn_nfc.c: 

static void pn_uart_rx_data(uint8_t rx) 

 
During initial handshake phase all characters different from ‘P’ are being ignored (static 
variable 

ignore

). This shall filter possible spurious signals on the serial line when PN is 

powered on. 

 

pn_uart_rx_data

 processes all incoming data and assembles it to messages. After 

having received a full message from PN it is forwarded to the PN TASK. It is then the 
responsibility of the PN TASK to take appropriate actions. 
 
If PN TASK wants to send messages to PN it uses the function 

pn_nfc_send_response(uint8_t cmd, const uint8_t *data, uint16_t len)

 

 
After the transaction is finished PN TASK it calls pn_nfc_power_off(). This will also 
deactivate the UART to save power. In fact, the PN has to power off itself. The BLE_OUT 
line is set to low, so it can retrigger power for the PN later on. 
 

Summary of Contents for OM27642

Page 1: ...ds OM27462NBR Smart Lock KIT User manual Abstract This document describes the content the hardware implementation and the usage of the Android application as well as the access token structure and pro...

Page 2: ...ject to legal disclaimers NXP B V 2018 All rights reserved User manual COMPANY PUBLIC Rev 1 1 11 October 2018 407611 2 of 38 Contact information For more information please visit http www nxp com Revi...

Page 3: ...sts of two PCBs and incorporate the following main IC components PN7462AU all in one full NFC application controller with freely programmable Controller PN from now on QN9020 for Bluetooth Low Energy...

Page 4: ...his document is subject to legal disclaimers NXP B V 2018 All rights reserved User manual COMPANY PUBLIC Rev 1 1 11 October 2018 407611 4 of 38 2 Smart Lock KIT Package Content Fig 1 OM27462NBR Smart...

Page 5: ...rd contains all necessary blocking capacitors XTAL 2 status LEDs and the antenna EMC filter The Core module is designed for general purpose use therefore all power supply options e g internal external...

Page 6: ...2018 All rights reserved User manual COMPANY PUBLIC Rev 1 1 11 October 2018 407611 6 of 38 3 1 Smart lock system block diagram Fig 3 Main building blocks Fig 4 OM27462NBR NFC Bluetooth Low Energy Modu...

Page 7: ...t 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 7 of 38 4 Schema...

Page 8: ...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 8 of 38 4 1 Base board sche...

Page 9: ...11038 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 9 of 38 4 2 Core Module schem...

Page 10: ...ng of the Smart Lock main PCB is shown below The EMC filter is part of the stack on core Module The base board consists of the matching circuit with the damping resistors and the serial and parallel m...

Page 11: ...rdware module 1 Connect the Touch sensor plate as shown in fig 1 2 Connect a DC power source 2V 3 3V to the pins labeled BAT see fig 1 6 1 1 Smart Lock power connection As the Smart Lock is intended t...

Page 12: ...ile active 2 Present Room 201 ACCESS Guest 1 card or Room 201 ACCESS Guest 1 re issued card in close proximity of the module If the card is valid and accepted LED will light up green and the buzzer wi...

Page 13: ...isclaimers NXP B V 2018 All rights reserved User manual COMPANY PUBLIC Rev 1 1 11 October 2018 407611 13 of 38 7 2 Operating the Smart Lock using the mobile Smart Lock App Download the NXP SMARTLOCK a...

Page 14: ...art 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 14 of 38 Fig 1...

Page 15: ...r mode any time by interrupt on GPIO when PN requires the current time from QNs RTC to check the token 8 2 Interaction between PN and QN when token is delivered over RFID When the token is delivered o...

Page 16: ...00 bps and data format 8N1 The GPIO lines are used to power the PN in case a Bluetooth Low Energy client connects or to wake up QN in case a card or phone is presented to the PN via NFC The UART is us...

Page 17: ...exist to start the communication between QN and PN 10 1 1 NFC Transaction In this use case the PN is powered up either by the proximity switch or the micro switch In both cases the PN has to wake up t...

Page 18: ...is use case QN will power PN using the BLE_OUT line after establishing the Bluetooth Low Energy connection After power on the PN will start the communication by triggering the QN GPIO interrupt using...

Page 19: ...le C PN sends APDU command to QN QN forwards data to the Bluetooth Low Energy client A QN responds with response APDU T PN sets RTC in QN N PN sets a new Bluetooth Low Energy device name in QN D PN in...

Page 20: ...e PN TASK which will handle the event in a synchronous way Note In the download area only the binary files are provided 11 1 src app pn app_pn_task c The PN TASK has the overall responsibility to take...

Page 21: ...sending multiple messages allow_wakeup 0 ATTENTION To be sure that the QN OS Kernel is active the library function sw_wakeup_ble_hw must be called Otherwise the sent message could be processed only af...

Page 22: ...uetooth Low Energy client After a Bluetooth Low Energy disconnect sequence is completed trigger via Bluetooth Low Energy client or smartlock the PN_TASK receives a PN_BLE_DISC_IND message and the hand...

Page 23: ...advertise cycle again 11 7 Data exchange 11 7 1 1 Send data Data exchange state is entered by calling Smart Lock _uart_wait_for_cmd to set up the correct callbacks on UART to wait for command from PN...

Page 24: ...FARE 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_proc...

Page 25: ...ams_t phalMfdf_Sw_DataParams_t phKeyStore_Sw_DataParams_t phCryptoSym_Sw_DataParams_t phCryptoRng_Sw_DataParams_t 12 3 2 phbalReg_Smart Lock _DataParams_t phbalReg_Smart Lock _DataParams_t component c...

Page 26: ...ersion Purpose OM27462NBR Smart Lock KIT 1 2 or higher Demonstrator board OM13054 LPC Link 2 1 0 Standalone debug adaptor LPCXpresso IDE 8 0 0 or higher Development IDE for PN LPCXpresso PN7462AU plug...

Page 27: ...ort the Smartlock PN Project via File Import Existing Project into Workspace Build the Project via Project Build All Additional compiler may need to be installed based on your environment Connect the...

Page 28: ...ild Target Connect the LPC Link2 and the Smartlock QN SWD Pins with the flashing cable to the correct pins as shown in Fig 18 Make sure the JP2 jumper on the LPC Link 2 is set and the Battery is conne...

Page 29: ...ved User manual COMPANY PUBLIC Rev 1 1 11 October 2018 407611 29 of 38 A new Window should open and show the SW Device in the List Device Name should be ARM CoreSight SW DP as in Fig 20 Fig 20 Configu...

Page 30: ...rovided 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 30 of 38 Fig 21 Configure Utilities in Keil Save the...

Page 31: ...it is also possible to flash the QN via a serial port Remove the PN Core module and connect your serial port with the QN as shown in the Fig 22 Fig 22 Connections for serial flashing Open the QBlue I...

Page 32: ...Crypto Mode AES DF Name 07060504030201 HEX 3 keys Key 0 app Master key Diversified Key needed Non diversified Key 00000000000000000000000000000001 Key 1 Read key for File id 00 Diversified key needed...

Page 33: ...bytes 14 3 Standard Data file content 14 3 1 Token format 14 3 2 Token verification process 1 Validate RevToken chose appropriate processing If revision is below current Rev in lock Token isn t valid...

Page 34: ...siderations At present the Bluetooth Low Energy is operating in polling mode and advertises every 600ms In order to further reduce the average power consumption one might consider changing the hardwar...

Page 35: ...ponsibility to determine whether the NXP Semiconductors product is suitable and fit for the customer s applications and products planned as well as for the planned application and use of customer s th...

Page 36: ...tooth The Bluetooth word mark and logos are registered trademarks owned by Bluetooth SIG Inc and any use of such marks by NXP Semiconductors is under license AMBA Arm Arm7 Arm7TDMI Arm9 Arm11 Artisan...

Page 37: ...Energy Transaction 18 10 2 Data exchange 19 11 Structure of the QN Firmware 20 11 1 src app pn app_pn_task c 20 11 2 src driver pn_nfc c 21 11 3 Interaction with Bluetooth Low Energy Stack 22 11 4 Blu...

Page 38: ...NXP B V 2018 All rights reserved For more information please visit http www nxp com Date of release 11 October 2018 407611 Document identifier UM11038 15 Power consumption figures 34 16 Power optimiza...

Reviews: