Hello again, Indy Module fans! Today, we're going to show how to write firmware for a TI MSP430 host microcontroller to use that device as an Impinj Radio Interface (IRI) host for the Indy Modules. The MSP430 will control the Indy module, performing tag inventories, and printing out read results and other information over an emulated USB HID keyboard to a host PC.
This post is the third and final in a series of three that will show systems using the Indy UHF RFID Modules along with an MSP430 host microcontroller. All three use the MSP430 USB LaunchPad evaluation kit, which showcases the MSP430F5529 microcontroller. This kit was chosen because it is low cost(only $12.99!), includes a programmer and debugger, is easy to use, and comes with a variety of useful USB firmware examples. Each post of the three will focus on a single MSP430 firmware configuration that interacts with the Indy modules in a unique way. We will post one each week here on the Impinj Support Portal.
Update - Check out the rest of the postings in the series here:
Bonus Post 1: Indy Module With MSP430 IRI-LT Host - Non-Blocking
Bonus Post 2: Indy Module With MSP430 IRI Host and USB-UART Printf
This week's example will showcase using a host microcontroller (the MSP430) to control the Indy module, by generating IRI-LT traffic over its UART. The microcontroller will also enumerate as a USB HID keyboard to an attached PC. The host microcontroller will perform inventories and track the EPCs of tags that are seen in each inventory. It will type an EPC string over the USB connection every time a new tag appears in its view, and also whenever a tag disappears from view.
The physical arrangement of the example is shown in the block diagram in Figure 1.
Figure 1: Example Simple Block Diagram
Example Hardware Setup
In order to exercise our example, we will have to connect the various parts such that they can communicate with each other. A block diagram of the connections is shown in Figure 2. A picture of the example hardware is shown in Figure 3. The connections are listed below.
Note: These are the same connections as those used in the two previous MSP430 examples: Indy SiP With MSP430 USB-UART Bridge and Indy SiP With MSP430 IRI-LT Host and USB-UART Printf.
- The MSP430 launchpad should be connected to the PC via USB.
- The Indy module development board should be powered
- The RS500 development board is powered by a USB connection
- The RS2000 development board is powered by a 12V DC adapter
- The Mini-Guardrail antenna (or other UHF RFID antenna) should be connected to the Module
- SMA connector J2 on the RS500 dev kit
- SMA connector J201 on the RS2000 dev kit
- The MSP430's UART pins must be connected to the Indy Module.
- The MSP430 UART pins are connected to J1, on pins P3.3 (MSP430 TX) and P3.4 (MSP430 RX), which are labeled in silkscreen on the kit.
- The RS500 development board allows connection to the UART using J14 and J16.
- MSP430 J1 P3.3 should connect to the center pin of J16 (Module RX)
- MSP430 J1 P3.4 should connect to the center pin of J14 (Module TX)
- The RS2000 development board allows connection to the UART using JP209 and JP210.
- MSP430 J1 P3.3 should connect to the center pin of JP210 (Module RX)
- MSP430 J1 P3.4 should connect to the center pin of JP209 (Module TX)
- These connections can be easily made using 100 mil pitch jumper wires, or mini-grabber wires.
- The jumpers for the Indy module development board headers should be set aside for this example.
Figure 2: Example Block Diagram
Figure 3: Example Hardware
Example Firmware and Software Setup
To configure the MSP430 on the USB Launchpad board, simply debug the attached project (MSP430 Indy SiP IRI-LT Host with USB HID Keyboard.zip below) or program the device with the firmware image attached to the page(MSP430 Indy SiP IRI-LT Host with USB HID Keyboard.txt below). This image can be programmed using the standalone MSP430Flasher utility. This utility is included with the MSP-EXP430F5529LP software package in the "Binary" directory. It can be used to program the attached firmware image using the following command-line input:
MSP430Flasher.exe -n MSP430F5529 -w "MSP430 Indy SiP IRI-LT Host with USB HID Keyboard.txt" -v -z [VCC] -m SBW2 (-i USB) (-e ERASE_ALL)
Unlike the two previous examples, which required a driver to control USB communication between the PC and the MSP430, this example enumerates as a generic USB HID Keyboard, and requires no drivers. The device will appear as a generic "USB Input Device".
Once the MSP430 is plugged into the PC, it will enumerate, and wait for user input to start performing inventories. The button S1 (on P2.1) must be pressed to allow inventories to begin. This allows the user to reset the MSP430 (using the reset switch S3) to stop keyboard activity. Before starting reads, you should set focus on the host PC to an application that can capture keyboard input, such as Notepad, so that typed text does not interfere with other tasks, and is not lost.
After the button is pressed, a startup message will be typed ("Indy Module Keyboard Initialized"), and then EPC events will be typed. 96-bit EPCs will be typed in the formats "+ XXXX-XXXX-XXXX-XXXX-XXXX-XXXX" and "- XXXX-XXXX-XXXX-XXXX-XXXX-XXXX", depending on whether an EPC has appeared or disappeared. An example of the output of the keyboard is shown in Figure 4.
MSP430 Firmware Details
In this section we'll go into detail about the firmware loaded on the MSP430. IRI-LT will be covered only lightly, as it was discussed in detail in the previous example: Indy SiP With MSP430 IRI-LT Host and USB-UART Printf.
This firmware was created by combining the previous example in the series, Indy SiP With MSP430 IRI-LT Host and USB-UART Printf, with the USB keyboard example "H8_Keyboard" from the TI MSP430 USB Developers Package. The USB-UART functionality was removed, and the IRI-LT port was combined with the USB HID keyboard functionality.
To communicate tag reads and debug information over the USB HID keyboard connection to the host PC, the firmware uses the USBTypeString() function, which was constructed from the source provided by the TI USB keyboard example. This function is called by a number of functions written to communicate different events, including startup, EPC events, and also error conditions.
EPC tracking is performed using the epc.c/h library, which was written specifically for this example. This library allows maintenance of arrays of EPCs, including functions to compare and copy individual EPCs and also EPC arrays.
The arrays of EPCs are constructed using APIs inside the ipj_util_tag_operation_report_handler() function in the ipj_utils.c source file. The _report_handler() function is called during the ipj_util_perform_inventory() function call, when a complete report is received from the Indy module. Once an inventory round has completed, the current array of EPCs is compared to the array from the previous inventory round, and changes in the tag population are typed over the USB HID keyboard interface.
Thanks for reading!
We at Impinj hope you have enjoyed reading this three part series as much as we have enjoyed writing it.