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-4. Selecting RNWF Module
  2. After adding RNWF to Project Resources, follow the note from RNWF>Software Settings>Select UART as below:
    Figure 3-5. 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-6. UARTx in Builder
    Figure 3-7. UART PLIB Selector
    Figure 3-8. 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-9. 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-10. UART2 Pin Grid View
  3. For clock Settings – Select Clock Control (CLKCTRL) from Project Resource>System>Clock Control (CLKCTRL). Configure Clock Control as illustrated below:
    Figure 3-11. Clock Control (CLKCTRL)
    Figure 3-12. CLKCTRL Settings
    Figure 3-13. CLKCTRL Advanced Settings
  4. Configure MCC Melody based RNWF02 driver for different services as below:
    1. Wi-Fi Settings:
      Figure 3-14. Wi-Fi Settings: StationMode
      Figure 3-15. Wi-Fi Settings: SoftAPmode
      Figure 3-16. Wi-Fi Settings: ProvisionMode
      This section allows Wi-Fi service configuration as mentioned below:
      • Wi-Fi Modes: Drop-down to select Wi-Fi modes. Available options are:
        • StationMode
        • ProvisionMode
        • SoftAPmode
      • Provision Method: Drop-down to select Wi-Fi Provisioning method. Available options are:
        • Mobile App
        • Web Server
      • SSID: Wi-Fi Access Point/Network Name
      • Passphrase: Wi-Fi Access point/Network password
      • Security Type: Wi-Fi security protocol
      • Provision Callback Handler: Configure callback function name for Wi-Fi Provisioning states (Applicable only if selected Wi-Fi Mode is ProvisionMode)
      • WiFi-Callback Handler: Configure callback function name to handle Wi-Fi service specific events (for example, Wi-Fi STA connection and disconnection, DHCP resolution, Wi-Fi Scan indication)
    2. OTA DFU Settings
      Figure 3-17. 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-19)
      Figure 3-18. Project Resources: Pins
      Figure 3-19. Pin Settings
      Note: Configure Port E input pin - PE1 as MCLR_N for DFU as illustrated below:
      Figure 3-20. Pin Grid View
    3. Cloud Configuration Settings
      Figure 3-21. 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 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
      • 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: Toggle to enable/disable TLS Configuration option. If enabled, it will further prompt to enter details as below:
        • Server Certificate
        • Device Certificate
        • Device Key
        • Device Key Password
        • Server Name
        • Domain Name
    4. Net Sock Settings
      Figure 3-22. Net Sock Settings
      Figure 3-23. 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
      • 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: Toggle to enable/disable TLS Configuration option. If enabled, it will further prompt to enter details as below:
        • Server Certificate
        • Device Certificate
        • Device Key
        • Device Key Password
        • Server Name
        • Domain Name