Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: X_NUCLEO_IDW01M1_AP_Test
Fork of X_NUCLEO_IDW01M1 by
Revision 22:a1276b7d3b2d, committed 2016-07-07
- Comitter:
- scsims
- Date:
- Thu Jul 07 13:54:06 2016 +0000
- Parent:
- 21:9de5d3ab3615
- Commit message:
- Added wifi_connected_to_ap extern to indicate when BSSS beacons have been lost/picked up. Also added some debugging to get a better idea as to what's going to and from the SPWF01SA.11 over the UART
Changed in this revision
--- a/SPWFInterface.cpp Wed Jun 22 15:13:24 2016 +0000
+++ b/SPWFInterface.cpp Thu Jul 07 13:54:06 2016 +0000
@@ -88,7 +88,8 @@
int SpwfSAInterface::init(void)
{
_spwf.setTimeout(SPWF_MISC_TIMEOUT);
- return (_spwf.init());
+ int result = _spwf.init();
+ return result;
}
/**
@@ -155,7 +156,6 @@
pass_phrase = NULL;
}
}
-
return (_spwf.start_access_point((char*)ap, (char*)pass_phrase, mode, channel_num, data_rates));
}
@@ -326,7 +326,6 @@
const char *proto = (socket->proto == NSAPI_UDP) ? "u" : "t";
err = _spwf.socket_server_open((uint32_t)socket->server_port, (uint8_t *)proto);
-
if(err==0)
{
socket->id = SERVER_SOCKET_NO;//Special socket ID number for Server Socket
--- a/Spwf/inc/wifi_const.h Wed Jun 22 15:13:24 2016 +0000
+++ b/Spwf/inc/wifi_const.h Thu Jul 07 13:54:06 2016 +0000
@@ -38,7 +38,8 @@
/** @defgroup NUCLEO_WIFI_INTERFACE_Private_Defines
* @{
*/
-
+
+//#define DEBUG_PRINT 1
#define EPOCH_TIME 1453727657//Human time (GMT): Mon, 25 Jan 2016 13:14:17 GMT
#define EXTI_CONF_TIMER 1900 //millisec
#define PROCESS_WIFI_TIMER 1
--- a/Spwf/wifi_driver.c Wed Jun 22 15:13:24 2016 +0000
+++ b/Spwf/wifi_driver.c Thu Jul 07 13:54:06 2016 +0000
@@ -179,6 +179,12 @@
{
return WiFi_UNHANDLED_IND_ERROR;
}
+
+ #if DEBUG_PRINT
+ if ('\0' == ((char*)WiFi_AT_Cmd_Buff)[size+1] ) {
+ printf((const char*)WiFi_AT_Cmd_Buff);
+ }
+ #endif
#if defined(USART3_INT_MODE)
if(HAL_UART_Transmit_IT(&UartWiFiHandle, (uint8_t *)WiFi_AT_Cmd_Buff, size)!= HAL_OK)
--- a/Spwf/wifi_interface.c Wed Jun 22 15:13:24 2016 +0000
+++ b/Spwf/wifi_interface.c Thu Jul 07 13:54:06 2016 +0000
@@ -626,6 +626,9 @@
{
status = USART_Receive_AT_Resp(Process_Event);
}
+#if DEBUG_PRINT
+printf("Command '%s', returned %d\r\n", WiFi_AT_Cmd_Buff, status);
+#endif
return status;
}
--- a/Spwf/wifi_module.c Wed Jun 22 15:13:24 2016 +0000
+++ b/Spwf/wifi_module.c Thu Jul 07 13:54:06 2016 +0000
@@ -166,6 +166,8 @@
uint8_t scanned_ssids = 0;
char * prefetch_str;
+uint8_t wifi_connected_to_ap = 0;
+
uint8_t WiFi_AT_Cmd_Buff[2052];
#ifdef USART_PRINT_MSG
@@ -2170,6 +2172,9 @@
void Process_WiFi_Indication_Cmd(event_s_TypeDef * event_pop_s1)
{
+#if DEBUG_PRINT
+ printf("processing WIND %d\r\n", event_pop_s1->wind);
+#endif
switch(event_pop_s1->wind)
{
case Console_Active:
@@ -2211,6 +2216,7 @@
case CopyrightInfo:
break;
case WiFi_BSS_Regained:
+ wifi_connected_to_ap = 1;
break;
case WiFi_Signal_LOW:
WiFi_WIND_State.WiFiSignalLOW = WIFI_TRUE;
@@ -2222,6 +2228,7 @@
case Encryption_key_Not_Recognized:
break;
case WiFi_Join :
+ wifi_connected_to_ap = 1;
WiFi_WIND_State.WiFiJoin = WIFI_TRUE;
break;
case JOINFAILED :
@@ -2264,6 +2271,7 @@
}
break;
case WiFi_BSS_LOST:
+ wifi_connected_to_ap = 0;
break;
case WiFi_Unhandled_Event:
break;
--- a/Spwf_API/SpwfSADevice.cpp Wed Jun 22 15:13:24 2016 +0000
+++ b/Spwf_API/SpwfSADevice.cpp Thu Jul 07 13:54:06 2016 +0000
@@ -162,7 +162,7 @@
if(status!=WiFi_MODULE_SUCCESS)
{
return -1;
- }
+ }
while(!sync_wait_signal)
{
@@ -208,7 +208,9 @@
}
status = SET_Configuration_Value(WIFI_HT_MODE, modeNEnabled);
- if(status != WiFi_MODULE_SUCCESS) return -1;
+ if(status != WiFi_MODULE_SUCCESS && modeNEnabled) {
+ return -1;
+ }
status = SET_Configuration_Addr(WIFI_OPR_RATE_MASK, oprMask);
if(status != WiFi_MODULE_SUCCESS) return -1;
