Sie sind auf Seite 1von 9

Application Note: JN-AN-1151 Low-Cost JenNet IP Gateway

This Application Note describes the design and implementation of a low-cost Gateway between an IEEE 802.15.4 wireless network and the Internet. This Gateway utilises the Jennic JN5148 wireless microcontroller, the Jenie/JenNet wireless protocol stack and an open source TCP/IP stack. In this demonstration, the Gateway device is used to serve web pages containing data collected from a wireless network of sensors.

Application Overview
It is often necessary to connect a wireless sensor network to the Internet. The powerful 32-bit RISC CPU within the Jennic JN5148 wireless microcontroller allows the construction of a very low-cost Gateway device that provides a bridge between wired and wireless networks.

Wireless Sensor Network Sensor Node Sensor Node

Gateway

Ethernet ISP Connection

Internet

PC-based monitoring and control application

JN-AN-1151 (v1.0) 26-May-2010

Jennic 2010

Jennic

Low-Cost JenNet IP Gateway

The Gateway device acts as a bridge between the wireless sensor network and an IP-based Ethernet network, and consists of the following: A JN5148 device that runs the Jenie/JenNet wireless protocol stack and an open source TCP/IP stack An Ethernet MAC/PHY device that is connected to the JN5148 device via the SPI interface In addition to the above, the JN5148 device within the Gateway acts as a web server. In response to requests from a client, it serves out web pages containing data collected from a network of wireless sensor nodes. The supplied application code is compatible with Jennics IEEE 802.15.4 wireless Gateway, which is provided as a reference design, JN-RD-6026. This reference design includes schematics, bill-of-materials, gerbers, PADS, PCB database and reference documentation. The Gateway device hardware is detailed in the IEEE 802.15.4 Wireless Gateway Reference Manual (JN-RM-2059), included in the reference design.

Software
The TCP/IP stack (often referred to as the uIP stack) used with the Gateway is an open source stack. More details of this stack can be found at: http://www.sics.se/~adam/uip/index.php/Main_Page A copy of this stack, ported to run on the JN5148 device, is provided with this Application Note and can be found within the ZIP package at the following location: \JN-AN-1151-Low-Cost-JenNet-IP-Gateway\Gateway\Source\uip-1v0 This application is designed to operate with the Gateway unit (Reference Design JN-RD-6026) and a number of sensor boards from the Jennic JN5148-EK010 Evaluation Kit, with the sensor boards programmed to be End Devices. These boards then take temperature measurements and pass them via a Jenie/JenNet network to the network Co-ordinator. The Co-ordinator is implemented on the Gateway board, with the role of collecting data from the sensor boards and then serving out this information as web pages. The source code and associated project files for this application can be found in the ZIP package at the following locations: \JN-AN-1151-Low-Cost-JenNet-IP-Gateway\Gateway \JN-AN-1151-Low-Cost-JenNet-IP-Gateway\Sensor An example of a web page served by the Gateway device is shown below:

Jennic 2010

JN-AN-1151 (v1.0) 26-May-2010

Low-Cost JenNet IP Gateway

Jennic

Note: The default IP address that is coded into the Gateway software is http://192.168.1.99. In order to view these web pages, you must enter this IP address into your web browser. The above screen shows links for the 1st and 2nd floors. Clicking on one of these links will result in information being displayed from the sensors on the corresponding floor. Each sensor can be configured with the floor set in the range 0-9 but, currently, only the 1st and 2nd floors are displayed in the demonstration interface. When a sensor board is powered on, the on-board LED D1 will illuminate until the sensor has joined a network. The on-board LED D2 will then flash every time data is transmitted to the Gateway. The frequency of the transmissions is also configurable.

JN-AN-1151 (v1.0) 26-May-2010

Jennic 2010

Jennic
Configuring Gateway IP Settings

Low-Cost JenNet IP Gateway

