Skip to end of metadata
Go to start of metadata

This section describes the examples that are related to the TCP/IP module of Micrium OS.

Network Module(s) Initialization Example

Description

This example shows how to initialize network module(s). It basically calls the self-contained module examples when the module is available and the example is enabled. See Example Applications section for further information about how to enable an example. It accomplishes the following tasks:

Configuration

No specific configuration applies to this example.
Please refer to sub-module example(s) for further information about the configuration.

Location

  • /examples/net/ex_network_init.c
  • /examples/net/ex_network_init.h

API

APIDescription
Ex_NetworkInit()This function performs the different example steps mentioned in the section Description. The function must be called by your application task prior to calling any other file system Network examples. 

Notes

This example doesn't start the network core. Once the module are initialized the network interface must be started as described by Network Core Start Interfaces Example

Network Core Initialization Example

Description

This is a generic example for the TCP/IP core module initialization. It accomplishes the following tasks:

  • Change default task's stacks size, if specified by the example configuration
  • Initialize the TCP/IP core module
  • Add one Ethernet controller, if enabled.
  • Add one WiFi module, if enabled.
  • Change default the task's priority, if specified by the example configuration

By default, this example will assume the presence of an Ethernet controller and a WiFi module when available in Micrium OS. The example assumes that the default interfaces are named "eth0" for the Ethernet controller and "wifi0" for the WiFi module.

Configuration

Mandatory

The following #define must be added in ex_description.h to allow the default main example (ex_main.c) to initialize the network module correctly:

#defineDescription
EX_NETWORK_INIT_AVAILLets the upper example layer know that the Network Initialization example is present and must be called by other examples.

Optional

The following #define can be added to ex_description.h, as described in Example Applications section, to change default configuration value used by the example:

#defineDefault valueDescription
EX_NET_CORE_TASK_STK_SIZE  

Not defined, used default set by the core (1024)

When defined, the default stack size assigned to the TCP/IP core task stack is changed at run time to this value.
EX_NET_CORE_SRV_TASK_STK_SIZENot defined, used default set by the core (512)When defined, the default stack size assigned to the TCP/IP core services task stack is changed at run time to this value.
EX_NET_CORE_TASK_PRIO

Not defined, used default set by the core (16)

When defined, the TCP/IP core task priority is changed at run time to this value.
EX_NET_CORE_SRV_TASK_PRIONot defined, used default set by the core (28)When defined, the TCP/IP core services task priority is changed at run time to this value.

Location

  • /examples/net/core_init/ex_net_core_init.c
  • /examples/net/core_init/ex_net_core_init.h

API

APIDescription

Ex_Net_CoreInit()

Initialize the Network TCP/IP core and add an Ethernet Interface and/or a WiFi Interface.

Notes

This example doesn't start the network core. Once the module is initialized, the network interface must be started as described by Network Core Start Interfaces Example

Start Network Interface(s) Example

Description

This is a generic example that shows how to start network interface(s). It accomplishes the following tasks:

  • If Ethernet is available:
    • Configure IP addresses
    • Start the Ethernet Interface
    • Wait setup completed (DHCP, IPv6 Autoconf and more)
  • If WiFi is available:
    • Configure IP addresses
    • Start the Ethernet Interface
    • Wait setup completed (DHCP, IPv6 Autoconf and more)

Configuration

Optional

The following #define can be added to ex_description.h, as described in Example Applications section, to change default configuration value used by the example:

#defineDefault valueDescription
EX_NET_CORE_IF_ETHER_MAC_ADDRDEF_NULL
Use default provided by the BSP 
Specify the MAC address to assign to the Ethernet interface
EX_NET_CORE_IF_ETHER_IPv4_DHCP_ENDEF_ENABLEDSpecify if DHCP-IPv4 must be performed on the Ethernet interface
EX_NET_CORE_IF_ETHER_IPv4_STATIC_ADDR"10.10.10.111"

Change the static IPv4 address to assign to the Ethernet interface.
If DHCP fails, you can always access the target using this address.
If defined to DEF_NULL, no static address will be configured.

