[Visit https://www.nuvoton.com/iot_startup for more IoT solutions]
The CyCloneTCP
CyCloneTCP, designed by Oryx Embedded, is an IPv4/IPv6 TCP/IP stack tailored for resource-constrained microcontrollers. It supports rich application protocols and complies with RFC standards. This article focuses on running a demo that utilizes CyCloneTCP with FreeRTOS on NuMaker IoT boards, specifically supporting the following boards:
- NuMaker-PFM-M487
- NuMaker-IoT-M487
- NuMaker-IoT-M467
Prerequisite
Hardware
- A NuMaker-IoT-M467 board
- One or Two LAN cables
- A Micro USB cable
- A Wi-Fi Router with LAN
- Keil MDK - Keil MDK v5 or later version
- Terminal Tool - Putty, Realterm, or TeraTerm, etc.
- SNMP Tool - The Paessler SNMP Tester, a free SNMP tool https://www.paessler.com/tools/snmptester
The SNMP agent demo utilizes DHCP for obtaining an IP address, enabling the NuMaker IoT board to establish an Ethernet connection with the Wi-Fi Router hosting the DHCP server. Similarly, the PC/laptop establishes a connection to the same Wi-Fi Router using either Wi-Fi or Ethernet. Consequently, both the NuMaker IoT board and PC/laptop are part of the same local network, facilitating convenient testing procedures.
The Steps to Build the Demo Project
Download the Demo Package
- Access the URL https://www.oryx-embedded.com/download/ in your web browser
- Click on the "Open Source Version" link to download the complete package.
- Extract the downloaded ZIP file, named CyCloneTCP_xxx_..._Open_x_x_x.zip, to either your Desktop or a directory of your choice.
Open the SNMP Agent Project
- Utilize the File Manager to locate the Keil project for SNMP agent demo designed for the NuMaker-IoT-M467 board. The directory path is .\demo\nuvoton\numaker_iot_m467\snmp_agent_demo\keil
- Subsequently, double-click on the snmp_agent_demo.uvprojx file to initiate the Keil MDK and open the project.
View and Modify the Demo Code
Prior to building the code, Oryx requests acceptance of the GPL license terms.
- Expand the Demo Header group by clicking on the "+" symbol.
- Open the os_port_config.h file by clicking on it.
- In the os_port_config.h file, add the following line:#define GPL_LICENSE_TERMS_ACCEPTED
Next, let's examine a portion of the code where some information will be used later.
- Expand the Demo Sources group by clicking on the "+" symbol.
- Open the main.c file by clicking on it.
- The default setting is enabled DHCP to get IP address via Ethernet
- Scroll down source code in main.cpp and note the user context.
user_md5_none- Authentication Protocol is MD5, key is authkey1
- Private Protocol is none.
- Authentication Protocol is MD5, key is authkey1
- Private Protocol is DES, key is privkey1
- Select the Project Target is snmp_agent_demo_flash
- Click Build icon to build it
Program Firmware to Board via Nu-Link2-ME
- The ICESW2 switch on Nu-Linke2-ME
- The no.1 & 2 are ON
- The no.3 & 4 are OFF
- Plug in USB cable to PC or Laptop
- Click Download icon to program firmware
The Steps to Run the Demo
Open the Terminal
- Run any terminal tool, such as TeraTerm, Putty, etc. to open a terminal for Nu-Link2-ME Virtual COM port.
- Select baud rate to 115200.
- The PC or laptop connects to Wi-Fi router via Wi-Fi or Ethernet.
- The NuMaker-IoT-M467 board connects to Wi-Fi router via Ethernet
Restart NuMaker-IoT-M467 Board
- To view the boot message, push RESET button on NuMaker-IoT-M467 board. The message shows on terminal tool.
- In the demo, the board has the IP address 192.168.100.28
Configure and Run SNMP Tool
- If PC has multiple network interfaces, select the same network domain one. In the demo, select 192.168.100.41.
- Device IP set to 192.168.100.28 for NuMaker-IoT-M467 board. Port is 161 by default.
- Try SNMPV2c first, it is non-secure.
- Community is public by default.
- Select Read Device Uptime.
- Click Start to get information from Device.
- Get the uptime information.
- Try SNMPv3, it needs to set keys
- SNMP User set to usr-md5-none
- Select Authentication to MD5
- Password set to authkey1
- Click Start to get information from Device.
- Get the uptime information.
- If authentication protocol or password are incorrect, it shows authentication failure.
- Try another SNMPv3
- SNMP User set to usr-md5-des
- Select Authentication to MD5
- Password set to authkey1
- Select Encryption to DES
- Encryption Key set to privkey1
- Click Start to get information from Device.
- Get the uptime information.
That all. Enjoy it.