6.5 Building and running a project
This section provides the setps for building and running projects. Please follow the instructions outlined in the "Creating a new MCC Harmony project" section and generate two projects. One project should have FTD as the device role, while the other should have MTD as the device role, with the CLI App included. The default settings can be used for all other configurations. Once the projects are created build the projects and build should be successful.
The following scenario outlines the formation of a thread network and the exchange of data between a leader (FTD) and an end device (MTD). Node1 serves as the leader (FTD), while node2 functions as the end device(MTD).
- Once the projects are created right click on the project, "Clean and Build" option
and Flash the firmwares into two WBZ451 Xplained Pro boards as shown
below.
Building the FTD project:
Building the MTD project:
Flashing the projects:
Flash the FTD and MTD firmwares into each device selecting in project properties → Connected Hardware Tool as shown below
- Open Tera Term Serial tool and Goto Setup → Serial port and set the following
settings as shown in below.
- The below commands are to be inputted
in node1 to form the thread network with Leader role. After successful inputting of
each comand thread stack responds as "Done".
Node1: > dataset init new > dataset channel 19 > dataset networkkey 00112233445566778899AABBCCDDEEA9 > dataset commit active > ifconfig up > state > thread start > state
- Once the above commands are executed
the node1 forms the thread network and assisgns itself with leader role as shown in
the below image.
- The below commands are to be inputted
in node2 to join the thread network formed by node1. After successful inputting of
each comand thread stack responds as "Done".
Node2: > dataset channel 19 > dataset networkkey 00112233445566778899AABBCCDDEEA9 > dataset commit active > ifconfig up > state > thread start > state
- Once the above commands are executed the node2 joins the thread network formed by
node1 with child role as shown in the image below.
- Get the IP Address of each node for further communication by using following command
and IP addresses of node1 and node 2 are shown below
> ipaddr
Figure 6-4. Node2
UDP Data Exchange between Node1 and Node2:
Follow the below commands to send a UDP packet from node 2 to node1
Node1:
> udp open
> udp bind :: 1234
Node2:
> udp open
> udp send fd45:db4c:c440:c702:6296:bbb0:354:d4d7 1234 Hello
Block Transfer Data Exchange between Node1 and Node2:
To execute the following scenario, kindly activate the Block Transfer feature in the thread MCC configuration as elaborated in the "Thread SDK MCC Configuration" section under Common MCC configuration options.
Follow the below commands to perform a block transfer from Node2 to Node1.
Node1:
> coap start
> coap resourse test-resource
Node2:
> coap start
> coap post fda8:6505:5286:466f:3d3b:88ae:c24b:b06 test-resource block-256 1