EX_NET_CORE_IF_ETHER_IPv4_STATIC_MASK"255.255.255.0"Specify the static IPv4 address mask to assign to the Ethernet interface.
EX_NET_CORE_IF_ETHER_IPv4_STATIC_GATEWAY"10.10.10.1"Specify the static IPv4 address gateway to assign to the Ethernet interface.
EX_NET_CORE_IF_ETHER_IPv6_DAD_ENDEF_DISABLEDSpecify if IPv6 Duplicate Address detection must be performed on IPv6 address on the Ethernet interface
EX_NET_CORE_IF_ETHER_IPv6_AUTOCONF_ENDEF_ENABLEDSpecify if IPv6 Autoconf must be performed on the Ethernet interface
EX_NET_CORE_IF_ETHER_IPv6_AUTOCONF_DAD_ENDEF_ENABLEDSpecify if IPv6 Duplicate Address detection must be performed on IPv6 Autoconf address on the Ethernet interface
EX_NET_CORE_IF_ETHER_IPv6_STATIC_LOCAL_ADDR"fe80::1111:1111"Change the static IPv6 address to assign to the Ethernet interface.
If Autoconf fails, you can always access the target using this address.
If defined to DEF_NULL, no static address will be configured.
EX_NET_CORE_IF_ETHER_IPv6_STATIC_LOCAL_PREFIX_LEN64uIPv6 static address prefix len
EX_NET_CORE_IF_WIFI_MAC_ADDRDEF_NULLSpecify the MAC address to assign to the WiFi interface
EX_NET_CORE_IF_WIFI_IPv4_DHCP_ENDEF_ENABLEDSpecify if DHCP-IPv4 must be performed on the WiFi interface
EX_NET_CORE_IF_WIFI_SSID"Wifi_AP_SSID"Specify the WiFi Access point to connect on
EX_NET_CORE_IF_WIFI_PASSWORD"password"Specify the WiFi Access point password
EX_NET_CORE_IF_WIFI_IPv4_STATIC_ADDR"192.168.1.222"Change the static IPv4 address to assign to the WiFi interface.
If DHCP fails, you can always access the target using this address.
If defined to DEF_NULL, no static address will be configured.
EX_NET_CORE_IF_WIFI_IPv4_STATIC_MASK"255.255.255.0"Specify the static IPv4 address mask to assign to the WiFi interface.
EX_NET_CORE_IF_WIFI_IPv4_STATIC_GATEWAY"192.168.1.1"Specify the static IPv4 address gateway to assign to the WiFi interface.
EX_NET_CORE_IF_WIFI_IPv6_DAD_ENDEF_DISABLEDSpecify if IPv6 Duplicate Address detection must be performed on IPv6 address on the WiFi interface
EX_NET_CORE_IF_WIFI_IPv6_AUTOCONF_ENDEF_ENABLEDSpecify if IPv6 Autoconf must be performed on the WiFi interface
EX_NET_CORE_IF_WIFI_IPv6_AUTOCONF_DAD_ENDEF_ENABLEDSpecify if IPv6 Duplicate Address detection must be performed on IPv6 Autoconf address on the WiFi interface
EX_NET_CORE_IF_WIFI_IPv6_STATIC_LOCAL_ADDR"fe80::1111:2222"Change the static IPv6 address to assign to the WiFi interface.
If Autoconf fails, you can always access the target using this address.
If defined to DEF_NULL, no static address will be configured.
EX_NET_CORE_IF_WIFI_IPv6_STATIC_LOCAL_PREFIX_LEN64uIPv6 static address prefix len

Location

  • /examples/net/core_init/ex_net_core_init.c
  • /examples/net/core_init/ex_net_core_init.h

API

APIDescription

Ex_Net_CoreStartIF()

Configure and starts network interface(s) and wait setup complete.

 

Notes

The following API can be called instead of  Ex_Net_CoreStartIF() , if you want to control the start flow and you don't want to wait for the setup completion on all interfaces.

APIDescription

Ex_Net_CoreStartEther()

Start the Ethernet Interface.

Ex_Net_CoreStartWiFi()

Start the WiFi Interface.