Firmware > Wireless communications
Contents
Initialization: SimpliciTI Initialization | SimpliciTI Connections | Data Buffer Configuration | Reciever Callback Definition Transmission of Data | Reception of Data
Basic Overview
Communication between the wireless components was established using the SimpliciTI API in conjunction with the low-power radio-frequency protocol implemented on the eZ430-RF2500 development boards. Both end devices were set to statically connect with each other using the SimpliciTI “commission” functionality. As with the UART communication design, both bi-directionality and asynchronous communication was established through the use of circular buffers and the SimpliciTI communication functions. | Back to contents |
Initialization
The wireless chip initialization consisted of establishing the wireless connection and configuring the microprocessor on the eZ430-RF2500 board which, similar to the UART initialization, consisted of a few basic steps. | Back to contents |
SimpliciTI Initialization
Before any other steps were taken, the wireless board and drivers were initialized using SimpliciTI’s defined initialization functions (BSP_INIT). As defined by the SimpliciTI API documentation, the wireless board, radio, and SimpliciTI protocol stack need to be initialized before any other SimpliciTI function calls are used. Because we utilized multiple SimpliciTI function calls in this lab to not only send and receive wireless data frames but to also establish a static connection between the two devices, this function was called immediately after power initialization. | Back to contents |
SimpliciTI Connection
The next step consisted of establishing a static connection link between the wireless chips to allow for data transmission using the SMPL_Commission() function. Within the SimpliciTI API, multiple function calls are defined (e.g. Link(), LinkListen()) that can be used to establish a connection between two wireless components (using LinkIDs) and link them together. However, these functions create connections with other devices that are calling the exact same function, allowing for the possibility of accidental unwanted links with other non-related wireless devices (which ultimately makes the connection non-static). With the SMPL_Commission() call, a connection is established only between the sender and a device with a given pre-determined address; thus, by predetermining a unique address for both the wireless chips and hard-coding their addresses within the code, a static link (and respective LinkID) was able to be established. | Back to contents |
Data Buffer and Interrupt Configuration
After establishing the wireless link, the data buffers and interrupt routines used for data transfer were initialized and configured. Within our design, much of the data handling was handled in the interrupt routines which were perfect for immediate responses to data reception. Therefore, the UART RX interrupt routine was activated and defined alongside the wireless radio receive handler (defined later). However, due to the asynchronous nature of the data relay, two circular buffers were implemented and incorporated within the receive interrupts. While the circular buffers offer one solution to meet this requirement, it was chosen specifically for this lab for its implementation simplicity within a well-scheduled reading environment. With a circular buffer, the processor is able to receive multiple commands at once and execute them in order whenever the processor is ready. Ultimately, however, the data sent across the UART and the wireless route represent different types of information, making it essential for the modules to receive the correct data in a specific order. With just one buffer, the design becomes flawed as data is either written in the wrong order (when no locking mechanism is implemented) or is lost when the buffer blocks data writing (when a locking mechanism is in place). However, having separate buffers for UART and wireless data reception distinguishes the data received whenever the UART receives multiple bytes at once. | Back to contents |
Receiver Callback Definition
Finally, the last step involved the definition of the radio receiver handler function (or the callback function). In the SimpliciTI API, there is a method defined in the documentation called sRxCallback that is called whenever a radio signal is received from a wireless device it has established a connection with. Because this method was not used by default, the method had to be defined to store incoming data in the respective buffer and then initialized through the use of SMPL_Init() (which initializes any passed function) and SMPL_Ioctl() (which initializes and turns on the radio receiver). | Back to contents |
Transmission of Data
While the actual transmission of data across the wireless and the UART is different, the way they are initiated and prepared are done similarly. Data transfer across the UART is thorugh 1-byte or 2-byte packet series (see UART section for more details). The wireless module does the same thing; data sent across the air is done in series of 1-byte or 2-byte packets. Also, similar to the UART transfer, the wireless transmission doesn’t confirm if the other wireless chip successfully receives the packet. However, to initiate wireless transfer, the SimpliciTI call SMPL_Send() is called with the address of the data packet, the length of the packet, and the established wireless link (LinkID). | Back to contents |
Reception of Data
When data is received for both the UART and the wireless communication, both the UART and the wireless chips interrupt the process and transfers control to a specific handler. As defined for the UART, the RX interrupt is thrown but, for the wireless communication, the RxCallback function is thrown which acts like an interrupt routine (despite its definition as a function in the SimpliciTI API). For any possible reception, the routines receive and store in its respective buffer the respective number of bytes (specified by the SimpliciTI function) where it then gives control back to the main loop. Also, in correspondence to our protocol, a terminating character is added to the end of each byte to signal the end of the complete packet. Upon seeing data in the buffer, data is packaged and sent to the respective device (sends to wireless if it receives from UART, sends to UART if it receives from wireless). | Back to contents |