3.1.6 Project Setup - RNWF MCC Melody Library Configuration

  1. Selecting RNWF module
    1. Click on Device Resources>Libraries>RNWF module
    2. Add RNWF from Device Resource to Project Resource as illustrated below
      Figure 3-5. Selecting RNWF Module
  2. After adding RNWF to Project Resources, follow the note from RNWF>Software Settings>Select UART as below:
    Figure 3-6. RNWF Select UART
    To follow the configurations mentioned in the above figure (RNWF Select UART), Select UARTx component available in Builder Window and select USART2 from drop-down under UARTx Configurations>Dependency Selector (Scroll to bottom)>UART PLIB Selector as illustrated below:
    Figure 3-7. UARTx in Builder
    Figure 3-8. UART PLIB Selector
    Figure 3-9. UART2 Configuration
    1. Configure UARTx instance specific TX and RX pins referring host MCU data sheet. Hint will be generated in the Notifications [MCC] tab about UARTx pin re-mapping as illustrated below:
      Figure 3-10. Notifications [MCC] Tab
      Note: When using the AVR128DB48 with Curiosity Nano Base for Click boards, configure Port F pins- PF4 and PF5 as UART2 TX and RX pins respectively, as illustrated below:
      Figure 3-11. UART2 Pin Grid View
  3. Using Main PLIB Version

    1. Use "Main" PLIB v3.1.2 or newer with MCC Melody based RNWF02 v2.0.0 driver, to generate main.c appropriately.
    2. Select correct version for the Main PLIB from the drop-down available under the MCC Content Manager and then click Apply as illustrated below
      Figure 3-12. Main PLIB Version
  4. For clock Settings – Select Clock Control (CLKCTRL) from Project Resource>System>Clock Control (CLKCTRL). Configure Clock Control as illustrated below:
    Figure 3-13. Clock Control (CLKCTRL)
    Figure 3-14. CLKCTRL Settings
    Figure 3-15. CLKCTRL Advanced Settings
  5. Configure MCC Melody based RNWF02 driver for different services as below:
    1. Wi-Fi Settings

      Under the Wi-Fi Settings, configure Wi-Fi Modes field by selecting one of the option from available options under the drop-down, as per your application requirements. By default, MCC Melody based Wi-Fi System Service configures DUT for Station mode.

      Figure 3-16. Wi-Fi Settings: StationMode

      Wi-Fi Station Mode

      1. SSID: Configure SSID field with Wi-Fi Access Point/Network Name at home or office to connect
      2. Security Type: Select the appropriate Wi-Fi security protocol from the options available in the Security Type drop-down menu.
      3. Passphrase: Enter the Wi-Fi Access Point/Network password in the Passphrase field
      4. Auto Connect: Enables a device to automatically establish a connection to a Wi-Fi network.
      5. Wi-Fi-Callback Handler: Responsible for configuring the callback function name to manage Wi-Fi service-specific events, such as Wi-Fi STA device connections and disconnections, DHCP resolution, and Wi-Fi scan indications.
      6. NTP Client: Enabling NTP Client exposes respective client mode configurations. For more details on NTP client and DNS client configurations, refer to the AT Command Specification document available on the RNWF02 Add-on Board Product Page.
      Figure 3-17. Advanced Settings with Station Mode

      Advanced Settings with Station Mode

      When the Device Under Test (DUT) is in Wi-Fi "Station Mode," it can be further configured with the following settings if "Advanced Settings" is enabled:

      1. Country Code (Regulatory Domain/Region): The available options are: i) GEN ii) USA iii) EMEA. By default, "GEN" is selected. However, users will need to utilize the WiFi-Callback Handler to set or configure the Device Under Test (DUT) with the desired regulatory domain
      2. Channel: the network must reside on (or select ‘0’ for any)
      3. BSSID: ID of the network to connect
      4. Ping: After enabling, user will be prompted to enter a device's IP address to ping

      5. Configuring for Power Save Mode, Connection timeout duration and so on.,

      6. WiFi-BT CoEx: Implementation of Bluetooth/Wi-Fi coexistence, compliant with the recommendations in IEEE 802.15.2. For more details, refer to the AT Command Specification document available on the RNWF02 Add-on Board Product Page
          • CoEx Interface Type: Drop-down to select Interface type
            • 3-wire interface (BT_Act, BT_Prio, WLAN_Act)
            • 2-wire interface (BT_Prio, WLAN_Act)
        1. CoEx WLAN RX over BT: Select to give WLAN RX higher priority
        2. CoEx WLAN TX over BT: Select to give WLAN TX higher priority
        3. CoEx Antenna Mode: Select Co-Ex antenna mode. Available modes are:
          • Dedicated antenna
          • Shared antenna
      Figure 3-18. Wi-Fi Settings: SoftAPmode
      Wi-Fi Soft-AP-Mode
      1. SSID: Configure SSID field with a DUT's Soft-AP name - for allowing other third party devices to connect, for example, Laptop(s)/Mobile phone(s)
      2. Security Type: Select applicable Wi-Fi security protocol from options available under Security Type drop-down
      3. Passphrase: Enter DUT's Wi-Fi Soft-AP's password in the Passphrase field
      4. Wi-Fi-Callback Handler: Configures callback function name to handle Wi-Fi service specific events (for example, Wi-Fi STA device connection and disconnection, DHCP resolution, Wi-Fi Scan indication)
      5. NTP Client: Enabling NTP Client exposes respective client mode configurations. For more details on NTP client and DNS client configurations, refer to the AT Command Specification document available on the RNWF02 Add-on Board Product Page

      Advanced Settings with Soft-AP-Mode

      When the DUT is in Wi-Fi "Soft-AP Mode", it can be further configured with the following settings if "Advanced Settings" is enabled:

      1. Country Code (Regulatory Domain/Region): Available options are
        • GEN
        • USA
        • EMEA
        By default, "GEN" is selected, however user needs to use WiFi-Callback Handler to set or configure the DUT with this regulatory domain
      2. Ping: On enabling, user will be prompted to enter a device's IP address to ping
      3. Channel: channel on which to set up the DUT’s network/Soft-AP

      4. WiFi-BT CoEx: Implementation of Bluetooth/Wi-Fi coexistence, compliant with the recommendations in IEEE 802.15.2. For more details, refer to the AT Command Specification document available on the RNWF02 Add-on Board Product Page
        1. CoEx Interface Type: Drop-down to select Interface type
          • 3-wire interface (BT_Act, BT_Prio, WLAN_Act)
          • 2-wire interface (BT_Prio, WLAN_Act)
        2. CoEx WLAN RX over BT: Select to give WLAN RX higher priority
        3. CoEx WLAN TX over BT: Select to give WLAN TX higher priority
        4. CoEx Antenna Mode: Select Co-Ex antenna mode. Available modes are:
          • Dedicated antenna
          • Shared antenna
      Figure 3-19. Wi-Fi Settings: ProvisionMode
      Wi-Fi Provision Mode:
      1. Provision Method: provides a drop-down to select Wi-Fi Provisioning methods, available options are
        • Mobile App
        • Web Server
      2. SSID: Configure SSID field with a DUT's Provision mode AP name - for allowing other third party devices to connect, for example, Laptop(s)/Mobile phone(s)
      3. Security Type: Select applicable Wi-Fi security protocol from options available under Security Type drop-down
      4. Passphrase: Enter DUT's Wi-Fi Provision mode AP's password in the Passphrase field
      5. Wi-Fi-Callback Handler: Configures callback function name to handle Wi-Fi service specific events (for example, Wi-Fi STA device connection and disconnection, DHCP resolution, Wi-Fi Scan indication)
      6. Provision Callback Handler: Configures callback function name for Wi-Fi Provisioning states (Applicable only if selected Wi-Fi Mode is ProvisionMode)
      7. NTP Client: Enabling NTP Client exposes respective client mode configurations. For more details on NTP client and DNS client configurations, refer to the AT Command Specification document available on the RNWF02 Add-on Board Product Page

      Advanced Settings with Provision Mode

      When the DUT is in Wi-Fi "Provision Mode", it can be further configured with the following settings, if "Advanced Settings" is enabled:
      1. Country Code (Regulatory Domain/Region): Available options are
        • GEN
        • USA
        • EMEA
        By default, "GEN" is selected, however user needs to use WiFi-Callback Handler to set or configure the DUT with this regulatory domain
      2. Ping: On enabling, user will be prompted to enter a device's IP address to ping
      3. WiFi-BT CoEx: Implementation of Bluetooth/Wi-Fi coexistence, compliant with the recommendations in IEEE 802.15.2. For more details, refer to the AT Command Specification document available on the RNWF02 Add-on Board Product Page
        1. CoEx Interface Type: Drop-down to select Interface type
          • 3-wire interface (BT_Act, BT_Prio, WLAN_Act)
          • 2-wire interface (BT_Prio, WLAN_Act)
        2. CoEx WLAN RX over BT: Select to give WLAN RX higher priority
        3. CoEx WLAN TX over BT: Select to give WLAN TX higher priority
        4. CoEx Antenna Mode: Select Co-Ex antenna mode. Available modes are:
          • Dedicated antenna
          • Shared antenna
    2. OTA DFU Settings

      Optionally, users can add, enable and configure SPIx PLIB instance from available "Device Resources" section as SPI Host in SPI Mode 0 to use external Flash for storing OTA firmware image. For host application logs, add and configure additional UARTx PLIB and Driver instance. For more details on configuration of these drivers and PLIBs, follow Builder window in MCC Melody for (AVR128_OTA_demo).

      Figure 3-20. OTA DFU Settings
      This section allows OTA DFU service configuration as mentioned below:
      • Enable OTA Configs: Toggle to enable/disable OTA DFU settings. If disabled, OTA system service source and header files will not be generated
      • OTA Tunnel Selection: Tunnel to receive the OTA server and Image details. Drop-down to select OTA Tunnel. Currently supports TCP only
      • OTA Tunnel Port: Configure OTA server port
      • OTA Callback Handler: Configure callback function name to handle OTA service events (for example, downloading firmware binary from OTA server, erasing RNWF Flash before programming it with newly downloaded firmware image from server and perform RNWF Reset/Reboot with new firmware image)
      • DFU TX Pin: Configure DFU UART TX pin name
      • DFU RX Pin: Configure DFU UART RX pin name
      Note: Configure chip-select (CE) for RNWF Flash as illustrated in pin settings (see Figure 3-22)
      Figure 3-21. Project Resources: Pins
      Figure 3-22. Pin Settings
      Note: Configure Port E input pin - PE1 as MCLR_N for DFU as illustrated below:
      Figure 3-23. Pin Grid View
    3. Cloud Configuration Settings
      Figure 3-24. Cloud Configuration Settings
      Figure 3-25. Cloud Configuration Settings
      This section allows Cloud service configuration as mentioned below:
      • Enable Cloud Configs: Toggle to enable/disable cloud configuration settings. If disabled, cloud system service source and header files will not be generated
      • Cloud/MQTT Debug Logs: Toggle to enable/disable Cloud/MQTT debug logs
      • Cloud URL: Configure Cloud provider endpoint / MQTT Broker URL
      • Cloud Port: Configure Cloud/MQTT port
      • Azure DPS: Toggle to enable/disable Azure DPS option (applicable only when Azure endpoint is used)
        • Scope ID: Provide Scope ID from Azure IoT Central portal for registered device
        • Device Template: Configure Azure DPS specific device template
        Note:

        'Azure DPS' feature is deprecated in the Melody Based MQTT System service (latest release v2.0.0). It is still available in the Melody Based MQTT System service (release v1.0.0)

      • User Name and Password: Configure cloud client credentials
      • Client ID: Device ID registered with cloud provider
      • MQTT Callback Handler: Configure Callback function name to handle MQTT specific service events (for example, MQTT Client-Broker connection/disconnection, handling periodic/event based telemetry)
      • Publish: Toggle to enable/disable MQTT Publish option. If enabled, it offers related configurations such as Publish Topic Name, Pub QoS, Retain Flag.
      • Keep Alive: Toggle to enable/disable Keep Alive MQTT specific option.
        • Keep Alive Interval: Configure the field in the range of 1-1000 (in seconds)
      • Subscribe: Toggle to enable/disable MQTT Subscribe option. If enabled, it provides subscribe specific configurations such as Total Subscribe Topics, Table for Subscribe Topics, Sub. QoS
      • TLS: TLS behavior is controlled by setting parameters in a TLS configuration. Toggle to enable/disable TLS Configuration option. If enabled, it will further prompt to enter the parameters, that include:
        • Peer Authentication: Toggle to enable/disable authentication of the peer’s certificate chain. With this setting, an appropriate certificate file name must be passed to the Server Certificate parameter.
        • Server Certificate
        • Device Certificate
        • Device Key
        • Device Key Password
        • Server Name
        • Peer Domain Verify: Toggle to enable/disable verification of the peer’s certificate name. With this setting, an appropriate name must be passed to the Domain Name parameter.
        • Domain Name
      Note:
      1. Peer Authentication and Peer Domain Verify parameters are part of firmware release v2.0.0. As per recommended setting, they are enabled by default.

      2. For more details, refer to the RNWF02 Supplemental User Guide available in the RNWF02 Firmware and Release Notes v2.0.0 on the RNWF02xx Silicon Product Page.
    4. Net Sock Settings
      Figure 3-26. Net Sock Settings
      Figure 3-27. Net Sock Settings: TLS
      This section allows Net Sock service configuration as mentioned below:
      • Enable NetSock Configs: Toggle to enable/disable Net Sock configuration settings. If disabled, Net Sock system service source and header files will not be generated
      • Currently, NetSock Service supports 20 Non-TLS and 2 simultaneous TLS socket instances.
      • Total Sockets: Configure this field in the range of 1-2.
      • Socket Callback Handler: Configure callback function name to handle Net Sock service specific events (for example, Socket connection/disconnection, handling socket read/write events and notifying an error to the application)
      • Server/Client Mode Selection: Toggle to ON state will enable Server and toggle to OFF will enable Client mode
      • Socket IP Protocol Version: The protocol to use, to open a new socket - IPv4, IPv6 Global/Local
      • Server Address: IP/Domain Select: This allows to configure Server address in the form of either IP Address or Domain Name
      • Server Domain: Will be visible only if Server Address: IP/Domain Select is toggled ON. This accepts Domain Name
      • Server IP and Port: Configure these fields with respective server details
      • Protocol: Drop-down to select an underlying Network Layer protocol. Available options:
        • TCP
        • UDP
      • TLS: TLS behavior is controlled by setting parameters in a TLS configuration. Toggle to enable/disable TLS Configuration option. If enabled, it will further prompt to enter details as below:
        • Peer Authentication: Toggle to enable/disable authentication of the peer’s certificate chain. With this setting, an appropriate certificate file name must be passed to the Server Certificate parameter.
        • Server Certificate
        • Device Certificate
        • Device Key
        • Device Key Password
        • Server Name
        • Peer Domain Verify: Toggle to enable/disable verification of the peer’s certificate name. With this setting, an appropriate name must be passed to the Domain Name parameter.
        • Domain Name
      Note:
      1. Peer Authentication and Peer Domain Verify parameters are part of firmware release v2.0.0. As per recommended setting, they are enabled by default.

      2. For more details, refer to the RNWF02 Supplemental User Guide available in the RNWF02 Firmware and Release Notes v2.0.0 on the RNWF02xx Silicon Product Page.