The Connect stack support MAC mode. Although the Connect stack implements a full-featured network layer, including routing, supporting star and extended star topologies, network formation functionality (association, centralized address allocation), it supports MAC mode as well. In MAC mode, nodes can only communicate directly to each other and no routing is available.
The 802.15.4 MAC layer is used for basic message handling and congestion control and provides security functionality (scanning, authentication, encryption and replay attack protection). Packet size is up to a maximum of 127 bytes at the PHY layer. The MAC layer payload can vary depending on the security options and addressing type as illustrated in the figure below.
Simlpicity Studio provides example project for testing MAC mode. A MAC-device is able to send and receive standard 802.15.4 messages from other 802.15.4 devices in range. Such a device does not relay messages.
Open the following example from Simplicity Studio:
The AppBuilder automatically opens and and make it possible to change the configuration. The default settings are suitable to test MAC mode. Click on 'Generate', compile the project and run on two devices.
Open a terminal (ex.: TeraTerm) an check if the firmware works. After boot the following screen should be appear:
In case of MAC mode there are two modes to setup the devices:
directly commission the network parameters to the devices
setup a coordinator by commission network parameters and allow other devices to join
Before setup the devices it is a good practice to issue the leave command to clear network parameters.
To apply network parameters issue the commission command:
Directly commissioned network parameters to all devices
commissioned 6 0x0001 0xabcd 0 0 where the parameters in order are:
Node type: 6 (6: MAC mode device, 7: MAC mode sleepy device)
Node ID: 0x0001 (must be unique in one PAN)
PAN ID: 0xabcd
TX power: 0
Channel: 0
Issue the command above with different (ex: 0x0002) Node ID on the other device. To check the parameters issue the info that will list the following parameters:
At this point the devices can send messages to each other using the send command. This command has multiple forms based on the addressing modes on source and destination side The following example uses long address for both side:
The addressing format can be mixed, using long address for one of the nodes and short for the other. It is also possible to send message between different PANs (inter-PAN messages).
Setup a coordinator by commission network parameters and allow other devices to join
In this case one node must be coordinator and its network parameters have to commissioned just like in the case above:
commission 6 0x0000 0xf000 0 0
The other devices have to join to the network, however by default joining is not enabled issue the following command on the coordinator to permit nodes to join:
pjoin 255
The parameter is the time in second during the joining is permitted. There are two special values:
0: joining is not permitted
255 joining is permitted without timeout
On the end-devices issue the join command:
join 6 0xabcd 0 0
The parameters of the join command are:
Node type: 6 (6: MAC mode device, 7: MAC mode sleepy device)
PAN ID: 0xabcd
TX power: 0
Channel: 0
The coordinator assigns random short address to the devices.
Sending messages works the same as in direct commissioned mode.
Join modes
Joining nodes can be MAC-level devices or Sleepy devices. Sleepy devices must poll the parent node for any messages waiting for them to be received. For sleepy nodes, the parent node should have the Parent Support plugin enabled.
Connect MAC-device
The Connect stack support MAC mode. Although the Connect stack implements a full-featured network layer, including routing, supporting star and extended star topologies, network formation functionality (association, centralized address allocation), it supports MAC mode as well. In MAC mode, nodes can only communicate directly to each other and no routing is available.
The 802.15.4 MAC layer is used for basic message handling and congestion control and provides security functionality (scanning, authentication, encryption and replay attack protection). Packet size is up to a maximum of 127 bytes at the PHY layer. The MAC layer payload can vary depending on the security options and addressing type as illustrated in the figure below.
Simlpicity Studio provides example project for testing MAC mode. A MAC-device is able to send and receive standard 802.15.4 messages from other 802.15.4 devices in range. Such a device does not relay messages.
Open the following example from Simplicity Studio:
The AppBuilder automatically opens and and make it possible to change the configuration. The default settings are suitable to test MAC mode. Click on 'Generate', compile the project and run on two devices.
Open a terminal (ex.: TeraTerm) an check if the firmware works. After boot the following screen should be appear:
In case of MAC mode there are two modes to setup the devices:
Before setup the devices it is a good practice to issue the
leave
command to clear network parameters.To apply network parameters issue the
commission
command:Directly commissioned network parameters to all devices
commissioned 6 0x0001 0xabcd 0 0
where the parameters in order are:Issue the command above with different (ex: 0x0002) Node ID on the other device. To check the parameters issue the
info
that will list the following parameters:At this point the devices can send messages to each other using the
send
command. This command has multiple forms based on the addressing modes on source and destination side The following example uses long address for both side:send 0x0033 0xffff {99 7c a2 fe ff 57 0b 00} 0xffff {6f 7c a2 fe ff 57 0b 00} 0xffff 0xffff {01234567}
On the transmitter side the following output should appear:
While the receiver side should print info about reception:
Since the long address is unique for every chip it must be replaced by the actual value to use the example.
The parameters of thesend
command are:The "nibble mask" specifies the addressing mode:
Example usage of short address + PAN ID:
send 0x1122 0x0001 {} 0x0002 {} 0xabcd 0xabcd {01234567}
The addressing format can be mixed, using long address for one of the nodes and short for the other. It is also possible to send message between different PANs (inter-PAN messages).
Setup a coordinator by commission network parameters and allow other devices to join
In this case one node must be coordinator and its network parameters have to commissioned just like in the case above:
commission 6 0x0000 0xf000 0 0
The other devices have to join to the network, however by default joining is not enabled issue the following command on the coordinator to permit nodes to join:
pjoin 255
The parameter is the time in second during the joining is permitted. There are two special values:
On the end-devices issue the
join
command:join 6 0xabcd 0 0
The parameters of the
join
command are:The coordinator assigns random short address to the devices.
Sending messages works the same as in direct commissioned mode.
Join modes
Joining nodes can be MAC-level devices or Sleepy devices. Sleepy devices must poll the parent node for any messages waiting for them to be received. For sleepy nodes, the parent node should have the Parent Support plugin enabled.