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);



main.cpp

Committer:
mridup
Date:
2016-09-07
Revision:
1:7ac12938ea82
Parent:
0:4944fa871b4e

File content as of revision 1:7ac12938ea82:

/* NetworkSocketAPI Example Program
 * Copyright (c) 2015 ARM Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
#include "mbed.h"
#include "SpwfInterface.h"
#include "NSAPITests.h"

//------------------------------------
// Hyperterminal configuration
// 9600 bauds, 8-bit data, no parity
//------------------------------------

Serial pc(USBTX, USBRX);
DigitalOut myled(LED1);
SpwfSAInterface spwf(D8, D2, false);
 
int main()
{
    int32_t err;  
    char * ssid = "STM";
    char * seckey = "STMdemoPWD";
      
    pc.printf("\r\nSpwf Interface NSAPI Tests\r\n");
    pc.printf("\r\nconnecting to AP\r\n");
            
    err = spwf.connect(ssid, seckey, NSAPI_SECURITY_WPA);
 
    if (!err) {
        printf("Interface failed to connect with code %d\r\n", err);
    } else {
        nsapi_tests("SPWF Tests", &spwf, "192.168.1.6", 32001);
        spwf.disconnect();
    }

    while(1)
    {
        wait(1);
        myled = !myled;
    }
}