X-NUCLEO-IDW01M1 Wi-Fi expansion board mbed OS 2 ("Classic") library. mbed OS 5 library also available (see below).

Dependencies:   SPWF01SA

Dependents:   SpwfInterface_NSAPI_Testsv2 Nucleo_read_a0_thingspace Nucleo_read_a0_thingspace_mems Cayenne-X-NUCLEO-IDW01M1 ... more

Fork of X_NUCLEO_IDW01M1v2 by ST Expansion SW Team

Introduction

X_NUCLEO_IDW01M1 is a mbed library for the Wi-Fi expansion board X-NUCLEO-IDW01M1 compatible with STM32 Nucleo.

The software can be used for building Wi-Fi applications with the SPWF01SA module. It is an implementation of the NetworkSocketAPI library from mbed OS 2 ("Classic").
mbed OS 5 library can instead be found at this link.

Firmware Library

The X_NUCLEO_IDW01M1 library comes with a sample application (HelloWorld_IDW01M1v2) and a NSAPI test suite application (SpwfInterface_NSAPI_Testsv2).

This library is only supported on NUCLEO platforms and any platforms with Arduino connector. However connection to arduino needs to be done manually using 4 wires for Vdd, Gnd, Rx and Tx. Example applications have more specific details on exact connections to be used.

The features of the library are :

  • Supports mbed OS 2 ("Classic") NetworkSocketAPI
  • Supports both client sockets
  • Configuration of USART pins to be used

Class SpwfSAInterface is intended to represent the X-NUCLEO-IDW01M1 expansion board with the SPWF module.

The expansion board is basically featuring the component:

  1. a SPWF01SA Serial-to-Wi-Fi module

Example Applications

NSAPI Test Suite

