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
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:
- a SPWF01SA Serial-to-Wi-Fi module
Example Applications
NSAPI Test Suite
Diff: SpwfInterface.cpp
- Revision:
- 3:4c2cbca19031
- Parent:
- 2:610672ed2e9f
- Child:
- 4:2f3f156a3b0b
--- a/SpwfInterface.cpp Thu Jul 07 06:45:32 2016 +0000 +++ b/SpwfInterface.cpp Thu Jul 07 11:06:10 2016 +0000 @@ -298,7 +298,7 @@ int SpwfSAInterface::socket_send(void *handle, const void *data, unsigned size) { struct spwf_socket *socket = (struct spwf_socket *)handle; - int err; + //int err; /*if(socket->id==SERVER_SOCKET_NO) { @@ -308,11 +308,14 @@ err = _spwf.socket_server_write((uint16_t)size, (char*)data); } else - {*/ + { err = _spwf.send(socket->id, (char*)data, (uint32_t)size); - //} - - return err; + }*/ + if (!_spwf.send(socket->id, (char*)data, (uint32_t)size)) { + return NSAPI_ERROR_DEVICE_ERROR; + } + + return size; } /** @@ -332,6 +335,7 @@ //CHECK:Receive for both Client and Server Sockets same? recv = _spwf.recv(socket->id, (char*)data, (uint32_t)size); if (recv < 0) { + //printf("ret -1\r\n"); return NSAPI_ERROR_WOULD_BLOCK; } return recv;