6.2.2 Running the Application

  1. Mount the AVR128DB48 Curiosity Nano host board and the RNWF02 Add On Board on Curiosity Nano base board at respective headers. For more details about the boards placement in the Curiosity Nano base, see Figure 6-1.
  2. Connect the debugger USB port on the AVR128DB48 Curiosity Nano board to computer using a micro USB cable
  3. Setup a TCP client on a test PC, following are the steps to configure TCP client using Packet Sender tool.
    1. Download and Install the Packet Sender tool on a test PC.
    2. Connect the test PC to the same Home AP which will be used later in Step 5 to configure device in the STA mode
    3. Open the installed Packet Sender tool and open the settings through File>Settings as illustrated in Packet Sender-Settings
    4. Select the Persistent TCP Connection check box to enable persistent option and click OK
      Figure 6-9. Packet Sender Settings
  4. Open the project and launch MCC with Melody Content Manager Tool
  5. Configure Home-AP credentials for STA mode, using the Wi-Fi settings configuration. For more details about the Wi-Fi settings configuration, See Figure 3-14.
  6. Configure TCP Server details such as port number at which the server would be listening, For more details about the Net Sock settings configuration, See Figure 3-22
  7. Generate the code as illustrated below.
    Figure 6-10. Generating the Code
  8. Build and program the code to the hardware using MPLAB X IDE
    Figure 6-11. Programming the Board
  9. Open the Terminal application (for example, Tera Term or PuTTY) on the PC
  10. Connect to the host board COM port and configure the serial settings as follows:
    1. Baud: 115200
    2. Data: 8 Bits
    3. Parity: None
    4. Stop: 1 Bit
    5. Flow Control: None
  11. Press the SW0 (Soft Reset) button on the host board, see Figure 6-1.
  12. As the board boots up, it will connect to Home-AP and print the IP address obtained.
  13. The device's DHCP IP address and port number are printed in device console, use the same details as TCP server IP address and port number in Step 14.
    Figure 6-12. TCP Server - Serial Logs
  14. In the Packet Sender, set the address to the device's IP address (for example: 172.31.98.219) and Port to the port number (for example: 6666) obtained in the previous Step 13 and click Send button to establish TCP connection with TCP server running on the device
    Figure 6-13. Packet Sender Connect Settings
  15. After establishing a successful TCP server-client connection, the TCP Server application on the device will keep waiting for the incoming messages, once received it then sends them back to the connected client.
    Figure 6-14. Packet Sender - Send Message
    Figure 6-15. TCP Server - Message Serial Logs