Committer:
mridup
Date:
Tue Jul 05 09:36:47 2016 +0000
Revision:
0:907910bfb0b5
Child:
13:0368732b5b9d
SPWF NSAPI v2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mridup 0:907910bfb0b5 1 /* mbed Microcontroller Library
mridup 0:907910bfb0b5 2 * Copyright (c) 20015 ARM Limited
mridup 0:907910bfb0b5 3 *
mridup 0:907910bfb0b5 4 * Licensed under the Apache License, Version 2.0 (the "License");
mridup 0:907910bfb0b5 5 * you may not use this file except in compliance with the License.
mridup 0:907910bfb0b5 6 * You may obtain a copy of the License at
mridup 0:907910bfb0b5 7 *
mridup 0:907910bfb0b5 8 * http://www.apache.org/licenses/LICENSE-2.0
mridup 0:907910bfb0b5 9 *
mridup 0:907910bfb0b5 10 * Unless required by applicable law or agreed to in writing, software
mridup 0:907910bfb0b5 11 * distributed under the License is distributed on an "AS IS" BASIS,
mridup 0:907910bfb0b5 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mridup 0:907910bfb0b5 13 * See the License for the specific language governing permissions and
mridup 0:907910bfb0b5 14 * limitations under the License.
mridup 0:907910bfb0b5 15 */
mridup 0:907910bfb0b5 16
mridup 0:907910bfb0b5 17 /**
mridup 0:907910bfb0b5 18 ******************************************************************************
mridup 0:907910bfb0b5 19 * @file SpwfInterface.h
mridup 0:907910bfb0b5 20 * @author STMicroelectronics
mridup 0:907910bfb0b5 21 * @brief Header file of the NetworkStack for the SPWF Device
mridup 0:907910bfb0b5 22 ******************************************************************************
mridup 0:907910bfb0b5 23 * @copy
mridup 0:907910bfb0b5 24 *
mridup 0:907910bfb0b5 25 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
mridup 0:907910bfb0b5 26 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
mridup 0:907910bfb0b5 27 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
mridup 0:907910bfb0b5 28 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
mridup 0:907910bfb0b5 29 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
mridup 0:907910bfb0b5 30 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
mridup 0:907910bfb0b5 31 *
mridup 0:907910bfb0b5 32 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
mridup 0:907910bfb0b5 33 ******************************************************************************
mridup 0:907910bfb0b5 34 */
mridup 0:907910bfb0b5 35
mridup 0:907910bfb0b5 36 #ifndef SPWFSA_INTERFACE_H
mridup 0:907910bfb0b5 37 #define SPWFSA_INTERFACE_H
mridup 0:907910bfb0b5 38
mridup 0:907910bfb0b5 39 #include "WiFiInterface.h"
mridup 0:907910bfb0b5 40 #include "SPWFSA01.h"
mridup 0:907910bfb0b5 41
mridup 0:907910bfb0b5 42 #define SPWFSA_SOCKET_COUNT 8
mridup 0:907910bfb0b5 43 #define SERVER_SOCKET_NO 9
mridup 0:907910bfb0b5 44
mridup 0:907910bfb0b5 45 /** SpwfSAInterface class
mridup 0:907910bfb0b5 46 * Implementation of the NetworkStack for the SPWF Device
mridup 0:907910bfb0b5 47 */
mridup 0:907910bfb0b5 48 class SpwfSAInterface : public NetworkStack, public WiFiInterface
mridup 0:907910bfb0b5 49 {
mridup 0:907910bfb0b5 50 public:
mridup 0:907910bfb0b5 51
mridup 0:907910bfb0b5 52 SpwfSAInterface(PinName tx, PinName rx, bool debug = false);
mridup 0:907910bfb0b5 53 virtual ~SpwfSAInterface();
mridup 0:907910bfb0b5 54
mridup 0:907910bfb0b5 55 // Implementation of WiFiInterface
mridup 0:907910bfb0b5 56 virtual int connect(const char *ssid,
mridup 0:907910bfb0b5 57 const char *pass,
mridup 0:907910bfb0b5 58 nsapi_security_t security = NSAPI_SECURITY_NONE);
mridup 0:907910bfb0b5 59
mridup 0:907910bfb0b5 60 virtual int disconnect();
mridup 0:907910bfb0b5 61 virtual const char *get_mac_address();
mridup 0:907910bfb0b5 62 void debug(const char * string);
mridup 0:907910bfb0b5 63
mridup 0:907910bfb0b5 64 //Implementation of NetworkStack
mridup 0:907910bfb0b5 65 virtual const char *get_ip_address();
mridup 0:907910bfb0b5 66
mridup 0:907910bfb0b5 67 protected:
mridup 0:907910bfb0b5 68 //Implementation of NetworkStack
mridup 0:907910bfb0b5 69 virtual int socket_open(void **handle, nsapi_protocol_t proto);
mridup 0:907910bfb0b5 70 virtual int socket_close(void *handle);
mridup 0:907910bfb0b5 71 virtual int socket_bind(void *handle, const SocketAddress &address); //not supported
mridup 0:907910bfb0b5 72 virtual int socket_listen(void *handle, int backlog);
mridup 0:907910bfb0b5 73 virtual int socket_connect(void *handle, const SocketAddress &address);
mridup 0:907910bfb0b5 74 virtual int socket_accept(void **handle, void *server);
mridup 0:907910bfb0b5 75 virtual int socket_send(void *handle, const void *data, unsigned size);
mridup 0:907910bfb0b5 76 virtual int socket_recv(void *handle, void *data, unsigned size);
mridup 0:907910bfb0b5 77 virtual int socket_sendto(void *handle, const SocketAddress &address, const void *data, unsigned size);
mridup 0:907910bfb0b5 78 virtual int socket_recvfrom(void *handle, SocketAddress *address, void *buffer, unsigned size);
mridup 0:907910bfb0b5 79 virtual void socket_attach(void *handle, void (*callback)(void *), void *data);
mridup 0:907910bfb0b5 80
mridup 0:907910bfb0b5 81 private:
mridup 0:907910bfb0b5 82 int init(void);
mridup 0:907910bfb0b5 83
mridup 0:907910bfb0b5 84 SPWFSA01 _spwf;
mridup 0:907910bfb0b5 85 bool _ids[SPWFSA_SOCKET_COUNT];
mridup 0:907910bfb0b5 86 bool isListening;
mridup 0:907910bfb0b5 87 bool isInitialized;
mridup 0:907910bfb0b5 88 };
mridup 0:907910bfb0b5 89
mridup 0:907910bfb0b5 90
mridup 0:907910bfb0b5 91 #endif