6.1.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 server on a test PC, following are the steps to configure TCP server using Packet Sender tool.
    1. Download and Install 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. Specify the TCP server listening port number (for example: 6666) and use the same server port number in Step 6.
    5. Enable persistent connection by selecting the Persistent TCP Connection check box
    6. The Packet Sender application banner illustrates the TCP server IP address (for example: 172.31.99.99) hosted on the test PC, use this IP address as the TCP Server IP in Step 6.
      Figure 6-4. 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 TCP server IP address and port. For more details about the Net Sock settings configuration, See Figure 3-22
  7. Generate the code as illustrated below.
    Figure 6-5. Generating the Code
  8. Build and program the code to the hardware using MPLAB X IDE
    Figure 6-6. 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. The board will establish a connection with configured TCP Server and print a success message. Once the TCP client-server connection is successful, the application will continue listening on the socket for incoming messages and then write them back to the server.
    Figure 6-7. TCP Client - Serial Logs
    Figure 6-8. Python TCP Server Logs