The default settings of the Gateway can be changed via a terminal emulator running on a PC which is connected to the Gateway using a USB-A to USB mini-B cable. The terminal emulator used in this example is HyperTerminal, which requires the following port settings: Baud Rate: Data Bits: Parity: Stop Bits: 115200 8 None 1

Flow Control: None Once the terminal window is open and the settings are correct, enter S on the keyboard and the following information will be displayed in the terminal window:

It is now possible to configure the displayed Gateway settings (above). To configure a setting, enter the number of the required option and then enter the new value. Note that IP addresses must be entered in the format aaa.bbb.ccc.ddd for example, to re-enter the local IP address shown above, the following format must be used: 192.168.001.099 Once all the changes are complete, you must save the new settings by entering S and then exit the configuration screen by entering 6. Next, reset the Gateway by power-cycling the board.

Jennic 2010

JN-AN-1151 (v1.0) 26-May-2010

Low-Cost JenNet IP Gateway

Jennic

Configuring Sensor Settings


The default settings of a sensor can also be changed via a terminal emulator running on a PC which is connected to the sensor board using a USB-to-serial cable. Again, the terminal emulator used in this example is HyperTerminal, which requires the following port settings: Baud Rate: Data Bits: Parity: Stop Bits: 115200 8 None 1

Flow Control: None Once the terminal window is open and the settings are correct, hold down the on-board button SW1 and power on the sensor board. The following information will be displayed in the terminal window:

It is now possible to configure the sensor settings (above). To configure a setting, enter the number of the required option and then enter the new value. Once all the changes are complete, you must save the new settings by entering S and then exit the configuration screen by entering 4. Next, reset the sensor by power-cycling the board.

JN-AN-1151 (v1.0) 26-May-2010

Jennic 2010

Jennic
Building Web Pages

Low-Cost JenNet IP Gateway

The pages served by the Gateway device are created using standard HTML code. The pages for this demonstration can be found at the following location: \JN-AN-1151-Low-Cost-JenNet-IP-Gateway\Gateway\Source\webpages Once the HTML is complete, the web pages must be converted into data (a number of C arrays) that can be used by the web server application. A Perl script is provided to perform this conversion. To execute this script, navigate to \JN-AN-1151-Low-Cost-JenNet-IP-Gateway\Gateway\Source and enter perl makefsdata at the command prompt.

Note: Perl is not installed by any of the Jennic SDKs. Strawberry Perl is an open-source Perl implementation for Microsoft Windows, which was used to test the makefsdata script provided.

Compatibility
The software provided with this Application Note has been tested with the following Jennic kits and SDK (Software Developers Kit) versions:
Product Type Evaluation Kit SDK Libraries SDK Toolchain Part Number JN5148-EK010 JN-SW-4040 JN-SW-4041 Version v1.4 v1.1 Supported Chips JN5148 JN5148 JN5148

Jennic 2010

JN-AN-1151 (v1.0) 26-May-2010

Low-Cost JenNet IP Gateway

Jennic

Building and Loading the Application


This section describes how to build the applications from the supplied source code and load the resulting binaries into the relevant JN5148 boards (note, however, that pre-built binaries are supplied which can be loaded directly into the boards). The software provided with this Application Note can be built only for the JN5148 wireless microcontroller, using either the Eclipse IDE or makefiles. The project directory in the ZIP file should be copied to the directory <JENNIC_SDK_ROOT>\Application where <JENNIC_SDK_ROOT> is the path into which the Jennic JN5148 SDK was installed (by default, this is C:\Jennic). The Application directory is automatically created when you install the JN5148 SDK. Build the applications as described in the appropriate section below, depending on whether you intend to use Eclipse or makefiles.

Using Eclipse (JN5148 Only)


