[M467 | M487] Build a Web Server on a NuMaker IoT Board using CyCloneTCP and FreeRTOS

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

25 Oct 2023, 12:00

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


The CyCloneTCP
CyCloneTCP designed by Oryx Embedded is a IPv4/IPv6 TCP/IP stack for resources constrained microcontroller. Supports rich application protocols and confirms to RFC standards. In this article, let's run a demo which use CyCloneTCP with FreeRTOS on NuMaker IoT boards. Supported boards are:
  • NuMaker-PFM-M487
  • NuMaker-IoT-M487
  • NuMaker-IoT-M467
The currently provided demonstrations are as follows
Picture00.png
Picture00.png (6.26 KiB) Viewed 18477 times
Let's choose web server (HTTP server) in this tutorial. Keil MDK is used to build these demo.


Test Environment
Because the web server demo use DHCP to get IP address, the NuMaker IoT board uses Ethernet to connect to the Wi-Fi AP which has DHCP server. Then PC/laptop also connects to the same Wi-Fi AP via Wi-Fi or Ethernet. The NuMaker IoT board and PC/laptop are on the same local network, which is more convenient for testing.
Picture01.png
Picture01.png (25.7 KiB) Viewed 18477 times

Download Demo Package
  • Enter the URL https://www.oryx-embedded.com/download/ on browser
  • Click Open Source Version to download the whole package
  • Extract the downloaded ZIP file CyCloneTCP_SSL_SSH_IPSEC_CRYPTO_Open_x_x_x.zip to Desktop or the directory you assigned
    Picture02.png
    Picture02.png (60.01 KiB) Viewed 18477 times

Open the Web Server Project
  • Use File Manager to find the Keil project of web server demo for NuMaker IoT Board. The directory is
    • For NuMaker-IoT-M487 .\demo\nuvoton\numaker_iot_m487\http_server_demo\keil
    • For NuMaker-IoT-M467 .\demo\nuvoton\numaker_iot_m467\http_server_demo\keil
  • Then double click on http_server_demo.uvprojx file to launch Keil MDK to open it.
    Picture03.png
    Picture03.png (36.33 KiB) Viewed 18477 times

View and Modify the code
Oryx requests to accept the GPL license term before build the code, so
  • Click the + to expand the Demo Header group
  • Click os_port_config.h to open it
  • Add #define GPL_LICENSE_TERMS_ACCEPTED to os_port_config.h
    Picture04.png
    Picture04.png (65.43 KiB) Viewed 18477 times

Web Server Pages
The root directory of web server is located in the
  • For NuMaker-IoT-M487 .\demo\nuvoton\numaker_iot_m487\http_server_demo\resources\www
  • For NuMaker-IoT-M467 .\demo\nuvoton\numaker_iot_m467\http_server_demo\resources\www
    Picture05.png
    Picture05.png (25.34 KiB) Viewed 18477 times
Before compile the code, the directory will be converted to a res.c by Resource Compiler (.\utils\ResourceCompiler\bin\rc.exe). Then build them into firmware.


Build the Demo Code
  • Select the Project Target is http_server_demo_flash.
  • Click Build icon to build it.
    Picture06.png
    Picture06.png (65.11 KiB) Viewed 18477 times

Program Firmware to Board
  • NuMaker IoT board has Nu-Link-ME (e.g. on NuMaker-IoT-M487)
    The ISW1 switch on Nu-Link-ME, make sure that the no.1, 2, 3 set to ON, and the no.4 set to OFF
    Picture08.png
    Picture08.png (41.56 KiB) Viewed 18477 times
  • NuMaker IoT board has Nu-Link2-ME (e.g. on NuMaker-IoT-M467)
    The ICESW2 switch on Nu-Linke2-ME, make sure that the no.1 & 2 are ON and the no.3 & 4 are OFF.
    Picture09.png
    Picture09.png (33.16 KiB) Viewed 18477 times
  • Plug in USB cable to PC
  • Click Download icon to program firmware
    Picture07.png
    Picture07.png (67.08 KiB) Viewed 18477 times

Open the Terminal
  • Run any terminal tool, such as TeraTerm, Putty, etc. to open a terminal for Nu-Link-ME/Nu-Link2-ME Virtual COM port.
  • Select baud rate to 115200.
    Picture10.png
    Picture10.png (32.93 KiB) Viewed 18477 times
  • PC/laptop connects to Wi-Fi AP via Wi-Fi or Ethernet.
  • NuMaker IoT board connects to Wi-Fi AP via Ethernet.
    Picture11.png
    Picture11.png (14.06 KiB) Viewed 18477 times

Reset and Run
  • Press RESET button on NuMaker IoT board
    Picture13.png
    Picture13.png (70.3 KiB) Viewed 18477 times
  • The terminal shows the running messages. The IP address of NuMaker IoT board is 192.168.100.28
    Picture12.png
    Picture12.png (31.82 KiB) Viewed 18477 times

Visit the Web Page
  • Run browser on PC/laptop then enter the URL http://192.168.100.80
  • The web server on NuMaker IoT board responses the content of home page.
  • The home page shows the network configuration and the page view counter which using SSI feature.
    Picture14.png
    Picture14.png (63.56 KiB) Viewed 18477 times

That's all. Enjoy it. ;)

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 101 guests