分享
BLE_CC2540.pdf
下载文档
下载文档

ID:3041970

大小:3.37MB

页数:136页

格式:PDF

时间:2024-01-18

收藏 分享赚钱
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,汇文网负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
网站客服:3074922707
BLE_CC2540
LPRF San Diego Bluetooth Low Energy Deep DiveMay 2011TI confidential information-Strictly PrivateAgendaIntroductionBluetooth Low Energy Protocol Stack(2.5 hours)Stack Architecture/OverviewLink Layer Basics of BLE communicationGeneric Access Profile(GAP)Roles,Device Discovery,Connections,SecurityAttribute Protocol(ATT)Attribute Table,Reading and Writing DataGeneric Attribute Profile(GATT)Profiles,Services,CharacteristicsBLE Industry and Technology UpdateCC2540 BLE Software(2.5 hours)CC2540 Hardware OverviewCC2540 BLE Software Architecture and StructureSimpleBLEPeripheral Project Framework for Custom ApplicationsGAP Role Profiles and Bond ManagerGATT Profiles and ServicesCC2540DK-MINI Kit OverviewHands-on Labs(3 hours)TI confidential information-Strictly PrivateGoals for this TrainingGain a basic understanding of what Bluetooth low energy is,and how BLE communications work at the link-layerUnderstand Bluetooth low energy access control and data communication at the top-layers of the protocol stackLearn about the current state of BLE from an industry and technology perspectiveBecome familiar with the architecture of CC2540 BLE software,including the OSAL,HAL,BLE stack,profiles,application,and how all of the pieces work togetherBe able to get started with the CC2540DK-MINI kit and use BTool to create a BLE connectionBe able to open up,build,and debug projects on the CC2540 using IAR Embedded Workbench and the CC DebuggerBe able to modify the existing GAP role profilesBe able to modify existing GATT attribute profiles,or create new onesUnderstand the sample applicationsTI confidential information-Strictly PrivateWhat is Bluetooth Low Energy?A wireless protocol standard overseen by the Bluetooth Special Interest Group(BT-SIG),comprised of member companies including Texas Instruments The primary new feature added to the Bluetooth standard in version 4.0 of the Bluetooth core specification(adopted in June 2010)Targeted towards wireless applications with low-power,low-latency,and low-throughput requirements Primarily centered around the mobile phone and PC ecosystem,but can be used for other applications as well Expected to be found in billions of devices over the next five years Not backwards compatible with classic Bluetooth devicesTI confidential information-Strictly PrivateAgendaIntroductionBluetooth Low Energy Protocol Stack(2.5 hours)Stack Architecture/OverviewLink Layer Basics of BLE communicationGeneric Access Profile(GAP)Roles,Device Discovery,Connections,SecurityAttribute Protocol(ATT)Attribute Table,Reading and Writing DataGeneric Attribute Profile(GATT)Profiles,Services,CharacteristicsBLE Industry and Technology UpdateCC2540 BLE Software(2.5 hours)CC2540 Hardware OverviewCC2540 BLE Software Architecture and StructureSimpleBLEPeripheral Project Framework for Custom ApplicationsGAP Role Profiles and Bond ManagerGATT Profiles and ServicesCC2540DK-MINI Kit OverviewHands-on Labs(3 hours)TI confidential information-Strictly PrivateBluetooth Low Energy Protocol Stack Architecture/ConfigurationsProtocol stack consists of two main sections:ControllerHostProfiles and Application sit on top of the GAP and GATT layers of the hostIn a“single-device solution”(or“single-chip solution”),the host,controller,profiles,and application are all implemented together on the same chipIn a“dual-device solution”,the BLE controller is implemented on one device,while the host,application,and profiles are implemented separatelyIn a“network processor”,the host and controller are implemented together,but the application and profiles sit on another device(such as a PC or external microcontroller)CC2540 can support any of these configurationsTI confidential information-Strictly PrivateBluetooth Low Energy Protocol Stack:Physical Layer RF Specifications Operates in 2.4 GHz ISM band GFSK modulation 40 channels with 2 MHz spacing 3 fixed advertisting channels for broadcasting,which avoid 802.11 interferance 37 adaptively frequency hopped dynamic data channels Physical layer can be combined with standard Bluetooth RF in a dual-mode device 2 MHz spacing allows for better adjacent channel rejectionTI confidential information-Strictly PrivateBLE Link Layer:Channels3 Advertising Channels and 37 Data ChannelsBLE Link Layer:States and Network TopologyThere are six possible Link Layer states of a BLE device:Standby-device is not transmitting or receiving any data,and is not connected to any other deviceAdvertiser-periodically broadcasting advertisementsScanner-actively looking for advertisersInitiator-actively trying to initiate a connection with another deviceMaster-connected to another device as a masterSlave-connected to another device as a slaveBLE is a star topology network:Master device“manages”the connection,and can be connected to multiple slavesSlave device can only be connected to one masterTI confidential information-Strictly PrivateBLE Link Layer:States Flow ChartTI confidential information-Strictly PrivateAdvertiserSlaveScannerInitiatorMasterStandbyStandbyBLE Link Layer:Advertisement EventsTI confidential information-Strictly PrivateA device in the advertising state transmits advertising packets Advertising packets can contain a data payload Advertising packets can be directed towards a specific scanner device,or undirected Advertisements can be connectable or non-connectable(and therefore just used for broadcast of data)During one“advertising event”,an advertisement packet is transmitted on each of the three advertising channels(37,38,and 39)Advertising packetAdvertising packetAdvertising packetEvent startedEvent closedAdv_idx=37Adv_idx=38Adv_idx=39BLE Link Layer:Advertisement IntervalsTI confidential information-Strictly PrivateThe advertising device has an“advertising interval”,which is the minimum amount of time between two advertising eventsAdvertising Interval can be any amount of time between 20ms and 10.24sThe Link Layer generates a pseudo-random amount of time between 0ms and 10ms(“advertising delay”)during each advertising event.This delay is added to the advertising interval before the next advertising event,in order to prevent“beating”from multiple devices Advertising packets can contain a data payload,and therefore broadcast data without a connection Four types of advertisements:Connectable undirected-any scanner device can initiate a connection with this advertiser Connectable directed-only one specific device can initiate a connection with this advertiser Non-connectable undirected-no devices can initiate a connection with this advertiser;primarily used for general broadcast of data Discoverable undirected-any scanner device can request more information from the advertising device,but no devices can initiate a connection with itBLE Link Layer:Advertisement TypesTI confidential information-Strictly PrivatePassive Scanning Scanner listens on advertising channels for advertising packets When an advertisement packet is received,it passes the information up to the hostActive Scanning Scanner listens on advertising channels for advertising packets When an advertisement packet is received,it responds with a“scan request”packet Advertiser then responds back with a“scan response”packet(this packet can contain additional data from advertiser)BLE Link Layer:ScanningTI confidential information-Strictly PrivateActive Scanning Packet FlowDemonstration:Advertising and Scanning After a scanner device has scanned a connectable advertisement message,it can become an“initiator”by sending a“connection request”packet to the advertiser Connection request contains a set of link layer parameters for the slave device,which dictate the channels and timing requirements for the connection If the advertiser accepts the connection,both devices enter a connected state,with the initiator becoming the“master”and the advertiser becoming the“slave”BLE Link Layer:Connection InitiationTI confidential information-Strictly PrivateConnection Request Packet FlowBLE Link Layer:Connection Parameters Channel Map-indicates which data channels are used during the connection Hop Increment-random value between 5 and 16 for channel selection algorithm Connection Interval-multiple of 1.25ms in range of 7.5ms and 4.0s Supervision Timeout-multiple of 10ms in the range of 100ms and 32.0s.Must be larger than:(1+slaveLatency)*(ConnInterval)Slave Latency-any value between 0 and 499,though it cannot exceed:(supervisionTimeout/connInterval)1)TI confidential information-Strictly PrivateBLE Link Layer:Connection EventsAll communications between two connected devices occur in“connection events”Connection events occurs periodically,with the connection interval parameter specifying the periodEach event occurs on one data channel(channels 0-36),with the hop increment parameter determining the next channel for the next eventDuring each connection event,the master transmits first,and the slave responds 150us laterMaster and slave can continue transmitting back and forth as many times as they want during a single connection eventConnection events occur even when one(or both)sides have no data to send(the exception to this is when slave latency is enabled;more information on next slide).This allows both devices to acknowledge that the other is still there and keeps the connection active.TI confidential information-Strictly PrivateConnection eventConnection eventtimeConnection intervalConnection intervalConnection eventConnection IntervalTI confidential information-Strictly PrivateDemonstration:ConnectionBLE Link Layer:Slave LatencySlave latency allows for a slave device to skip connection events if it does not have any data to sendThe slave latency connection parameter specifies the maximum number of connection events that the slave can skipIf slave doesnt respond to masters packet during a connection event,master will resend the packet in subsequent connection events until the slave respondsThe typical amount of time between two connection events(assuming that the slave skips the maximum number events)is often referred to as the“effective connection interval”Example:if connection interval is 100ms and slave latency is set to 4,then the effective connection interval would be 500ms,since slave typically skips four connection events at 100ms intervalsThe slave latency can be any value between 0 and 499,though the effective connection interval must be less than 32.0sTI confidential information-Strictly PrivateBLE Link Layer:Slave Latency24MSMSMSNo slave latency slave responds with empty packets every connation interval.MSSlave latency on.Slave can skip n connection events.Only wake up if slave has data to send.EventData to SendEventData to SendMSMSMMMSMSlave Latency=OFF Slave Latency=ON Demonstration:Slave LatencyBLE Link Layer:Connection Parameters TradeoffsShort connection interval:Higher power consumption for both devicesHigher throughput in both directionsShorter wait for data to be sent in either directionLong connection interval:Lower power consumption for both devicesLower throughput in both directionsLonger wait for data to be sent in either directionLow/Zero slave latency:Higher power consumption for peripheralPeripheral receives data sent from central device soonerHigh slave latency:Lower power consumption for peripheral during periods when it has no data to send to central devicePeripheral may not immediately receive data being sent from central deviceTI confidential information-Strictly PrivateBLE Link Layer:Connection Update Request If the slave does not like the connection parameters(interval,slave latency,or supervision timeout),it can send a connection update request to the master Connection update request allows slave device to request a desired connection interval range(minimum and maximum),as well as desired slave latency and supervision timeout Slave device can send a connection update request at any time,allowing for slave applications to dynamically adjust the connection parameters based on applicationTI confidential information-Strictly PrivateBLE Link Layer:Connection Termination A connection can be voluntarily terminated by either the master or the slave for any reason One side initiates termination,and the other side must respond accordingly before both devices exit the connected state Connection can also be terminated as a result of a supervision timeout The supervision timeout parameter specifies the maximum amount of time that either the master or slave can go before receiving a link-layer packet Supervision timeout value must be greater than the effective connection interval and less than 32.0 seconds Both slave and master device maintain their own“Supervision timer”,which resets to zero every time a packet is received If supervision timer ever reaches the supervision timeout,the device considers the connection lost,and exits the connection state(returning to the advertising,scanning,or standby state)TI confidential information-Strictly PrivateBLE Link Layer:Direct Test Mode Allows a tester to directly control the device under test(DUT)in either Rx or Tx mode on any channel with any amount of data Used by Bluetooth low energy testers such as the Anritsu MT8852B for RF performance testing TI working directly with Anritsu to provide a simple means for test during manufacturingTI confidential information-Strictly PrivateBluetooth Low Energy Protocol Stack:Host/Controller Interface(HCI)OverviewReused from standard Bluetooth specification,with new additional commands for low energy-specific functionsThin layer;doesnt perform any processingIn a dual-chip solution(with separate host and controller)allows for host to communicate with controller over a standard interface(UART,USB,SDIO,etc.)Used internally by the CC2540 BLE protocol stack for communication between higher and lower layersAlso allows for custom“vendor-specific commands”.In the CC2540,vendor-specific commands can be used by an external source to directly interface with the entire stack or application.This is called a“Network Processor”TI confidential information-Strictly PrivateBluetooth Low Energy Protocol Stack:Host Overview The host uses the HCI API to communicate with the lower layers The different layers of the host stack manage control messages,event messages,and transmission of dataTI confidential information-Strictly PrivateBluetooth Low Energy Protocol Stack:Host Message and Data Flow ChartTI confidential information-Strictly PrivateL2CAP HCI APIEventsATTGAPApplication/ProfileOutgoingDataIncomingDataCommandsFixedChannelMsgsFixed ChannelResponsesState ChangeControlEventsEventsCharacteristic SetupAttrib SetupEventsSMPControlEventsFixedChannelMsgsFixed ChanResponsesCommandsEventsGATTAttribSetupEventsBluetooth Low Energy Protocol Stack:Logical Link Control and Adaptation Protocol(L2CAP)Permits upper level protocols and applications to transmit and receive upper layer data packets up to 23 bytes in length Provides channel management,allowing for logical channels between two endpoints,supported by the link l

此文档下载收益归作者所有

下载文档
你可能关注的文档
收起
展开