2.11 WINC3400 Socket Mode Demo Applications

This example project demonstrates the WINC3400 applications of WiFi and BLE in Socket mode

Description

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.

Downloading and building the application

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 NameDescription
sam_e54_xpro_winc3400.XMPLABX project for SAME54 Xplained Pro Evaluation Kit and WINC3400 Xplained pro
sam_d21_xpro_winc3400.XMPLABX project for SAMD21 Xplained Pro Evaluation Kit and WINC3400 Xplained pro
sam_e54_xpro_winc3400_freertos.XMPLABX project for SAME54 Xplained Pro Evaluation Kit and WINC3400 Xplained pro using FreeRTOS
sam_a5d27_som1_winc3400.XMPLABX project for SAMA5D27 SAMA5D27-SOM1-EK1 Evaluation Kit and WINC1500 WiFi 7 Click board
pic32mz_ef_curiosity_v2_winc3400.XMPLABX project for PIC32MZ EF 2.0 curiosity board and WINC3400 Xplained pro

Setting up SAMXXX Xplained Pro board

  • 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

Setting up PIC32MZ EF 2.0 Curiosity 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

Setting up SAMA5D27-SOM1-EK1 Evaluation Kit

  • 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.

Addtional hardware required

  • SD Card with FAT32 file system

Setting up the SD card

  • 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

Setting up the board

  • Insert the SD card into SDMMC slot (J12).

  • Connect the Debug USB port on the board to the computer using a micro USB cable.

Running the Application

  1. 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)

  2. Open the Terminal application (Ex.:Tera term) on the computer

  3. 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

  4. Use WiFi commands to configure WiFi parameters and use application commands to select the example application.

WiFi Commands Details

CommandDetailsExample
wifi helpWi-Fi Service help commandwifi help
wifi set <bootmode> <ssid_name> <auth_type> <pwd> <username/index>Set Wi-Fi Configuration for Station(STA) mode or Access Point (AP) modewifi set 2 DEMO_AP 2 12345678
wifi getGet Wi-Fi Configurationwifi get

Wi-Fi command parameters information

ParameterSub Parameter
bootmode1- Access point(AP) mode.2- Station(STA) mode.
ssid_nameSSID name
authtype(Security type)1 - OPEN Mode. 2 - WPAPSK mode. 3 - WEP mode. 5 - 802.1x authentication MSCHAPV2 mode.
pwd(password)Password/passphrase
username/indexUsername if authtype is 802.1x authentication MSCHAPV2 or Key Index if the authtype is WEP.

Application command parameters information

CommandDetailsExample
appdemo helpApplication Service help commandappdemo help
appdemo start <demo_id>Select and start an application demoappdemo start 1
appdemo getGet the ID of currently running application demoappdemo get
appdemo stopStop the currently running application demoappdemo stop

Application command parameters information

ParameterSub Parameter
demo_ID1 - 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.

List of Applications

ApplicationDescription
WiFi station mode/Access point mode demoDemonstartes the Station Mode or Access Point(AP) mode of WINC3400
WiFi Provisioning via BLEDemonstartes the WiFi provisioning using BLE
OTA DemoDemonstartes the OTA firmware upgrade of WINC3400
SSL DemoDemonstrates TCP SSL Client application
Ping DemoDemonstrates the Ping test
Iperf DemoDemonstrates the iperf application
SNTP DemoDemonstrates how to retrieve time information from the time server
Custom serial Chat DemoDemonstrates the Custom Serial Chat application using BLE
Heart Rate Profile DemoDemonstrates the Heart Rate Profile application using BLE
Battery Service DemoDemonstrates the Battery Service application using BLE
Proximity Reporter DemoDemonstrates the Proximity Reporter application using BLE
Transparent Service DemoDemonstrates the Transparent Service application using BLE
MQTT DemoDemonstrates MQTT Application
WiFi Provisioning DemoDemonstartes the WiFi provisioning application
Certificate Download OTA DemoDemonstartes the Certificate Download OTA Demo
WiFi BLE Connectionless Gateway DemoDemonstrates the WiFi BLE connectionless Gateway

Steps to isolate/copy individual application(s) from the demo

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.

  1. 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.

  2. 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.

  3. 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.

  4. In "app.c", within "APP_Initialize()" function, initialize the sntp application by calling " APP_SntpInitialize(APPWiFiCallback)".

  5. 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.

  6. In the same state machine " APP_Tasks() ", within the state " APP_STATE_WDRV_APP_LOOP " , call the sntp application state machine "APP_SntpTasks(handle)".

  7. 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.

Steps to isolate/copy individual BLE application(s) from 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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. In "app.c", within "APP_Initialize()" function, initialize the Heart Rate application by calling " APP_BleHeartrateInitialize(APPWiFiCallback)".

  7. 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.

  8. Add the macro "BLE_DEVICE_ROLE=BLE_PERIPHERAL" in the project properties.

    project_properties
  9. 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:

  1. User has to make sure the project path does not exceed windows path limit.

  2. User should reset the device before switching the application and unpair the device from the android phone in case of switching BLE application demos.

Back to top