Microchip Wireless Miwi Application Programming Interface
Total Page:16
File Type:pdf, Size:1020Kb
AN1284 Microchip Wireless MiWi™ Application Programming Interface – MiApp Authors: Yifeng Yang The MiApp specification defines the programming Pradeep Shamanna interfaces between the application layer and Microchip Derrick Lattibeaudiere proprietary wireless communication protocols. The Vivek Anchalia MiApp programming interface is implemented in two Microchip Technology Inc. ways: as configuration parameters defined in the con- figuration file, and as a set of function calls to the Micro- chip proprietary wireless communication protocols. INTRODUCTION Complying with the MiApp specification defined in this Developing wireless applications can be challenging. application note, applications can use any Microchip Apart from Radio Frequency (RF) circuit designs, the proprietary wireless protocols. With little or no modifica- firmware development process may require the devel- tion in the application layer, software development can opers to understand the details of RF transceivers, as be easily changed between a proprietary P2P/Star well as the different wireless communication protocols. topology connection protocol to a full Mesh proprietary Microchip has developed a way to handle the complex networking protocol for small or big networks, depend- RF hardware or communication protocol stack software ing on the application needs. development, or both, which enables wireless applica- tion developers to focus on their own application devel- opment. This type of wireless communication is achieved through a concise, yet powerful communica- tion programming interface in the application layer called MiApp which is defined in this application note. FIGURE 1: BLOCK DIAGRAM OF MICROCHIP WIRELESS MiWi™ STACK Application User A ppl ic ati on Configuration MiApp MiWi™ P2P/Star MiWi™ Mesh Protocol Configuration Future Microchip Proprietary Wireless Protocols ... Interchangeable Wireless Communication Protocols MiMAC MRF24J40 Transceiver RF Transceiver MRF89XA Transceiver Configuration Future Microchip RF Transceivers ... Interchangeable RF Transceivers 2009-2017 Microchip Technology Inc. DS00001284B-page 1 AN1284 The MiApp specification benefits wireless application CONSIDERATIONS developers in multiple ways: The MiApp specification is designed to support Micro- • Wireless application development focuses on its chip proprietary wireless communication protocols. application. Complex RF or protocol consider- Once a wireless application is implemented by the ations are transparently handled by the MiApp MiApp programming interface, the Microchip RF trans- programming interface. ceivers are also supported through standardization in • The MiApp specification allows maximum flexibil- MiMAC, the module defined in the Media Access Con- ity to choose a wireless protocol at any stage of troller (MAC) layer. application software development with little effort, thus greatly lowering the risk of software develop- MiMAC standardizes the interface between Microchip ment. Application requirement changes in net- wireless protocols and Microchip RF transceivers. working capabilities have little or no impact in MiMAC makes Microchip RF transceivers interchange- application development. able with little or no change in the software application code. For more information on MiMAC, refer to the • MiApp uses the same control interface for Application Note “AN1283 Microchip Wireless MiWi™ Microchip wireless proprietary protocols. Once Media Access Controller - MiMAC” (DS00001283). you are familiar with MiApp, you can apply that knowledge to the development of another applica- MiMAC regulates the lower interface of the Microchip tion even if it has a completely different network- proprietary wireless protocols, while MiApp regulates ing capability requirement. the higher interface of the Microchip proprietary wire- • By communicating to the Microchip proprietary less protocols. Working together, both MiMAC and protocols, MiApp indirectly talks to the Microchip MiApp provide wireless application developers the RF transceivers through the MiMAC interface. As maximum flexibility to choose the RF transceivers and a result, MiApp indirectly enables the wireless wireless communication protocols at any stage of soft- application developers to switch between ware development, thus further minimizing the risk of Microchip RF transceivers through MiMAC. This software development.The block diagram in Figure 1 flexibility, in turn, further reduces the development shows the Microchip Wireless MiWi™ stack offerings. risk of the wireless application project. There are three layers of configurations for application, protocol stacks and RF transceivers. Application con- FEATURES figuration may change between devices in the same application according to their hardware design, role in The MiApp programming interface has the following the application and network. Wireless application features: developers tend to do the majority of the configuration in the application layer. Protocol configurations fine- • Easy to learn and use tune the behavior of the protocol stack. The majority of • Powerful interface to meet most requirements protocol stack configurations define the timing and from wireless applications routing mechanism for the chosen wireless protocol. • Little or no extra effort to migrate the wireless Transceiver configurations define the frequency band, application between Microchip proprietary data rate and other RF related features of the RF trans- wireless protocols ceiver. The default settings for the protocol and RF • Minimum footprint impact transceiver configurations may work with the applica- tion without any modification. The application configu- rations, however, usually need to be changed to fit the needs of different wireless applications. DS00001284B-page 2 2009-2017 Microchip Technology Inc. AN1284 MiApp OVERVIEW MiApp CONFIGURATION FILE As discussed earlier, there are two parts defined in the The hardware definitions depends on the choices of the MiApp specification: Demo/Development boards, the MCUs and the RF • Configuration parameters defined in the transceivers. The hardware definitions can be divided configuration file into the following subcategories: • Signatures of function calls to the Microchip • I/Os on the demo board – these includes the push proprietary wireless protocols buttons, LEDs, serial ports, and so on. The configuration file contains parameters that must be • MCU system resources – these includes the set before compilation. Generally, there are two types timers, interrupts, and so on. of parameters defined in the configuration file: • Interconnections between MCU and RF transceiver • Hardware Definitions – these includes MCU hardware resources, peripherals definition and Hardware definitions are mainly associated with hard- the definition for the RF transceiver control pins. ware selections of the wireless application system The default hardware definitions are defined in design. They depend more on the hardware than the several Microchip standard demo boards that software and vary across different designs. As a result, support Microchip RF transceivers. In these MiApp does not have a set of standards for those cases, the definition of demo boards automatically hardware definitions. introduces all hardware definitions. Selective compilation configurations select the features • Software Definitions – these definitions control among the list of available ones. Using the selective the code sections to be compiled into the firmware compilation, application developers are able to config- hex file. The software definitions include selec- ure Microchip proprietary wireless protocols to perform tions of Microchip proprietary wireless protocol, the desired functionality with the least possible system choice of Microchip RF transceiver, and individual resources. Table 1 describes the possible selective functionalities. Proper definitions in this category compilation configurations and its scope, value, and ensure the minimum firmware footprint with the functionality. intended protocol capabilities. Application Programming Interfaces (APIs) are the function calls between the Microchip proprietary wireless communication protocols with the wireless application. As a rule, the application interface must be clean, concise, easy to understand, and powerful. There are five categories of interfaces for the APIs: • The initialization interface allows wireless applica- tion developers to properly initialize the selected Microchip proprietary wireless protocol in the con- figuration file. • The handshaking interface allows the wireless nodes to discover and get connected with their peers, or to join the network. • Interfaces to send messages which enable appli- cation developers to transmit information from the current node to an intended audience over-the-air. • Interfaces to receive messages which enable application developers to receive information over- the-air from other devices. • Special functionalities which ensure the optimal operating condition for wireless nodes through environment noise control and power saving. 2009-2017 Microchip Technology Inc. DS00001284B-page 3 AN1284 TABLE 1: APPLICATION LAYOUT SOFTWARE DEFINITIONS IN A CONFIGURATION FILE Application Definitions Functionality Comments #define PROTOCOL_P2P Selects the Microchip proprietary Only one protocol can be defined at any #define PROTOCOL_STAR wireless protocol to be used in the one time. #define PROTOCOL_MESH wireless application. #define MRF24J40 Selects the Microchip RF trans-