This example project demonstrates the WINC3400 applications of WiFi and BLE in Socket mode
Parent topic:Harmony 3 Wireless application examples for WINC3400
This project has both WiFi and BLE example applications. The user can configure the WiFi parameters and select the required example application through command. The user would need to use "Microchip Bluetooth Data" mobile application to run the BLE example applications.
To download or clone this application from Github, go to the top level of the repository
Path of the application within the repository is ,wireless_apps_winc3400/apps/wifi_socket_demos/firmware.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
sam_e54_xpro_winc3400.X | MPLABX project for SAME54 Xplained Pro Evaluation Kit and WINC3400 Xplained pro |
sam_d21_xpro_winc3400.X | MPLABX project for SAMD21 Xplained Pro Evaluation Kit and WINC3400 Xplained pro |
sam_e54_xpro_winc3400_freertos.X | MPLABX project for SAME54 Xplained Pro Evaluation Kit and WINC3400 Xplained pro using FreeRTOS |
sam_a5d27_som1_winc3400.X | MPLABX project for SAMA5D27 SAMA5D27-SOM1-EK1 Evaluation Kit and WINC1500 WiFi 7 Click board |
pic32mz_ef_curiosity_v2_winc3400.X | MPLABX project for PIC32MZ EF 2.0 curiosity board and WINC3400 Xplained pro |
-
Connect the Debug USB port on the SAMXXX Xplained Pro board to the computer using a micro USB cable
-
Connect the WINC3400 Xplained pro on the EXT1 header of SAMXXX Xplained Pro board
-
Connect the Debug USB port on the PIC32MZ EF 2.0 Curiosity board to the computer using a micro USB cable
-
Connect the WINC3400 Xplained pro on the EXT1 header of PIC32MZ EF 2.0 Curiosity board
-
Connect the WINC3400 WiFi 8 Click board to the MBus1 connector.
-
Connect the USB port (J10) on SOM1-Ek1 board to the computer using micro USB cable.
- SD Card with FAT32 file system
-
Copy the boot loader binary( boot.bin) from "firmware\at91bootstrap_sam_a5d27_som1_ek.X\binaries" onto the SD card
-
Copy the application (harmony.bin) from "firmware/sam_a5d27_som1_winc3400.X/dist/sam_a5d27_som1_winc3400/production" onto the SD card, available after a successful build of the application
-
Insert the SD card into SDMMC slot (J12).
-
Connect the Debug USB port on the board to the computer using a micro USB cable.
-
Build and program the application project using its respective IDE. (This step is not applicable for the host SAMA5D27.The application will load from SD card)
-
Open the Terminal application (Ex.:Tera term) on the computer
-
Connect to the "USB to UART" COM port and configure the serial settings as follows:
-
Baud : 115200
-
Data : 8 Bits
-
Parity : None
-
Stop : 1 Bit
-
Flow Control : None
-
-
Use WiFi commands to configure WiFi parameters and use application commands to select the example application.
WiFi Commands Details
Command | Details | Example |
---|---|---|
wifi help | Wi-Fi Service help command | wifi help |
wifi set <bootmode> <ssid_name> <auth_type> <pwd> <username/index> | Set Wi-Fi Configuration for Station(STA) mode or Access Point (AP) mode | wifi set 2 DEMO_AP 2 12345678 |
wifi get | Get Wi-Fi Configuration | wifi get |
Wi-Fi command parameters information
Parameter | Sub Parameter |
---|---|
bootmode | 1- Access point(AP) mode.2- Station(STA) mode. |
ssid_name | SSID name |
authtype(Security type) | 1 - OPEN Mode. 2 - WPAPSK mode. 3 - WEP mode. 5 - 802.1x authentication MSCHAPV2 mode. |
pwd(password) | Password/passphrase |
username/index | Username if authtype is 802.1x authentication MSCHAPV2 or Key Index if the authtype is WEP. |
Application command parameters information
Command | Details | Example |
---|---|---|
appdemo help | Application Service help command | appdemo help |
appdemo start <demo_id> | Select and start an application demo | appdemo start 1 |
appdemo get | Get the ID of currently running application demo | appdemo get |
appdemo stop | Stop the currently running application demo | appdemo stop |
Application command parameters information
Parameter | Sub Parameter |
---|---|
demo_ID | 1 - WiFi station mode/Access point mode demo.6 - WiFi Provisioning via BLE. 7 - OTA Demo. 8 - SSL Demo. 9 - Ping Demo. 10 - Iperf demo. 11 - SNTP demo. 12 - Serial Chat. 13 - Heart rate profile. 14 - Battery Service. 15 - Proximity Reporter. 16 - Transparent Service. 18 - MQTT Demo. 19 - Certificate Download OTA Demo. |
Application | Description |
---|---|
WiFi station mode/Access point mode demo | Demonstartes the Station Mode or Access Point(AP) mode of WINC3400 |
WiFi Provisioning via BLE | Demonstartes the WiFi provisioning using BLE |
OTA Demo | Demonstartes the OTA firmware upgrade of WINC3400 |
SSL Demo | Demonstrates TCP SSL Client application |
Ping Demo | Demonstrates the Ping test |
Iperf Demo | Demonstrates the iperf application |
SNTP Demo | Demonstrates how to retrieve time information from the time server |
Custom serial Chat Demo | Demonstrates the Custom Serial Chat application using BLE |
Heart Rate Profile Demo | Demonstrates the Heart Rate Profile application using BLE |
Battery Service Demo | Demonstrates the Battery Service application using BLE |
Proximity Reporter Demo | Demonstrates the Proximity Reporter application using BLE |
Transparent Service Demo | Demonstrates the Transparent Service application using BLE |
MQTT Demo | Demonstrates MQTT Application |
WiFi Provisioning Demo | Demonstartes the WiFi provisioning application |
Certificate Download OTA Demo | Demonstartes the Certificate Download OTA Demo |
WiFi BLE Connectionless Gateway Demo | Demonstrates the WiFi BLE connectionless Gateway |
If the user wants to isolate an application, follow the below mentioned steps
For example, the user wants to create an SNTP demo in Socket mode.
-
The SNTP demo uses the WiFi functionalities to get connected with the network. So copy the files "app_wifi.c" and "app_wifi.h" from the path "wireless_apps_winc3400/apps/wifi_bypass_demos/firmware/src" or "wireless_apps_winc3400/apps/wifi_socket_demos/firmware/src" to "src" folder of the new demo project. Then add these files to the project.
-
Now user should copy and add the SNTP application files "app_sntp.c" and "app_sntp.h" from the path "wireless_apps_winc3400/apps/wifi_bypass_demos/firmware/src" or "wireless_apps_winc3400/apps/wifi_socket_demos/firmware/src" to the "src folder of the new demo project.
-
The "app.c" and "app.h" files need to be copied by the user. These files integrate the SNTP application and WiFi functionalities. Copy and add these two files from the same "src" path to the "src" folder of the new demo project.
-
In "app.c", within "APP_Initialize()" function, initialize the sntp application by calling "APP_SntpInitialize(APPWiFiCallback)".
-
In "app.c" file, make sure that, "APP_WiFiTasks(wdrvHandle)" is getting called from the "APP_STATE_WDRV_OPEN" state of "APP_Tasks()" state machine.
-
In the same state machine "APP_Tasks()", within the state "APP_STATE_WDRV_APP_LOOP" , call the sntp application state machine "APP_SntpTasks(handle)".
-
Now follow the steps mentioned in the SNTP demo document to run the SNTP demo using "wifi", "sntp" and "appdemo" commands.
Similarly, for any application demo, take the required application files along with WiFi files and "app" files to create the demo.
For BLE applications, no need to copy the WiFi files. But the user should copy the Ble_Service and Ble_Profile files from the path "wireless_apps_winc3400\apps\wifi_socket_demos\firmware\src\ble".
For example, the user wants to create a new project, say "Heart_rate_demo", then
-
Copy and add the ble_manager files from the path "wireless_apps_winc3400\apps\wifi_socket_demos\firmware\src\ble\ble_services\ble_mgr" to the "Heart_rate_demo\firmware\src\ble\ble_services\ble_mgr" of the new project.
-
Copy and add the Heart rate profile files from the path "wireless_apps_winc3400\apps\wifi_socket_demos\firmware\src\ble\ble_profiles\hr_sensor" to the "Heart_rate_demo\firmware\src\ble\ble_profiles\hr_sensor" of the new project.
-
Copy and add the Heart rate service files from the path "wireless_apps_winc3400\apps\wifi_socket_demos\firmware\src\ble\ble_services\heart_rate" to the "Heart_rate_demo\firmware\src\ble\ble_services\heart_rate" of the new project.
-
Now copy and add the application files "app_heart_rate.c" and "app_heart_rate.h" from "wireless_apps_winc3400\apps\wifi_socket_demos\firmware\src" to the "Heart_rate_demo\firmware\src" of the new project.
-
Copy and add the main application files "app.c" and "app.h" files from "wireless_apps_winc3400\apps\wifi_socket_demos\firmware\src" to the "Heart_rate_demo\firmware\src" of the new project.
-
In "app.c", within "APP_Initialize()" function, initialize the Heart Rate application by calling "APP_BleHeartrateInitialize(APPWiFiCallback)".
-
In "app.c" file, make sure that, "APP_BleHeartrateTasks(wdrvHandle)" is getting called from the "APP_STATE_WDRV_OPEN" state of "APP_Tasks()" state machine.
-
Add the macro "BLE_DEVICE_ROLE=BLE_PERIPHERAL" in the project properties.
-
Now follow the steps mentioned in the "Heart rate demo document" to run the application using "appdemo" command.
Similarly, for any ble application demo, take the required application files, ble_profile files, ble_service files and "app" files to create the demo.
Note:
-
User has to make sure the project path does not exceed windows path limit.
-
User should reset the device before switching the application and unpair the device from the android phone in case of switching BLE application demos.