Atmel AVR417: ZLL Gateway Getting Started

APPLICATION NOTE
Atmel AVR417: ZLL Gateway Getting Started Guide
32-bit Atmel Microcontrollers
Features
•
•
•
Atmel® BitCloud® ZigBee® Light Link (ZLL) support
lwIP TCP/IP stack support
Light control from web browser
Introduction
ZLL Gateway consists of two parts: Atmel SAM3X-EK and RCB128RFA1 hosted on a
Key Remote Board (ZLL Controller for short). SAM3X-EK acts as a bridge between
Ethernet and UART. SAM3X-EK receives light control commands from web browser
and then sends these commands to ZLL Controller through UART. ZLL Controller
controls the different lights following the commands from SAM3X-EK and gets the
different lights status through ZLL PAN.
This demo uses ZLL Gateway and two another RCB128RFA1 hosted on a Key
Remote Board (light with LCD for short) and a RCB128RFA1 board (light with LED
for short) to show the light control via web browser.
This document describes the hardware configuration and firmware download to help
users to set up ZLL Gateway demo and launch this demo step by step.
42057A−AVR−12/2012
Table of Contents
1. ZLL application scenarios .................................................................... 3 2. Board overview and configuration ........................................................ 4 3. Quick-start ............................................................................................ 7 3.1 Preprogrammed firmware ................................................................................. 7 3.1.1 Step-by-step guide .............................................................................. 7 3.2 Lights’ functions ................................................................................................ 8 4. Programming the kit ........................................................................... 10 4.1 Programming via the Atmel Studio 6.0 ............................................................ 10 4.1.1 Prerequisites ..................................................................................... 10 4.1.2 Programming with SAM3X-EK .......................................................... 10 4.1.3 Programming with RCB128RFA1 ..................................................... 11 4.1.3.2 Touch link with ZLL controller ......................................... 13 4.1.3.3 Fuse bits settings ............................................................ 13 4.2 Programming Atmel SAM3X-EK via Atmel SAM-BA ....................................... 14 4.2.1 Prerequisites ..................................................................................... 14 4.2.2 Step-by-step guide ............................................................................ 14 5. Revision History ................................................................................. 17 Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
2
1.
ZLL application scenarios
One of ZLL application scenarios is to connect a ZLL gateway to a router to enable control by consumers or managed
service providers.
Figure 1-1. ZLL remote access.
This demo demonstrates the ZLL remote access ability through the ZLL Gateway. Users can control different lights
using their web browser anywhere.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
3
2.
Board overview and configuration
Figure 2-1 shows the Atmel SAM3X-EK board, which is one part of ZLL Gateway. Ethernet connector is used to
connect PC and UART connector is used to connect the ZLL Controller.
Figure 2-1. SAM3X-EK board.
Figure 2-2 shows the Atmel RCB128RFA1 board, not hosted on a Key Remote Board. It acts as a light in this demo
(light with LED for short). There is a LED on the back of this board and its on/off state and brightness can be controlled
via web browser. To power on this board, shift the red button at the right side of the board.
Figure 2-2. RCB128RFA1 (light with LED).
Figure 2-3 shows RCB128RFA1 hosted on a Key Remote Board. There are three pieces of this board in this demo. One
of these boards is part of the Gateway (ZLL Controller for short). It is used to receive commands from the Atmel
SAM3X-EK and execute these commands through ZLL PAN. Two other of these boards act as lights (light with LCD for
short). Lights state can be projects to the LCD screen on the Key Remote Board. So we can easily see the light on/off
state and brightness value. To power on this board, shift the red button at the right side of the RCB board.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
4
Figure 2-3. Atmel RCB128RFA1 (ZLL Controller or light with LCD).
Figure 2-4 shows the ZLL Gateway. It consists of the Atmel SAM3X-EK and ZLL Controller. These two boards are
connected by a serial cable. This cable, one side connects to UART connector (J11) on SAM3X-EK and the other side
connects to the port marked EXT on Key Remote Board as shown on Figure 2-5.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
5
Figure 2-4. ZLL gateway (Atmel SAM3X-EK + ZLL Controller).
Figure 2-5. Serial cable attached to key remote board.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
6
3.
Quick-start
3.1
Preprogrammed firmware
The demo kits are preprogrammed with pre-built firmware. This firmware will show how to control lights via web
browser.
The Atmel SAM3X-EK runs the lwIP TCP/IP stack with static IP. The IP address is 192.168.0.2. The ZLL Controller,
light with LED and light with LCD run the BitCloud ZigBee Light Link software.
3.1.1
Step-by-step guide
To launch the demo, follow these steps:
1.
2.
3.
4.
5.
6.
Connect Ethernet cable between SAM3X-EK and PC.
Connect serial cable between SAM3X-EK and ZLL Controller.
Power on SAM3X-EK board.
Power on light with LED and light with LCD by shifting the red button at the right side of the board.
Power on the ZLL controller.
Configure your PC IP address to make sure the board and PC on the same network segment.
Figure 3-1. PC IP address configuration.
7.
8.
Launch your web browser and type the board’s IP address (192.168.0.2).
ZLL Gateway Demo webpage will be shown in the web browser and lights can be controlled through this
webpage.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
7
Figure 3-2. Lights control web page.
3.2
Lights’ functions
A light device indicates its light status via LEDs on the RCB board or via the LCD screen on the Key Remote Board
when RCB is attached to the Key Remote Board.
RCB board’s LEDs are turned on when light is on and turned off when light is off.
When the light’s bright level changes LEDs brightness also changes.
Figure 3-3. Light with LED status.
RCB with Key Remote Board projects its light status to the LCD screen on Key Remote Board as shown on Figure 3-4.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
8
Figure 3-4. Light with LCD status.
Three LEDs on the Atmel SAM3X-EK can also indicate the light control command from web browser. These LEDs only
have ON/OFF state. Their brightness can’t be changed.
Figure 3-5. Three LEDs on SAM3X-EK indicate light control command.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
9
4.
Programming the kit
There are four pre-built firmware images in this kit. They are for the Atmel SAM3X-EK, ZLL controller, light with LED
and light with LCD respectively.
4.1
Programming via the Atmel Studio 6.0
4.1.1
Prerequisites
To program the device, Studio 6.0 must be installed. Studio 6.0 install package can be got from Atmel official website.
Here is the download link:
http://www.atmel.com/tools/atmelstudio.aspx
Atmel SAM-ICE™ is needed to download pre-built image for SAM3X-EK.
One of programming tools, such as Atmel JTAGICE3, AVR® JTAGICE mkII, AVR ONE! and AVR Dragon™, is needed
to download pre-built image for ZLL Controller, light with LED and light with LCD.
4.1.2
Programming with SAM3X-EK
To program the SAM3X-EK, follow these steps:
1.
2.
3.
4.
5.
6.
7.
8.
Connect SAM-ICE to SAM3X-EK JTAG connector.
Power on SAM3X-EK.
Open Atmel Studio 6.0.
In Studio, open the Tools -> Device Programming dialog.
Choose SAM-ICE for Tool, ATSAM3X8H for Device and JTAG for Interface, then click Apply button.
Click Device signature and Target Voltage Read button to test if the JTAG ICE connect is ok or not.
Select the Memories tab and then select the pre-built hex image (SAM3X-LwIP.hex) in the Flash section.
Click Program.
The pre-built image is now downloaded to the board.
Figure 4-1. Programming with SAM3X-EK.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
10
Figure 4-2. SAM-ICE connected with SAM3X-EK.
4.1.3
Programming with RCB128RFA1
There are three pre-built firmware image for the Atmel RCB128RFA1. ZLLController.hex,
ZLLDemo_ATmega128RFA1_Light_LCD.hex and ZLLDemo_ATmega128RFA1_Light_LED.hex are for ZLL controller,
light with LCD and light with LED respectively.
To program the device, follow these steps:
1.
2.
3.
4.
5.
6.
7.
8.
Connect the programming tools (here the Atmel JTAGICE3 is used) to the connector marked with JTAG on
Key Remote Board.
Power on the RCB128RFA1 by shifting the red button at the right side of the board.
Open Atmel Studio 6.0.
In Studio, open the Tools -> Device Programming dialog.
Choose JTAGICE3 for Tool, ATmega128RFA1 for Device and JTAG for Interface, then click Apply button.
Click Device signature and Target Voltage Read button to test if the JTAG ICE connect is ok.
Click on Fuses tab and make sure that device fuses are set as specified in Table 4-1.
If fuses are set incorrectly, select the correct fuses setting, and then click Pragram.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
11
Figure 4-3. Device fuses setting.
Select the Memories tab and then select the pre-built hex image (ZLLController.hex in case for programming
ZLL controller) in the Flash section.
10. Click Program button.
9.
Figure 4-4. Programming with Atmel RCB128RFA1.
The pre-built image is now downloaded to the board.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
12
Figure 4-5. Atmel JTAGICE3 connect with key remote board.
In order to download firmware image to light with LED, this light board needs to be attached to a Key Remote Board.
Using the JTAG connector on Key Remote Board, firmware image can be downloaded to light with LED board.
Figure 4-6. Attached light with LED board to key remote board.
4.1.3.2 Touch link with ZLL controller
Touch link need to be done after all the firmware images be downloaded. Get one of the lights closely (10-20cm range)
to the ZLL controller and press PWR button on the ZLL controller board for more than three seconds. The ZLL controller
sends an identify command to the light, which will blink three times with its LED or LCD screen. The touch link
procedure may abort if the LED or LCD screen doesn’t blink three times while the PWR button is released. Get another
light closely to the ZLL controller and repeat the touch link again after previous light touch link is ok.
4.1.3.3 Fuse bits settings
The recommended fuse bits settings are shown in Table 4-1.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
13
Table 4-1.
Fuse bits for the Atmel ATmega128RFA1.
Option
Required value
BODLEVEL
1V8
OCDEN
Enabled
JTAGEN
Enabled
SPIEN
Enabled
WDTON
Disabled
EESAVE
Disabled
BOOTSZ
Boot Flash size = 2048 words
Start address = $F800
BOOTRST
Disabled
CKDIV8
Enabled
CKOUT
Disabled
SUT_CKSEL
Int. RC osc.; Startup time: 6CK + 65ms
Resulting bytes:
4.2
Ext
0xFE
High
0x1B
Low
0x62
Programming Atmel SAM3X-EK via Atmel SAM-BA
SAM-BA® can be used to download binary image to SAM3X-EK board for those who don’t have the Atmel SAM-ICE.
4.2.1
Prerequisites
To download the binary image without SAM-ICE, SAM-BA must be installed. The install package can be found in Atmel
official website.
Here is the download link:
http://www.atmel.com/tools/ATMELSAM-BAIN-SYSTEMPROGRAMMER.aspx
A Micro-USB cable or a serial cable is needed to connect the SAM3X-EK board with SAM-BA.
4.2.2
Step-by-step guide
To download firmware image to SAM3X-EK, follow these steps:
1.
2.
3.
Connect the erase jumper at JP6 on SAM3X-EK board and then power on.
Power off and disconnect the erase jumper.
Connect the Micro-USB cable to Micro-USB connector at J3 or serial cable to UART at J11.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
14
Figure 4-7. Erase jumper, Micro-USB and UART connector on the Atmel SAM3X-EK.
4.
5.
Open Atmel SAM-BA.
Choose the connection type and board, and then click Connect button.
Figure 4-8. Launch SAM-BA.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
15
Figure 4-9. Atmel SAM-BA connected with the Atmel SAM3X-EK.
In the SAM-BA connected dialog, click the drop-down list in Scripts section, select “Enable Flash access”, and
then click Execute button.
7. In the Send File Name section, select the binary image (SAM3X-LwIP.bin) and then click Send File button.
8. A lock region dialog may pop up, click NO button.
9. In the Scripts section, click the drop-down list, select “Boot from Flash (GPNVM1)”, and then click Execute
button.
10. Close SAM-BA and power off the board.
6.
The pre-built image is now downloaded to the board.
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
16
5.
Revision History
Doc. Rev.
Date
Comments
42057A
12/2012
Initial document release
Atmel AVR417: ZLL Gateway Getting Started Guide [APPLICATION NOTE]
42057A−AVR−12/2012
17
Atmel Corporation
Atmel Asia Limited
Atmel Munich GmbH
Atmel Japan G.K.
1600 Technology Drive
Unit 01-5 & 16, 19F
Business Campus
16F Shin-Osaki Kangyo Building
San Jose, CA 95110
BEA Tower, Millennium City 5
Parkring 4
1-6-4 Osaki
USA
418 Kwun Tong Road
D-85748 Garching b. Munich
Shinagawa-ku, Tokyo 141-0032
Tel: (+1)(408) 441-0311
Kwun Tong, Kowloon
GERMANY
JAPAN
Fax: (+1)(408) 487-2600
HONG KONG
Tel: (+49) 89-31970-0
Tel: (+81)(3) 6417-0300
www.atmel.com
Tel: (+852) 2245-6100
Fax: (+49) 89-3194621
Fax: (+81)(3) 6417-0370
Fax: (+852) 2722-1369
© 2012 Atmel Corporation. All rights reserved. / Rev.: 42057A−AVR−12/2012
Atmel®, Atmel logo and combinations thereof, AVR®, BitCloud®, Enabling Unlimited Possibilities®, SAM-BA®, and others are registered trademarks or trademarks
of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this
document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES
NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF
INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no
representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time
without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in,
automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.