NetworkSocketAPI Test Suite for X-NUCLEO-IDW01M1 Wi-Fi expansion board.

Dependencies:   NSAPITests NetworkSocketAPI X_NUCLEO_IDW01M1v2 mbed

Fork of SpwfInterface_NSAPI_Testsv2 by ST Expansion SW Team

Introduction

SpwfInterface_NSAPI_Tests is a test suite application for the NSAPI Tests Suite for the expansion board X-NUCLEO-IDW01M1v2. This library is only supported on NUCLEO platforms and any arduino platforms.

Example Application

The SpwfSAInterface class needs to be instantiated with the UART RX and TX pins used. Depending on the platform used, the pin numbers may vary.

E.g. For FRDM K64F board it is: D9 and D7.

For Nucleo it is D8 and D2.

SpwfSAInterface spwf(D8, D2, false);


First of all, the example application tries to connect to the SSID/AP which is provided in the program code. In order to connect to your desired SSID/AP please change the SSID/AP settings/text to the one which is used in the user's environment. Please also remember that the SSID needs to be connected to the internet.

 char * ssid = "STM"; //Please change to local SSID/AP name
 char * seckey = "STMdemoPWD"; //Please change password


The NSAPI python script EchoServer.py needs to be executed on the server side before starting the test on the mbed platform. The server IP address and the port to connect to needs to be modified in the code below before starting the tests on the mbed platform.

nsapi_tests("SPWF Tests", &spwf, "192.168.1.6", 32001);



Committer:
mridup
Date:
Thu Jul 07 13:24:37 2016 +0000
Revision:
0:4944fa871b4e
Child:
1:7ac12938ea82
X_NUCLEO_IDW01M1v2 based Spwf NSAPI Tests v2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mridup 0:4944fa871b4e 1 /* NetworkSocketAPI Example Program
mridup 0:4944fa871b4e 2 * Copyright (c) 2015 ARM Limited
mridup 0:4944fa871b4e 3 *
mridup 0:4944fa871b4e 4 * Licensed under the Apache License, Version 2.0 (the "License");
mridup 0:4944fa871b4e 5 * you may not use this file except in compliance with the License.
mridup 0:4944fa871b4e 6 * You may obtain a copy of the License at
mridup 0:4944fa871b4e 7 *
mridup 0:4944fa871b4e 8 * http://www.apache.org/licenses/LICENSE-2.0
mridup 0:4944fa871b4e 9 *
mridup 0:4944fa871b4e 10 * Unless required by applicable law or agreed to in writing, software
mridup 0:4944fa871b4e 11 * distributed under the License is distributed on an "AS IS" BASIS,
mridup 0:4944fa871b4e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mridup 0:4944fa871b4e 13 * See the License for the specific language governing permissions and
mridup 0:4944fa871b4e 14 * limitations under the License.
mridup 0:4944fa871b4e 15 */
mridup 0:4944fa871b4e 16
mridup 0:4944fa871b4e 17 #include "mbed.h"
mridup 0:4944fa871b4e 18 #include "SpwfInterface.h"
mridup 0:4944fa871b4e 19 #include "NSAPITests.h"
mridup 0:4944fa871b4e 20
mridup 0:4944fa871b4e 21 //------------------------------------
mridup 0:4944fa871b4e 22 // Hyperterminal configuration
mridup 0:4944fa871b4e 23 // 9600 bauds, 8-bit data, no parity
mridup 0:4944fa871b4e 24 //------------------------------------
mridup 0:4944fa871b4e 25
mridup 0:4944fa871b4e 26 Serial pc(SERIAL_TX, SERIAL_RX);
mridup 0:4944fa871b4e 27 DigitalOut myled(LED1);
mridup 0:4944fa871b4e 28 SpwfSAInterface spwf(PA_9, PA_10, false);
mridup 0:4944fa871b4e 29
mridup 0:4944fa871b4e 30 int main()
mridup 0:4944fa871b4e 31 {
mridup 0:4944fa871b4e 32 int32_t err;
mridup 0:4944fa871b4e 33 char * ssid = "STM";
mridup 0:4944fa871b4e 34 char * seckey = "STMdemoPWD";
mridup 0:4944fa871b4e 35
mridup 0:4944fa871b4e 36 pc.printf("\r\nSpwf Interface NSAPI Tests\r\n");
mridup 0:4944fa871b4e 37 pc.printf("\r\nconnecting to AP\r\n");
mridup 0:4944fa871b4e 38
mridup 0:4944fa871b4e 39 err = spwf.connect(ssid, seckey, NSAPI_SECURITY_WPA);
mridup 0:4944fa871b4e 40
mridup 0:4944fa871b4e 41 if (!err) {
mridup 0:4944fa871b4e 42 printf("Interface failed to connect with code %d\r\n", err);
mridup 0:4944fa871b4e 43 } else {
mridup 0:4944fa871b4e 44 int i = 0;
mridup 0:4944fa871b4e 45 for(;i<10; i++)
mridup 0:4944fa871b4e 46 nsapi_tests("SPWF Tests", &spwf, "192.168.1.6", 32001);
mridup 0:4944fa871b4e 47 spwf.disconnect();
mridup 0:4944fa871b4e 48 }
mridup 0:4944fa871b4e 49
mridup 0:4944fa871b4e 50 while(1)
mridup 0:4944fa871b4e 51 {
mridup 0:4944fa871b4e 52 wait(1);
mridup 0:4944fa871b4e 53 myled = !myled;
mridup 0:4944fa871b4e 54 }
mridup 0:4944fa871b4e 55 }