Microchip Miwi P2P Wireless Protocol
Total Page:16
File Type:pdf, Size:1020Kb
AN1204 Microchip MiWi™ P2P Wireless Protocol This application note assumes that readers know C Author: Yifeng Yang programming. However, it also recommends that Microchip Technology Inc. readers review the IEEE 802.15.4 specification and Microchip MiMAC/MiApp interfaces before starting this application note or working with the MiWi P2P wireless INTRODUCTION protocol. The demand is growing for more and more applications to move to wireless communication. Protocol Overview The benefits are reduced costs and ease The MiWi P2P protocol modifies the IEEE 802.15.4 implementation. Wireless communication does not specification’s Media Access Control (MAC) layer by require cabling and other hardware, and the associated adding commands that simplify the handshaking installation costs. It also can be implemented in locations process. It simplifies link disconnection and channel where installing cable is difficult. hopping by providing supplementary MAC commands. Since the IEEE released the Wireless Personal Area However, application-specific decisions, such as when Network (WPAN) specification (IEEE 802.15.4™) in to perform an energy detect scan or when to jump 2003, it has become the real industry standard for low- channels, are not defined in the protocol. These issues rate WPANs (LR-WPAN). The specification applies to are left to the application developer. low data rate applications with low-power and low-cost requirements. Protocol Features Microchip MiWi™ P2P Wireless Protocol is one of the wireless protocols that are supported in MiWi The MiWi P2P Wireless Protocol has the following Development Environment (DE). It is a variation of features: IEEE 802.15.4, using Microchip’s IEEE 802.15.4 • Operates on Microchip PIC18, PIC24, dsPIC33 compliant and other proprietary RF transceivers, which and PIC32 platforms are controlled by Microchip 8, 16 or 32-bit • Supports Microchip C18, C30 and C32 compilers microcontroller with a Serial Peripheral Interface (SPI). • Functions as a state machine Microchip MiWi P2P protocol stack is now expanded (not RTOS-dependent) beyond IEEE 802.15.4 specification to support • Supports a sleeping device at the end of the Microchip proprietary transceivers (MRF49XA, communication MRF89XA and future proprietary transceivers from Microchip), while using IEEE 802.15.4 Media Access • Enables Energy Detect (ED) scanning to operate Control (MAC) layer design as the reference. on the least-noisy channel • Provides active scan for detecting existing The protocol provides reliable direct wireless connections communication through an user friendly programming interface. It has a rich feature set that can be compiled • Enables frequency agility (channel hopping) in and out of the stack to meet a wide range of customer needs, while minimizing the stack footprint. This application note describes the MiWi P2P Protocol and its differences from IEEE 802.15.4. The document details the supported features and how to implement them. For more information, please refer to the Microchip application note AN1283 “Microchip Wireless Media Access Controller - MiMAC’’ (DS01283) and AN1284 ‘’Microchip Wireless Application Programming Interface - MiApp’’ (DS01284). © 2010 Microchip Technology Inc. DS01204B-page 1 AN1204 Protocol Considerations The MiWi P2P protocol is a variation of IEEE 802.15.4 and supports both peer-to-peer and star topologies. It has no routing mechanism, so the wireless communication coverage is defined by the radio range. Guaranteed Time Slot (GTS) and beacon networks are not supported, hence both the sides of the communication cannot go to Sleep Mode simultaneously. If the application requires wireless routing instead of P2P communication; or interoperability with other vendors’ devices; or a standard-based solution, for marketability, refer to the AN1066 “MiWi™ Wireless Networking Protocol Stack” (DS1066), AN1232 “Microchip ZigBee- 2006 Residential Stack Protocol” (DS01232A) and AN1255 “Microchip ZigBee PRO Feature Set Protocol Stack” (DS01255A). DS01204B-page 2 © 2010 Microchip Technology Inc. AN1204 IEEE 802.15.4™ SPECIFICATION AND reference and expand the support from IEEE 802.15.4 MiWi™ P2P WIRELESS PROTOCOL compliant transceiver to Microchip proprietary transceivers. After the initial 2003 release of the IEEE specification, a 2006 revision was published to clarify few issues. Device Types Referred to as IEEE 802.15.4b or 802.15.4-2006, the revision added two PHY layer definitions in the The MiWi P2P protocol categorizes devices based on sub-GHz spectrum and modified the security module. their IEEE definitions and their role in making the communication connections as shown in Table 1 and Most of the products in the market, however, use the Table 2. original IEEE 802.15.4a specification, also known as IEEE 802.15.4-2003 or Revision A. The MiWi P2P protocol supports all of these device types. In this document, references to IEEE 802.15.4 means Revision A of the specification. MiWi™ P2P protocol takes IEEE 802.15.4 specification as the design TABLE 1: IEEE 802.15.4™ DEVICE TYPES – BASED ON FUNCTIONALITY Receiver Idle Functional Type Power Source Data Reception Method Configuration Full Function Device (FFD) Mains On Direct Reduced Function Device (RFD) Battery Off Poll from the associated device TABLE 2: IEEE 802.15.4™ DEVICE TYPES – BASED ON ROLE Role Type Functional Type Role Description Personal Area FFD The device starts first and waits for a connection. Network (PAN) Coordinator End Device FFD or RFD The device starts after the PAN coordinator has started to establish a connection. © 2010 Microchip Technology Inc. DS01204B-page 3 AN1204 Supported Topologies As to functionality type, the star topology’s PAN coordinator is a Full Function Device (FFD). An end IEEE 802.15.4 and the MiWi P2P protocol support two device can be an FFD with its radios on all the time, or topologies: star and peer-to-peer. a Reduced Function Device (RFD) with its radio off when it is Idle. Regardless of its functional type, end STAR TOPOLOGY devices can only communicate to the PAN coordinator. A typical star topology is shown in Figure 1. From a device role perspective, the topology has one Personal Area Network (PAN) coordinator that initiates communications and accepts connections from other devices. It has several end devices that join the communication. End devices can establish connections only with the PAN coordinator. FIGURE 1: STAR TOPOLOGY Legend PAN Coordinator FFD End Device RFD End Device PEER-TO-PEER (P2P) TOPOLOGY As to functional types, the PAN coordinator is an FFD and the end devices can be FFDs or RFDs. In this A typical P2P topology is shown in Figure 2. From a topology, however, end devices that are FFDs can device role perspective, this topology also has one have multiple connections. Each of the end device PAN coordinator that starts communication from the RFDs, however, can connect to only one FFD and end devices. When joining the network, however, end cannot connect to another RFD. devices do not have to establish their connection with the PAN coordinator. FIGURE 2: PEER-TO-PEER TOPOLOGY Legend PAN Coordinator FFD End Device RFD End Device DS01204B-page 4 © 2010 Microchip Technology Inc. AN1204 Network Types Network Addressing The IEEE 802.15.4 specification has two types of The IEEE 802.15.4 specification defines two kinds of networks: beacon and non-beacon. addressing mechanisms: In a beacon network, devices can transmit data only • Extended Organizationally Unique Identifier (EUI) during their assigned time slot. The PAN coordinator or long address: An eight-byte address that is assigns the time slots periodically by sending a unique for each device, worldwide. superframe (beacon frame). All devices are supposed The upper three bytes are purchased from IEEE to synchronize with the beacon frame and transmit data by the company that releases the product. The only during their assigned time slot. lower five bytes are assigned by the device In a non-beacon network, any device can transmit data manufacturer as long as each device’s EUI is at any time when the energy level (noise) is below the unique. predefined level. • Short Address: A two-byte address that is Beacon networks reduce all devices’ power assigned to the device by its parent when it joins consumption because all of the devices turn off their the network. radios periodically. The short address must be unique within the network. Non-beacon networks increase the power consumption by FFD devices because they must have their radios on The MiWi P2P protocol supports only one-hop all the time. These networks reduce the power communication, hence it transmits messages through consumption of RFD devices, however, because the EUI or long address. Short addressing is used only RFDs do not have to perform the frequent when the stack transmits a broadcast message. This is synchronizations. because there is no predefined broadcast long address defined in the IEEE 802.15.4 specification. The MiWi P2P protocol supports only non-beacon networks. For Microchip proprietary transceivers, the unique address length can be between 2 to 8 bytes, depending on the application needs. © 2010 Microchip Technology Inc. DS01204B-page 5 AN1204 Message Format for IEEE 802.15.4 Compliant Transceiver The message format of the MiWi P2P protocol is a subset of the IEEE 802.15.4 specification’s message format. Figure 3 illustrates the stack’s packet format and its fields. FIGURE 3: MiWi™ P2P WIRELESS PROTOCOL PACKET FORMAT Bytes 2 1 2 2/8 0/2 8 Variable 2 Frame Frame Sequence Destination Destination Source PAN Source Pay Load Check Control Number PAN ID Address ID Address Sequence Addressing Fields FRAME CONTROL Figure 4 illustrates the format of the two-byte frame control field. FIGURE 4: FRAME CONTROL Bits311 1 13222 Destination Source Frame Security Frame Acknowledgement Intra PAN (Reserved) Address (Reserved) Address Type Enabled Pending Request Mode Mode The three-bit frame type field defines the type of The Destination Address mode can be either 16-bit packet.