Skip to content

Latest commit

 

History

History
191 lines (136 loc) · 7.93 KB

File metadata and controls

191 lines (136 loc) · 7.93 KB

PIC32CXBZ2_WBZ45x_BLE_WINC1500_MQTT

"IOT Made Easy!" - This example demonstrates how a user run a MQTTT Client using Third Party Paho software on WINC1500 device using WBZ451 Curiosity board as a host

Devices: | PIC32CXBZ2 | WBZ45x |
Features: | BLE | Wi-Fi |

Back to Main page

⚠ Disclaimer

THE SOFTWARE ARE PROVIDED "AS IS" AND GIVE A PATH FOR SELF-SUPPORT AND SELF-MAINTENANCE. This repository contains example code intended to help accelerate client product development.

For additional Microchip repos, see: https://github.com/Microchip-MPLAB-Harmony

Checkout the Technical support portal to access our knowledge base, community forums or submit support ticket requests.

Contents

  1. Introduction
  2. Bill of materials
  3. Hardware Setup
  4. Software Setup
  5. Harmony MCC Configuration
  6. Run the demo

1. Introduction

This example application performs Wi-Fi provisioning of the WINC1500 using a BLE link. Following a successful connection to an access point and obtaining an IP address, the WINC1500 makes a connection to an MQTT Broker.

Wi-Fi Prov MQTT

This application demonstrates how a user run a MQTT Client using third party Paho software on WINC1500 device and PIC32CXBZ2 / WBZ45x as host device. The user can use "MQTT.fx" third party Mqtt Client application to receive message posted by MQTT Client running on WINC1500 device once it connects to the MQTT broker.

2. Bill of materials

Tools Quantity
WBZ451 Curiosity Evaluation Kit (Rev 3) 1
WINC1500 Xplained Pro 1
XPRO-ADAPTER Click 1
Apple® iPhone 1
Wi-Fi Access Point 1

3. Hardware Setup

  • Connect the WBZ451 Curiosity Evaluation Kit to the Host PC as a USB Device through a Type-A male to micro-B USB cable connected to Micro-B USB (Debug USB) port
  • Connect WINC1500 Xplained Pro and WBZ451 Curiosity board as below
WBZ451 Click connector WBZ451 Pin name/Number WINC1500 Xplained Pro WINC1500 Pin Name/Number
1 PB1 10 CHIP EN
2 PB2 5 RST
3 PA9 15 SPI CS
4 PA8 18 SPI CLK
5 PA10 17 SPI_MISO
6 PA7 16 SPI_MOSI
7 Vcc 20 +3.3V
8 GND 19 GND
15/16 PA2 9 IRQN (In V2 board, connect to 16)
  • WBZ451 Curiosity board can be connected to WINC1500 Xplained Pro using a XPRO-ADAPTER Click as shown below.
    Board
    • The jumper settings in XPRO-ADAPTER click board is as shown above figure. Use Jumpers and Jumper wires to connect the header as mentioned in below table.

      Jumper Connections
      J3.1   to   J4.1
      J3.3   to   J1.5
      J3.5   to   J3.6
      J3.7   to   J3.8
      J3.9   to   J3.10
      J3.11  to   J3.12
      J4.1   to   J3.1
      J4.3   to   J4.4
      J4.6   Open
      J4.8   Open
      J4.10  Open
      J4.12  Open

4. Software Setup

This project has been verified to work with the following versions of software tools:

  • MPLAB X IDE v6.00
  • XC32 Compiler v4.10
  • MPLAB® Code Configurator v5.1.17
  • PIC32CX-BZ_DFP v1.0.107
  • MCC Harmony
    • csp version: v3.13.1
    • core version: v3.11.1
    • wireless_pic32cxbz_wbz: v1.0.0
    • wireless_ble: v1.0.0
    • zlib: v1.2.11
    • wireless_wifi version: v3.6.1
    • dev_packs version: v3.13.1
    • wolfssl: v4.7.0
    • crypto: v3.7.6
    • CMSIS-FreeRTOS version: v10.4.6

Refer Project Manifest present in harmony-manifest-success.yml under the project folder firmware\src\config\default\harmony-manifest-success.yml for more details

  • Any Serial Terminal application like Tera Term terminal application.
    • configure the serial settings as follows:
      • Baud : 115200
      • Data : 8 Bits
      • Parity : None
      • Stop : 1 Bit
      • Flow Control : None

Because Microchip regularly update tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project doesn’t seem to work and version incompatibility is suspected, It is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB Harmony v3 packages, refer to document How to Use the MPLAB Harmony v3 Project Manifest Feature

5. Harmony MCC Configuration

  • The "MCC - Harmony Project Graph" below depicts the harmony components utilized in this project. Harmony Project Graph

  • The system configuration is depicted as follows.
    System DEVCFG1
    System PPS

  • The EIC configuration is depicted as follows.
    EIC

  • The WINC configuration is depicted as follows.
    WINC

  • The SPI Driver configuration is depicted as follows.
    SPI Driver

  • The SERCOM1 SPI configuration is depicted as follows.
    SERCOM1 SPI

  • The SERCOM0 UART configuration is depicted as follows.
    SERCOM0 SPI

  • The PIN configuration is depicted as follows.
    PIN Configuration

  • The BLE Configuration is depicted as follows.
    BLE Configuration

  • The below figure shows configurations used in custom service component. Custom Service

Add the Thirdparty Paho MQTT Software to the project as shown below
paho_mqtt

Note:
It is important to have the porting files "MCHP_winc.c" and "MCHP_winc.h" in the project. These porting files are available only in "wireless_apps_winc1500/apps/wifi_socket_demos/" example project.

6. Run the demo

  • Download the MQTT.fx Third Party Mqtt Client Application and open it on Laptop.

  • Connect the MQTT.fx Application to the MQTT Server - broker.hivemq.com with port 1883.
    MQTTfx_1_settings
    MQTTfx_1

  • Make the MQTT.fx Application susbcribe to Topic MCHP/Sample/a. MQTTfx_1

  • On startup, WBZ451 will Advertize with local name wbz451_winc1500_wiifiProv. Perform Wi-Fi Provisioning using BLE

  • After successfully connecting to an access point and obtaining the IP address, the WINC1500 establishes a connection with the specified MQTT Broker.

  • After connecting to MQTT Server, the MQTT Client on the WINC1500 device shall subscribe to Topic MCHP/Sample/b.
    Teraterm_mqtt1

  • The MQTT Client on the WINC1500 device shall publish the message "Hello" to Topic MCHP/Sample/a.
    Mqtt App Receive

  • Publish message from MQTT.fx Application on the Topic MCHP/Sample/b. Mqtt App Publish

  • The MQTT Client on the WINC1500 device receives the message on the Topic MCHP/Sample/b sent by the MQTT.fx Application running on the laptop. Mqtt App Publish

  • Type Hello from WINC1500 on Tera Term Mqtt Publish WINC1500

  • The MQTT.fx Application will receive the typed message from WINC1500 Mqtt Subscribe

Back to top