When an application needs to send an amount of data larger than what actually fits into a frame, it can manage on its own by breaking the data into smaller pieces and issuing multiple data requests or it can rely on the BitCloud
fragmentation feature, which compliant with the ZigBee PRO standard. In the latter case, the stack handles all implementation details so that the application needs only to configure a data request to apply fragmentation.
C.6.1 The Maximum Data Frame Payload Size
The maximum size of an application payload for a data frame sent to the air is indicated by the APS_MAX_ASDU_SIZE constant. The actual value depends on stack configuration options, such as the security level. Note that different stack configurations require different library versions to be used. If security is enabled, a data frame contains additional information, such as auxiliary headers, hash values for encrypting the message, etc. Hence the maximum payload size of a single frame decreases. For details concerning security, refer to Chapter 6.
Table C-1shows payload size limits applied in the BitCloud stack. Note that fragmentation requires an additional header to be inserted into the frame and thus consumes some bytes in addition to the values in the table, decreasing the maximum payload size.
C.6.2 Enabling Fragmentation in a Data Request
To enable fragmentation, the fragmentationPermitted field in txOptions should be set to 1 in the data request parameters. Additionally, fragmentation requires acknowledgement transmission to ensure delivery of all pieces of data. The following sample code illustrates the usage:
APS_DataReq_t messageParams; //global variable ...
messageParams.txOptions.acknowledgedTransmission = 1; messageParams.txOptions.fragmentationPermitted = 1; ...
The ASDU buffer should be defined as for a common request (see SectionC.2 for an example), except that the data section length can be larger than the maximum payload size. In most cases, it can be as large as the application needs to hold the whole message payload. However, the amount of data transmitted with a single request to APS is limited, because the stack has to allocate enough memory to store all parts of a fragmented message, if it receives one. The maximum is equal to CS_APS_MAX_BLOCKS_AMOUNT × CS_APS_BLOCK_SIZE provided the latter value is non-zero and CS_APS_MAX_BLOCKS_AMOUNT × APS_MAX_ASDU_SIZE if CS_APS_BLOCK_SIZE is set to 0.
The confirmation callback for the request is executed when all data fragments are delivered and the stack receives acknowledgement for the last frame. On the destination endpoint, the indication is raised when all fragments have been received. An argument passed to the indication callback is a pointer to the structure that contains the whole message sent by the originator.
C.6.3 Node Parameters Affecting Fragmentation
Several ConfigServer parameters affect fragmentation processing. The stack splits data into a number of blocks, and this number is limited by the CS_APS_MAX_BLOCKS_AMOUNT parameter mentioned above. To enable fragementation the user shall give a value greater than 0 for CS_APS_MAX_BLOCKS_AMOUNT. Another parameter, CS_APS_BLOCK_SIZE, specifies the block size, that is, the size of the parts to which a message is split. To set the block size to the maximum possible value, assign the parameter a value of 0, which is the default value.
While transmitting data frames for the current data request, the stack sends a certain number of frames, then stops sending frames to wait for an acknowledgement, and then continues when receives it. The number of frames to be sent before waiting for an acknowledgement is controlled by the CS_APS_MAX_TRANSMISSION_WINDOW_SIZE parameter, which is set to 3 by default. It is strictly required that this parameter be the same for both the originator and the
destination. Otherwise, it will not be possible to synchronize the communication because the communicating nodes will not recognize a correct moment for responding.
10.
References
[1] AVR2050: BitCloud Developer’s Guide (this document) [2] AVR2052: BitCloud Quick Start Guide
[3] BitCloud API Reference (available in BitCloud SDK) [4] AVR2054: Serial Bootloader User Guide
[5] AVR2058: BitCloud OTAU User Guide [6] ZigBee PRO specification (05-3474r20)
[7] ZigBee Cluster Library specification (07-5123r04) [8] ZigBee Light Link Profile specification (11-0037-10) [9] ZigBee standards overview
[10] AT05436 : BitCloud ZigBee Home Automation (ZHA) – Hands-on [11] AT08550: ZigBee Attribute Reporting
11.
Revision History
Doc. Rev. Date Comments
8199J 02/2015 Updated for BitCloud SDK v3.2.0.
8199I 03/2014 Updated for BitCloud SDK v3.0.0. Integrated content of AVR2056 Profile Suite Developer Guide and AVR2061 BitCloud ZLL Developer Guide.
Atmel Corporation 1600 Technology Drive San Jose, CA 95110 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com
Atmel Asia Limited Unit 01-5 & 16, 19F
BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369 Atmel Munich GmbH Business Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621 Atmel Japan G.K.
16F Shin-Osaki Kangyo Building 1-6-4 Osaki, Shinagawa-ku Tokyo 141-0032
JAPAN
Tel: (+81)(3) 6417-0300 Fax: (+81)(3) 6417-0370
© 2015 Atmel Corporation. All rights reserved. / Rev.: Atmel-8199J−BitCloud-Developer-Guide-MCU_UserGuide_AVR2050_02/2015
Atmel®, Atmel logo and combinations thereof, AVR®, BitCloud®, Enabling Unlimited Possibilities®, and others are registered trademarks or trademarks of Atmel
Corporation or its subsidiaries. Windows® is a registered trademark of Microsoft Corporation in U.S. and other countries. Other terms and product names may be
trademarks of others.
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time