Revision as of 10:12, 25 February 2021 by Registered User
Under construction.png Coming soon

1. Introduction

Azure RTOS NetX Duo is a dual IPv4 and IPv6 TCP/IP network stack designed specifically for deeply embedded, real-time, and IoT applications. It comes with different set of features. Alongside the TCP/IP IPv4/IPv6 network stack, it provides a crypto library implementing the standard crypto and hash methods and a TLS/DTLS library to support secure network connections.

NetX Duo Overview


  • NetX Duo core offers a full TCP/IP IPv4IPV6 compliant stack with 3 types of API: TCP/IP, UDP/IP and RAW API.
  • Crypto Core implements the common crypto cipher suites and hashing algorithms useful for securing connections and exchanging encrypted data: AES, 3DES, HMAC, RSA, SHA1, SHA224, SHA256, SHA384, SHA512, MD5, HMAC-SHA1… (Each algorithm has its own implementation file .c and header file .h which facilitate the selection and the integration of the required algorithms by the applications).
  • TLS core implements the secure connection API. Based on both the Crypto core and NetX Duo Core, it supports the TLS and DTLS protocols with their different variants. (TLS 1.0 TLS 1.2, TLS 1.3)

It also supports the X509 public signed certificates protocol.

  • Addons protocols are a pre-supported set of network applicative protocols that ease the integration of the networking feature in the end user application. The main supported protocols are the following:

DHCP, DNS, mDNS, HTTP, HTTPS, FTP, TELNET, MQTT, SMTP, POP3, SNTP, SNMP etc...

Further details are available in the NetX Duo official documentation

NetX Duo folders are organized as explained below:

NetX Duo Folders


2. STM32 Integration

NetX Duo can run on any networking HW, like Ethernet IPs and WiFi modules, cellular modems… In the context of the STM32Cube, only the following HW are supported:

  • Ethernet: Currently any STM32 board that provides an Ethernet IP, is using the Ethernet PHY microchip LAN874X (driver under Drivers/BSP/Components In the STM32Cube H7 package).


Info white.png Information
The NetX requires the Zero-copy features that is currently supported only in by the STM32H7 HAL_Eth driver.



  • WiFi: this is very specific support, as it will be focused only on WiFi modules supporting the bypass mode

NetX Duo requires a low-level driver to interact between the physical layer already chosen and the NetX Duo core requests (Initialize, transmit data, receive data).

NetX Duo Low Layer Interfacing

It is an interface, on top of the HAL Ethernet driver, which should be provided as part of the NetX Duo source code with possibility to tune it via configuration file.

NetX Duo Low Layer Files


  • nx_stm32_eth_config_template.h: a template config header file to tune the corresponding driver for specific STM32 MCU/Board. This file should be copied in the application source tree and renamed to nx_stm32_eth_driver.h then customized according to the driver needs.
  • nx_stm32_*_driver.h: the driver header file it contains the driver defines and data structure.
  • nx_stm32_*_driver_config_template.h: an application level config file that allows uses to tune some options related to the driver, a template file is provided in the driver source tree as reference.
  • nx_stm32_*_driver.c: it is referenced directly by the application and may be different between STM32 series depending on the supported features.

It is not the final version; it will be developed to add interrupt mode with the actual polling mode.

  • nx_stm32_xxx_driver_template.c/.h: an empty interface that can be used to implement a new custom driver.


Warning white.png Warning
The WiFi driver cannot be currently used on the STM32H7 families, because the bypass mode is not implemented yet. It will be implemented in a future release.


After low-level configuration, it is called in application code when IP instance is created:

  /* Create an IP instance by linking the ux network driver */
  ret = nx_ip_create(&EthIP, "NetX IP Instance 0", 
                                NULL_IP_ADDRESS,  NULL_IP_ADDRESS, 
                               &EthPool,
                               _ux_network_driver_entry,
                               web_app_pointer, 
                               IP_MEMORY_SIZE, DEFAULT_PRIORITY);

2.1. Known Limitations

  • The support of BSD API is not full-compliant, this may impact the portability of legacy applications. More details are in the official NetX Duo official documentation

3. How To Use

The main APIs needed to use the NetX Duo are described in table below: (more details and full API description are available in NetX Duo official documentation)

Function Name Short Description
nx_tcp_socket_create( ) Create a TCP socket
nx_udp_socket_create( ) Create a UDP socket
nx_tcp_server_socket_listen( ) Setup TCP socket to listen
nx_udp_socket_bind( ) Bind UDP socket to the PORT
nx_tcp_server_socket_accept( ) Accept a TCP remote client socket connection
nx_tcp_socket_receive( ) Receive a packet from a TCP remote client
nx_udp_socket_receive( ) Receive a packet from a UDP remote client
nx_tcp_socket_disconnect( ) Disconnect the TCP server socket
nx_tcp_server_socket_unaccept( ) Reject the TCP server socket
nx_tcp_server_socket_relisten( ) Setup server socket for listening again

The main steps to use the NetX Duo are:

  • First, initialize nx_system from the tx_application_define function, then create a pool (named ETH_pool in the next example).


    NX_PARAMETER_NOT_USED(first_unused_memory);

    /* Initialize the NetX system.  */
    nx_system_initialize();

    /* Create a packet pool.  */
    status = nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", SAMPLE_PACKET_SIZE,
                                   (UCHAR *)sample_pool_stack , sample_pool_stack_size);


  • Then, create and configure an IP instance which belongs to pool already created.
  • Enable the needed NetX Duo components depending on the target application:
Function Name Short Description
nx_arp_enable( ) Enable the Address Resolution Protocol (AutoIP Protocol need ARP)
nx_icmp_enable( ) Required for Ping
nx_udp_enable( ) Enable UDP traffic (DNS & DHCP need UDP)
nx_tcp_enable( ) Enable TCP traffic

4. STM32 NetX Duo Applications

The Following figure shows the project architecture and main application’s files.

NetX Duo Application Files

STM32 Packages provide the following set of applications (supported applications list may differ between products and boards):

Application Short Description
Nx_TCP_Echo_Server It demonstrates how to develop a NetX TCP server to communicate with a a remote client using the NetX TCP socket API. [readme]
Nx_TCP_Echo_Client It demonstrates how to develop a NetX TCP client to communicate with a remote sever using the NetX TCP socket API. [readme]
Nx_UDP_Echo_Server It demonstrates how to develop a NetX UDP server to communicate with a a remote client using the NetX UDP socket API. [readme]
Nx_UDP_Echo_Client It demonstrates how to develop a NetX UDP client to communicate with a remote sever using the NetX UDP socket API. [readme]
Nx_WebServer It demonstrates how to develop Web HTTP server based application. It is designed to load files and static web pages stored in SD card using a Web HTTP server, the code provides all required features to build a compliant Web HTTP Server. [readme]
Nx_MQTT_Client It demonstrates how to exchange data between client and server using MQTT protocol in an encrypted mode supporting TLS v1.2.. [readme]
Nx_Iperf It demonstrates how to measure performance when using different modes : TCP_server, UDP_server, TCP_client and UDP_client. [readme]
Nx_SNTP_Client It demonstrates how to develop a NetX SNTP client and connect with an STNP server to get a time update. [readme]