Ping and UDP#
To complete the following steps correctly, you need a Wi-SUN node running the Wi-SUN – SoC Ping application on the network. For more information, see QSG181: Silicon Labs Wi-SUN SDK Quick-Start Guide for details on how to bring-up the Wi-SUN Ping project.
Connect a Wi-SUN Node to the Border Router#
After the project is flashed and running on the Wi-SUN device, connect to the CLI interface. From this interface, retrieve the Wi-SUN border router IP address and the Wi-SUN node IP address by executing wisun get wisun. They are available only if the device is successfully connected. If this is not the case, wait for the connection process to complete. If the connection is not successful, verify the border router and router configurations match (network name, Wi-SUN PHY, certificates, and so on). You should get the following trace on the console.
> wisun get wisun
wisun.network_name = Wi-SUN Network
wisun.phy_config_type = FAN 1.1 (1)
wisun.network_size = small (1)
wisun.tx_power = 20
wisun.regulatory_domain = NA (1)
wisun.operating_class = 0 (unused)
wisun.operating_mode = 0x0 (unused)
wisun.chan_plan_id = 1
wisun.phy_mode_id = 2
wisun.ch0_frequency = 0 (unused)
wisun.number_of_channels = 0 (unused)
wisun.channel_spacing = 100kHz (0) (unused)
wisun.join_state = Operational (5)
wisun.ip_address_global = fd12:3456::be33:acff:fef6:3161
wisun.ip_address_link_local = fe80::be33:acff:fef6:3161
wisun.ip_address_border_router = fd12:3456::86fd:27ff:fefe:55bd
wisun.ip_address_primary_parent = fd12:3456::86fd:27ff:fefe:55bd
wisun.regulation = none (0)
wisun.regulation_warning_threshold = 85
wisun.regulation_alert_threshold = 95
The Wi-SUN border router IP address is fd12:3456::86fd:27ff:fefe:55bd (wisun.ip_address_border_router value). The Wi-SUN node IP address is fd12:3456::be33:acff:fef6:3161 (wisun.ip_address_global value). These IP addresses are used in the following steps to address the devices.
Check the Communication Between the Raspberry Pi and the Node#
From the same Linux terminal, ping the Wi-SUN node.
$ ping fd12:3456::be33:acff:fef6:3161
PING fd12:3456::be33:acff:fef6:3161(fd12:3456::be33:acff:fef6:3161) 56 data bytes
64 bytes from fd12:3456::be33:acff:fef6:3161: icmp_seq=1 ttl=64 time=675 ms
64 bytes from fd12:3456::be33:acff:fef6:3161: icmp_seq=2 ttl=64 time=680 ms
64 bytes from fd12:3456::be33:acff:fef6:3161: icmp_seq=3 ttl=64 time=705 ms
64 bytes from fd12:3456::be33:acff:fef6:3161: icmp_seq=4 ttl=64 time=925 ms
64 bytes from fd12:3456::be33:acff:fef6:3161: icmp_seq=5 ttl=64 time=281 ms
64 bytes from fd12:3456::be33:acff:fef6:3161: icmp_seq=6 ttl=64 time=149 ms
This communication goes through the Linux IP interface to the communication bus. It is then received by the EFR32 running the RCP image and sent over the air using the Wi-SUN protocol. Finally, the packet is received by the Wi-SUN node which replies with its own packet. The new packet takes the same route the other way round. The latency is the accumulation of all the step durations.
You have successfully opened an upstream communication between the Wi-SUN network and a device in the backhaul network. To go further, you can use this new communication link to open TCP/UDP sockets between a Wi-SUN node and the Linux host.
Send and Receive UDP Data#
Assuming that you have retrieved the iPv6 addresses of the border router and the node, as explained in the beginning of this page. And you have a Wi-SUN node running Wi-SUN – SoC CLI project. You can send and receive UDP data using netcat server.
Send UDP data#
To send data, make sure to open a UDP server port on your node first, using the following command:
wisun udp_server [port]
And on your Linux host, use netcat command to send UDP data:
$nc -u [Wi-SUN node IP address] [port]
Receive UDP Data#
To receive data on your Linux host, open a UDP server port using netcat command:
$nc -6 -lu [port]
Then you can send data from your node with the following commands:
wisun udp_client [Wi-SUN border router IP address] [port]
wisun socket_write [Socket ID] [Wi-SUN border router IP address] [Port] [Message]
Note that the Socket ID value, will be returned with command wisun udp_client
.