To build the application and load it into JN5148 boards, follow the instructions below: 1. Ensure that the project directory is located in <JENNIC_SDK_ROOT>\Application where <JENNIC_SDK_ROOT> is the path into which the SDK was installed. 2. Start the Eclipse platform and import the relevant project files (.project and .cproject) as follows: a) b) c) d) 3. In Eclipse, follow the menu path File>Import to display the Import dialogue box. In the dialogue box, expand General, select Existing Projects into Workspace and click Next. Enable Select root directory, browse to the Jennic Application directory and click OK. In the Projects box, select the project to be imported and click Finish.

Build the application. To do this, ensure that the project is highlighted in the left panel of in the Eclipse Eclipse and use the drop-down list associated with the hammer icon toolbar to select the relevant build configuration once selected, the application will automatically build. Repeat this to build the other application. The binary files will be created in the relevant Build directories for the applications, the resulting filenames indicating both the chip type (JN5148) and networking stack (JN for JenNet) for which they were built.

4.

Load the resulting binary files into the boards. You can do this using the Jennic JN51xx Flash Programmer, which can be launched from within Eclipse or used directly (and is described in the JN51xx Flash Programmer User Guide (JN-UG-3007)). For the Gateway device, also refer to the Programming chapter of the IEEE 802.15.4 Wireless Gateway Reference Manual (JN-RM-2059).
Jennic 2010 7

JN-AN-1151 (v1.0) 26-May-2010

Jennic
Using Makefiles

Low-Cost JenNet IP Gateway

Each application has its own Build directory, which contains the makefiles for the application. The makefile is simply called Makefile. To build each application and load it into the relevant JN5148 board, follow the instructions below: 1. Ensure that the project directory is located in <JENNIC_SDK_ROOT>\Application where <JENNIC_SDK_ROOT> is the path into which the SDK was installed. 2. Navigate to the Build directory for the application to be built and at the command prompt, enter:
make clean all

Note that you can alternatively enter the above command from the top level of the project directory, which will build the binaries for both applications. The binary file will be created in the relevant Build directory, the resulting filename indicating the chip type (JN5148) and networking stack (JN for JenNet) for which the application was built. 3. Load the resulting binary file into the board. To do this, use the Jennic JN51xx Flash Programmer, described in the JN51xx Flash Programmer User Guide (JN-UG-3007). For the Gateway device, also refer to the Programming chapter of the IEEE 802.15.4 Wireless Gateway Reference Manual (JN-RM-2059).

Jennic 2010

JN-AN-1151 (v1.0) 26-May-2010

Low-Cost JenNet IP Gateway

Jennic

Revision History
Version 1.0 Notes First release

Important Notice
Jennic reserves the right to make corrections, modifications, enhancements, improvements and other changes to its products and services at any time, and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders, and should verify that such information is current and complete. All products are sold subject to Jennics terms and conditions of sale, supplied at the time of order acknowledgment. Information relating to device applications, and the like, is intended as suggestion only and may be superseded by updates. It is the customers responsibility to ensure that their application meets their own specifications. Jennic makes no representation and gives no warranty relating to advice, support or customer product design. Jennic assumes no responsibility or liability for the use of any of its products, conveys no license or title under any patent, copyright or mask work rights to these products, and makes no representations or warranties that these products are free from patent, copyright or mask work infringement, unless otherwise specified. Jennic products are not intended for use in life support systems/appliances or any systems where product malfunction can reasonably be expected to result in personal injury, death, severe property damage or environmental damage. Jennic customers using or selling Jennic products for use in such applications do so at their own risk and agree to fully indemnify Jennic for any damages resulting from such use. All trademarks are the property of their respective owners.

Jennic Ltd Furnival Street Sheffield S1 4QT United Kingdom Tel: +44 (0)114 281 2655 Fax: +44 (0)114 281 2951 E-mail: info@jennic.com For the contact details of your local Jennic office or distributor, refer to the Jennic web site:

JN-AN-1151 (v1.0) 26-May-2010

Jennic 2010

Das könnte Ihnen auch gefallen