[M467] The SNMP Agent on NuMaker-IoT-M467 using CyCloneTCP and FreeRTOS

Post Reply
morgandu
Posts: 45
Joined: 28 Apr 2017, 22:47

16 Apr 2024, 11:30

[For further inquiries, please e-mail to shchen2@nuvoton.com]
[Visit https://www.nuvoton.com/iot_startup for more IoT solutions]


The CyCloneTCP

CycloneTCP-ipv4-ipv6-osi-model.png
CycloneTCP-ipv4-ipv6-osi-model.png (12.38 KiB) Viewed 4557 times

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
The currently available demonstrations include the SNMP agent, which we will select for this tutorial. We will use Keil MDK to build the demo.

Picture1.png
Picture1.png (64.8 KiB) Viewed 4557 times


Prerequisite

Hardware
  • A NuMaker-IoT-M467 board
    Picture2.png
    Picture2.png (108.72 KiB) Viewed 4557 times
  • One or Two LAN cables
  • A Micro USB cable
    Picture3.png
    Picture3.png (56.36 KiB) Viewed 4557 times
  • A Wi-Fi Router with LAN
Software Test Environment

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.
Picture4.png
Picture4.png (134.22 KiB) Viewed 4557 times

The Steps to Build the Demo Project

Download the Demo Package
  1. Access the URL https://www.oryx-embedded.com/download/ in your web browser
  2. Click on the "Open Source Version" link to download the complete package.
  3. Extract the downloaded ZIP file, named CyCloneTCP_xxx_..._Open_x_x_x.zip, to either your Desktop or a directory of your choice.
Picture5.png
Picture5.png (51.04 KiB) Viewed 4557 times

Open the SNMP Agent Project
  1. 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
  2. Subsequently, double-click on the snmp_agent_demo.uvprojx file to initiate the Keil MDK and open the project.
Picture6.png
Picture6.png (35.26 KiB) Viewed 4557 times

View and Modify the Demo Code

Prior to building the code, Oryx requests acceptance of the GPL license terms.
  1. Expand the Demo Header group by clicking on the "+" symbol.
  2. Open the os_port_config.h file by clicking on it.
  3. In the os_port_config.h file, add the following line:#define GPL_LICENSE_TERMS_ACCEPTED
Picture7.png
Picture7.png (59.73 KiB) Viewed 4557 times

Next, let's examine a portion of the code where some information will be used later.
  1. Expand the Demo Sources group by clicking on the "+" symbol.
  2. Open the main.c file by clicking on it.
  3. The default setting is enabled DHCP to get IP address via Ethernet
Picture8.png
Picture8.png (86.09 KiB) Viewed 4557 times
  1. 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.
    user_md5_des
    • Authentication Protocol is MD5, key is authkey1
    • Private Protocol is DES, key is privkey1
    Picture9.png
    Picture9.png (83.22 KiB) Viewed 4557 times
  2. Select the Project Target is snmp_agent_demo_flash
  3. Click Build icon to build it
Picture10.png
Picture10.png (85.61 KiB) Viewed 4557 times

Program Firmware to Board via Nu-Link2-ME
  1. The ICESW2 switch on Nu-Linke2-ME
    • The no.1 & 2 are ON
    • The no.3 & 4 are OFF
    Picture11.png
    Picture11.png (166.84 KiB) Viewed 4557 times
  2. Plug in USB cable to PC or Laptop
  3. Click Download icon to program firmware
Picture12.png
Picture12.png (85.63 KiB) Viewed 4557 times

The Steps to Run the Demo

Open the Terminal
  1. Run any terminal tool, such as TeraTerm, Putty, etc. to open a terminal for Nu-Link2-ME Virtual COM port.
  2. Select baud rate to 115200.
    Picture14.png
    Picture14.png (36.37 KiB) Viewed 4557 times
  3. The PC or laptop connects to Wi-Fi router via Wi-Fi or Ethernet.
  4. The NuMaker-IoT-M467 board connects to Wi-Fi router via Ethernet
Picture13.png
Picture13.png (78.56 KiB) Viewed 4557 times

Restart NuMaker-IoT-M467 Board
  1. To view the boot message, push RESET button on NuMaker-IoT-M467 board. The message shows on terminal tool.
  2. In the demo, the board has the IP address 192.168.100.28
Picture15.png
Picture15.png (45.98 KiB) Viewed 4557 times

Configure and Run SNMP Tool
  1. If PC has multiple network interfaces, select the same network domain one. In the demo, select 192.168.100.41.
  2. Device IP set to 192.168.100.28 for NuMaker-IoT-M467 board. Port is 161 by default.
  3. Try SNMPV2c first, it is non-secure.
  4. Community is public by default.
  5. Select Read Device Uptime.
  6. Click Start to get information from Device.
  7. Get the uptime information.
Picture16.png
Picture16.png (63.87 KiB) Viewed 4557 times
  1. Try SNMPv3, it needs to set keys
  2. SNMP User set to usr-md5-none
  3. Select Authentication to MD5
  4. Password set to authkey1
  5. Click Start to get information from Device.
  6. Get the uptime information.
  7. If authentication protocol or password are incorrect, it shows authentication failure.
Picture17.png
Picture17.png (84.97 KiB) Viewed 4557 times
  1. Try another SNMPv3
  2. SNMP User set to usr-md5-des
  3. Select Authentication to MD5
  4. Password set to authkey1
  5. Select Encryption to DES
  6. Encryption Key set to privkey1
  7. Click Start to get information from Device.
  8. Get the uptime information.
Picture18.png
Picture18.png (65.25 KiB) Viewed 4557 times

That all. Enjoy it. ;)

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest