NXP Semiconductors OM27642 Скачать руководство пользователя страница 20

 

 

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 

20 of 38 

11.  Structure of the QN Firmware 

The QN firmware is built on NXP Bluetooth Low Energy library. This library implements a 
proprietary profile which is optimized sending and receiving APDU commands. It 
automatically splits data onto several Bluetooth Low Energy packets if necessary. In 
addition, the library uses the Bluetooth Low Energy feature to send several Bluetooth 
Low Energy packets in one communication interval to speed up communication.  
All data is transferred using unacknowledged Bluetooth Low Energy packets: 

 

Write Commands (Bluetooth Low Energy client to QN) 

 

Notifications (QN to Bluetooth Low Energy client) 

 
Data sheet QN902x: 

http://www.nxp.com/documents/data_sheet/QN902X.pdf

  

Application note: 

http://www.nxp.com/documents/application_note/AN11664.pdf

 

 
The communication with PN is basically done by two modules: 

 

app_pn_task.c: The PN TASK handles the whole communication with the PN. It 
controls the state, interprets the commands and starts/stops the communication 

 

pn_nfc.c: driver to communicate with PN. This module handles the low-level 
functions to communicate with PN. It contains functions which run the context of 
the GPIO interrupt as well as UART interrupt. In case of an event this module will 
send a message to the 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 actions and control the state of the 
QN. This means that all input from PN (UART data but also GPIO wake-up events) is 
converted to messages and sent via messages queues to the PN TASK. 
 
To send messages to the PN TASK this module provides global functions which build 
and send the appropriate messages. 
 
From the QN point of view two events may start a transaction and thus the 
communication with the PN: 

 

PN is woken up by proximity sensor or micro switch and wants to communicate 
with QN. The handshake sequence may start immediately. 

 

A Bluetooth Low Energy client connects to QN. QN has to power on PN before 
starting with the handshake sequence. 

 
 
The PN_TASK basically uses three app states: 

 

PN_STATE_IDLE: QN advertises and uses low power mode. Sleep mode is not 
possible since RTC must be powered. The task is waiting either for a Bluetooth 
Low Energy connection or a wake-up event from PN via GPIO line. 

 

PN_STATE_BLE_ACTIVE: A Bluetooth Low Energy Client has connected and 
subscribed to receive notifications from QN. In this state the PN_TASK acts as a 
kind of proxy between the Bluetooth Low Energy client and the PN, meaning it 
transfers APDU commands from PN to the Bluetooth Low Energy client and 
APDU responses in the other direction. 

 

PN_STATE_NFC_ACTIVE: PN is powered up (e.g. proximity sensor) and wants 
to read the current RTC value from QN. In this state no APDUs are exchanged 
since those are handled locally between the PN and a NFC medium directly. Still 

Содержание OM27642

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Отзывы: