![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
WIFU
Dependencies: DISCO_L475VG_IOT01A_wifi
Revision 4:5faac3e1e099, committed 2019-12-04
- Comitter:
- peng103617
- Date:
- Wed Dec 04 05:36:49 2019 +0000
- Parent:
- 3:1f8ef0fd4347
- Commit message:
- WIFI_L475VG
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed_app.json | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1f8ef0fd4347 -r 5faac3e1e099 main.cpp --- a/main.cpp Thu Aug 17 16:37:16 2017 +0000 +++ b/main.cpp Wed Dec 04 05:36:49 2019 +0000 @@ -38,22 +38,22 @@ pc.baud(115200); printf("\n"); - printf("************************************************************\n"); - printf("*** STM32 IoT Discovery kit for STM32L475 MCU ***\n"); - printf("*** WIFI Module in TCP Client mode demonstration ***\n\n"); - printf("*** TCP Client Instructions :\n"); - printf("*** 1- Make sure your Phone is connected to the same network that\n"); - printf("*** you configured using the Configuration Access Point.\n"); - printf("*** 2- Create a server by using the android application TCP Server\n"); + printf("************************************************************\r\n"); + printf("*** STM32 IoT Discovery kit for STM32L475 MCU ***\r\n"); + printf("*** WIFI Module in TCP Client mode demonstration ***\r\n"); + printf("*** TCP Client Instructions :\r\n"); + printf("*** 1- Make sure your Phone is connected to the same network that\r\n"); + printf("*** you configured using the Configuration Access Point.\r\n"); + printf("*** 2- Create a server by using the android application TCP Server\r\n"); printf("*** with port(8002).\n"); - printf("*** 3- Get the Network Name or IP Address of your phone from the step 2.\n\n"); - printf("************************************************************\n"); + printf("*** 3- Get the Network Name or IP Address of your phone from the step 2.\r\n"); + printf("************************************************************\r\n"); /*Initialize WIFI module */ if(WIFI_Init() == WIFI_STATUS_OK) { - printf("> WIFI Module Initialized.\n"); + printf("> WIFI Module Initialized.\r\n"); if(WIFI_GetMAC_Address(MAC_Addr) == WIFI_STATUS_OK) { - printf("> es-wifi module MAC Address : %X:%X:%X:%X:%X:%X\n", + printf("> es-wifi module MAC Address : %X:%X:%X:%X:%X:%X\r\n", MAC_Addr[0], MAC_Addr[1], MAC_Addr[2], @@ -61,19 +61,19 @@ MAC_Addr[4], MAC_Addr[5]); } else { - printf("> ERROR : CANNOT get MAC address\n"); + printf("> ERROR : CANNOT get MAC address\r\n"); } if( WIFI_Connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, WIFI_ECN_WPA2_PSK) == WIFI_STATUS_OK) { - printf("> es-wifi module connected \n"); + printf("> es-wifi module connected \r\n"); if(WIFI_GetIP_Address(IP_Addr) == WIFI_STATUS_OK) { - printf("> es-wifi module got IP Address : %d.%d.%d.%d\n", + printf("> es-wifi module got IP Address : %d.%d.%d.%d\r\n", IP_Addr[0], IP_Addr[1], IP_Addr[2], IP_Addr[3]); - printf("> Trying to connect to Server: %d.%d.%d.%d:8002 ...\n", + printf("> Trying to connect to Server: %d.%d.%d.%d:8002 ...\r\n", RemoteIP[0], RemoteIP[1], RemoteIP[2], @@ -81,34 +81,40 @@ while (Trials--){ if( WIFI_OpenClientConnection(0, WIFI_TCP_PROTOCOL, "TCP_CLIENT", RemoteIP, 8002, 0) == WIFI_STATUS_OK){ - printf("> TCP Connection opened successfully.\n"); + printf("> TCP Connection opened successfully.\r\n"); Socket = 0; } } if(!Trials) { - printf("> ERROR : Cannot open Connection\n"); + printf("> ERROR : Cannot open Connection\r\n"); } } else { - printf("> ERROR : es-wifi module CANNOT get IP address\n"); + printf("> ERROR : es-wifi module CANNOT get IP address\r\n"); } } else { - printf("> ERROR : es-wifi module NOT connected\n"); + printf("> ERROR : es-wifi module NOT connected\r\n"); } } else { - printf("> ERROR : WIFI Module cannot be initialized.\n"); + printf("> ERROR : WIFI Module cannot be initialized.\r\n"); } while(1){ if(Socket != -1) { + printf("Socket sent\r\n"); + if(WIFI_SendData(Socket, TxData, sizeof(TxData), &Datalen, WIFI_WRITE_TIMEOUT) != WIFI_STATUS_OK) { + printf("> ERROR : Failed to send Data.\r\n"); + } + /* if(WIFI_ReceiveData(Socket, RxData, sizeof(RxData), &Datalen, WIFI_READ_TIMEOUT) == WIFI_STATUS_OK){ if(Datalen > 0) { if(WIFI_SendData(Socket, TxData, sizeof(TxData), &Datalen, WIFI_WRITE_TIMEOUT) != WIFI_STATUS_OK) { - printf("> ERROR : Failed to send Data.\n"); + printf("> ERROR : Failed to send Data.\r\n"); } } } else { - printf("> ERROR : Failed to Receive Data.\n"); + printf("> ERROR : Failed to Receive Data.\r\n"); } + */ } } }
diff -r 1f8ef0fd4347 -r 5faac3e1e099 mbed_app.json --- a/mbed_app.json Thu Aug 17 16:37:16 2017 +0000 +++ b/mbed_app.json Wed Dec 04 05:36:49 2019 +0000 @@ -1,12 +1,12 @@ { "config": { "wifi-ssid": { - "help": "WiFi SSID", - "value": "\"SSID\"" + "help": "peng", + "value": "\"peng\"" }, "wifi-password": { - "help": "WiFi Password", - "value": "\"PASSWORD\"" + "help": "199685612", + "value": "\"199685612\"" }, "server-ip-1": { "help": "TCP server IP address 1st value", @@ -18,11 +18,11 @@ }, "server-ip-3": { "help": "TCP server IP address 3rd value", - "value": "1" + "value": "43" }, "server-ip-4": { "help": "TCP server IP address 4th value", - "value": "101" + "value": "147" } } } \ No newline at end of file