Atmel Anxxx Iot App For Samw25 Exosite 20150513
Atmel Anxxx Iot App For Samw25 Exosite 20150513
Atmel Anxxx Iot App For Samw25 Exosite 20150513
AN-XXXXX
Prerequisites
• Hardware Prerequisites
Atmel | SMART SAM W25 Xplained Pro Board
Atmel I/O1 Xplained Pro extension
USB Micro Cable (TypeA / MicroB)
• Software Prerequisites
Atmel Studio 6.2 SP2
Atmel Studio Exosite demo project
Introduction
This document will demonstrate how to connect the SAM W25 Xplained PRO board
to cloud backend services such as Exosite.
The following topics will be covered:
• Hardware overview for both SAM W25 Wi-Fi module and SAM W25
Xplained PRO evaluation board.
Prerequisites .....................................................................................1
Introduction ......................................................................................1
Icon Key Identifiers ...........................................................................3
1. Introduction. ...............................................................................4
1.1 Atmel | SMART SAM W25 Wi-Fi Module ............................................. 4
1.2 Atmel | SMART SAM W25 Xplained Pro Board ................................... 4
1.3 Atmel Studio 6 ...................................................................................... 5
1.4 Atmel Software Framework (ASF) ....................................................... 6
1.5 Atmel SmartConnect WINC1500 Host Driver ...................................... 7
1.6 How to download new Atmel SmartConnect WINC1500 Firmware .... 7
2. Overview ..................................................................................11
2.1 Adding connectivity to the Exosite Cloud Service ............................. 11
2.2 Exosite Basic HTTP API .................................................................... 11
2.3 Exosite client module API .................................................................. 12
5. Conclusion ...............................................................................24
The SAM W25 Wi-Fi module is based on the industry-leading Atmel SmartConnect WINC1500 Wi-Fi core
combined with the Atmel | SMART SAMD21 ARM Cortex M0+ based microcontroller. This turnkey system
provides an integrated software solution with application and security protocols such as TLS and integrated
network services (TCP/IP stack).
• Atmel Gallery is an online apps store built in to Studio 6, allowing you to purchase
both in-house and third-party development tools and embedded software.
Link: http://gallery.atmel.com/
• Atmel Spaces is a collaborative workspace where you can securely share embedded
design and track progress of projects with your peers.
Link: http://spaces.atmel.com/gf/
The Atmel Studio version used for this document is Atmel Studio 6.2 with Service
Pack 2.
Do not connect SAM W25 VIRTUAL COM PORT to any terminal program such as
Tera term or Putty because the firmware upgrade process will fail. Do not connect IO/1
extension at this point.
SUCCESS firmware download. The following message will be displayed on the command
window.
If you see a fail message as above, you must check your device is connected in the DEBUG USB port and
also that no terminal software is currently using the com port of the SAM W25 board.
• exosite_example_init()
• exosite_example_activiate()
• exosite_example_read_write()
2. An Atmel Studio Project will be started and you can find the file “main.c” in this project. Then you will see all
the features of this application described in the next section.
• Connect the SAM W25 Xplained Pro board to your PC by using DEBUG USB connector.
• Program the application by clicking on the Start Debugging and Break icon:
• The application will be programmed in the SAM D21 embedded flash and breaks at main function.
You may be asked to upgrade your EDBG firmware. If so, click on Upgrade:
Upgrade operation may take a few minutes, please wait for the operation to complete.
Open the EDBG DEBUG USB serial COM port, with the following settings:
• 115200 bauds
• 8 bit data
• no parity
Once connected, just open your favorite web browser at the following address
http://atmelconfig.com and provide the required Network Name (SSID) and Passphrase
(Device Name can be blank) fields of the Wi-Fi AP the SAM W25 is supposed to connect.
Now that the SAM W25 is connected to the AP with internet connectivity, it will immediately connect to the Exosite
messaging service and will start sending the temperature and light data.
2) Register your device and input your device serial number on I/O1 extension.
The “main_http_client_callback()” will be registered by Exosite_example_init() and will receive and process all
socket events.
This function can be located in the main.c file or in a separate file as below;
The above function receives two parameters. The first one is a function pointer to deliver socket messages
from the socket. The other one is a function pointer that is used for DNS resolving functionalities. We can find
those two parameters in “http_client.h” as below;
if (tick_counter_check_timer())
{
Char send_buf[100];
int dTemp = 0;
int dLight = 0;
With the above function, the data will be sent to the cloud continuously in regular intervals.
/**
* \brief Callback to get the Data from socket.
*/
static void main_http_client_callback(struct http_client_module *module_list,
int type,
union http_client_data *data)
{
case HTTP_CLIENT_CALLBACK_RECV_RESPONSE:
parsing_http_response_data( data->recv_response.response_code,
data->recv_response.content,
data->recv_response.content_length);
break;
}
Then you can add the different codes to process the received messages without the
“parsing_http_response_data()” function.
© 2012 Atmel Corporation. All rights reserved. / Rev.: Error! Reference source not found.
Atmel® , Atmel logo and combinations thereof, Enabling Unlimited Possibilities® , 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.