蓝牙的NDEF写入信息数据结构如下:


Unsigned char NDEF_Application_Data[] =


       {


//NDEF Tag Application Name


0xD2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01,


//Capability Container ID


0xE1, 0x03,


//Capability Container


0x00, 0x0F, //CCLEN


0x20, //Mapping version 2.0


0x00, 0x3B, //MLe (49 bytes); Maximum R-APDU data size


0x00, 0x34, //MLc (52 bytes); Maximum C-APDU data size


0x04, //Tag, File Control TLV (4 = NDEF file)


0x06, //Length, File Control TLV (6 = 6 bytes of data for this tag)


0xE1, 0x04, //File Identifier


0x0C, 0x02, //Max NDEF size (3072 bytes)


0x00, //NDEF file read access condition, read access without any security


0x00, //NDEF file write access condition; write access without any security


//NDEF File ID


0xE1, 0x04,


0x00, 0x44, //NLEN; NDEF length (68 byte long message)


0xD2, //MB=1b, ME=1b, CF=0b, SR=1b, IL=0b, TNF=010b


0x20, //Record Type Length: 32 octets


0x21, //payload length: 33 octets;


0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x76,


0x6E, 0x64, 0x2E, 0x62, 0x6C, 0x75, 0x65, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x2E,


0x65, 0x70, 0x2E, 0x6F, 0x6F, 0x62, //Record Type Name: application/vnd.blue


//tooth.ep.oob


0x21, 0x00, //OOB optional data length: 33 octets


0x06, 0x05, 0x04, 0x03, 0x02, 0x01, //bluetooth device address:


//01:02:03:04:05:06 (example address only)


0x0D, //EIR Data Length: 13 octets


0x09, //EIR Data Type: Complete Local Name


0x48, 0x65, 0x61, 0x64, 0x53, 0x65, 0x74, 0x20, 0x4E, 0x61,0x6D, 0x65, //


//Bluetooth Local Name: HeadSet Name


0x04, //EIR Data Length: 4 octets


0x0D, //EIR Data Type: Class of device


0x04, 0x04, 0x20, //Class of Device: 0x20:Service Class=


//Audio, 0x04:Major Device Class=Audio/Video, 0x04: Minor Device Class=Wearable //Headset Device


0x05, //EIR Data Length: 5 octets


0x03, //EIR Data type: 16-bit Service Class UUID list (complete)


0x1E, 0x11, 0x0B, 0x11 //16-bit Service Class UUID list (complete) ;0x111E –


//HFP-HF, 0x011B ?A2DP-SNK


           };


3.3 Peer to Peer

P2P是基于NFC论坛定义的Simple NDEF Exchange Protocol(NFCForum-TS-SNEP规范,其主要流程如下。手机可以通过P2P的功能将相关的信息例如图片,链接等与电视进行快速交互。 

 

图8 P2P的软件操作流程



在P2P中设备分为主动模式Initiator和被动模式Target。TRF7970A既可以作为Initiator也可以作为Target。相对来说Target模式下能够有效节约功耗。


1.  主动模式:设备本身会产生RF 电磁场


2.  被动模式:设备使用感应的电磁场进行数据传输 

 

图9 P2P的工作模式

 

3.4 Firmware Update

将MCU的BSL功能与NFC的技术互相结合,通过P2P的方式实现软件升级。以TI的MSP430为例,BSL的软件主要包括Peripheral Interface(PI),Command Interface以及BSL_API。BSL的软件升级接口可以通过UART,SPI,那么将NFC的接口与SPI结合即可实现通过NFC对软件的升级。如图10所示。 

 

图10 BSL软件升级方式


其中NFC的PI主要包括三层:SPI驱动,RFID硬件接口(与TRF7970A的接口)以及NFC(NFC协议的实现,P2P)功能。 

 

图11 NFC PI结构


4 总结

随着NFC近场通信功能的不断普及,以其传输速率快,安全性高等特点,在不同的领域都有着广泛的应用。尤其在授权,支付,蓝牙以及WIFI配对方面有着突出的优势,将NFC的应用引入智能电视,使得信息分享,通信连接更加方便快捷,将能够极大提升用户体验。 

 

5 参考文档

1.  TRF7970A Multi-Protocol Fully Integrated 13.56-MHz RFID/Near Field Communication (NFC) Transceiver IC Data Manual
2.  NFC Data Exchange Format (NDEF) Specification
3.  NFC Digital Protocol Technical Specification
4.  NFC Forum Connection Handover Technical Specification
5.  Bluetooth Secure Simple Pairing Using NFC