[M467 | M487] Build a Web Server on a NuMaker IoT Board using CyCloneTCP and FreeRTOS
Posted: 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:
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.
Download Demo Package
Open the Web Server Project
View and Modify the code
Oryx requests to accept the GPL license term before build the code, so
Web Server Pages
The root directory of web server is located in the
Build the Demo Code
Program Firmware to Board
Open the Terminal
Reset and Run
Visit the Web Page
That's all. Enjoy it.
[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
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.
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
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.
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
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
Build the Demo Code
- Select the Project Target is http_server_demo_flash.
- Click Build icon to build it.
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 - 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. - Plug in USB cable to PC
- Click Download icon to program firmware
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.
- PC/laptop connects to Wi-Fi AP via Wi-Fi or Ethernet.
- NuMaker IoT board connects to Wi-Fi AP via Ethernet.
Reset and Run
- Press RESET button on NuMaker IoT board
- The terminal shows the running messages. The IP address of NuMaker IoT board is 192.168.100.28
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.
That's all. Enjoy it.