BACnet MS/TP Timing explained

by Svetlana Lyons March 12, 2019

BACnet MS/TP Timing explained

BACnet MS/TP is a token passing protocol. It is one of the data links supported by the BACnet standard. MS/TP is a master/slave token-passing protocol which uses standard serial ports on microcontrollers and EIA-485 transceivers. This network offers the lowest possible hardware cost for BACnet integration and is used by many companies for their device level network.

BACnet architecture

Token Passing
Token passing is a well-known networking access control mechanism. MS/TP uses this "token passing" system to control access to the network. A master node may initiate the transmission of a data frame only when it holds the token. Both master and slave nodes may transmit data frames in response to requests from master nodes. After the master node with the token sends several frames (defined by the Nmax_info_frames setting) the node then passes the token to the next master node.
Token frames are not acknowledged.

So, what are the BACnet MS/TP timing requirements?

There are two "levels" of responses in MS/TP:

  • The low-level "response" is part of the token-pass machinery. An MS/TP master node (a BACnet device) should start using the Token or reply to a Poll For Master frame in 15 milliseconds. The requesting node should wait for the "response" for at most 20 milliseconds. In the documentation this requirement is referred to as "the time frame for sending a message is 10 to 15ms". The lower part of a BACnet datalink communicates with the hardware network interface and is platform specific. In the case of the MS/TP datalink, the code is time critical and requires guaranteed response in 5-10 ms time frame. 
  • The "high-level" response is the BACnet application-level response to a Confirmed Request, as defined in the Application Layer of BACnet.


When an MS/TP node receives a frame, which contains an application layer Confirmed-Request, it should respond in 250ms. It can either send the frame with the application-layer Confirmed-Response, or notify the sender that the Response will be sent later, by sending Reply-Postponed frame. In documentation this case is referred to as "responses to requests should be sent in 250ms".

Good to know! Though BACnet Standard defines the maximum timeout as 250ms, it is better to keep this timeout smaller. There was even a proposal to limit it to 225ms. By default, uBACstac uses 225ms as the timeout.

There is also a special case of creating a new TOKEN.

If the Token is lost, the node with the smallest MAC generates the new Token. The time slot for a node to start sending the new Token is 10ms. If other devices on the network need a few milliseconds to notice the presence of the new token, the token should better be generated in the first half of the time slot. That is: the transmission should be started with 5-10ms accuracy. This is mentioned in the documentation as a general requirement for the low-level MS/TP code to be capable of starting transmission in 5-10ms. (The wording is probably confusing, however: "requires guaranteed response in 5-10 ms time frame").

Finally, when a node transmits a frame, there should be no gaps in the transmission. The idle time between two octets should not exceed 20 bit times. At 9600 bps this amounts to 20ms, but for 115200 bps this timeout is less than 2ms. This is usually not a problem for an RS-485 software driver, so it is not specifically mentioned in the documentation.

For developing an application using Cimetrics uBACstac keep in mind that the application logic (and timing) in BACnet is completely decoupled from the low-level MS/TP FSM.

Basically, when an MS/TP device gets a Confirmed-Request it has two choices:

  1. Answer immediately, re-using the "time-slot" granted to it by the node which sent the Request.
  2. Postpone reply for later by sending "Reply-Postponed" message, and send the Response later, when the device obtains the Token.

In the first case, the Application should encode the Response and pass it on to the Datalink so that the frame transmission starts in 225ms. The shorter this time is the better, because the whole MS/TP network stalls and waits. Formally, BACnet standard allows for 250ms. delay, but uBACstac by default uses a shorter timeout of 225ms.

In the second case, the application should notify the MS/TP Datalink that it is going to send Response later (the application creates a "reply postponed" message with the uBACstac function BACstacCreateReplyPostponed() and SENDs it to the Datalink), and then the device has a few seconds to prepare the Response and send it. In this case, the allowed time is determined by the value of "Apdu_Timeout" property of the Device Object of the device which initiated the Request. Usually it is in the range of 3-10 seconds.

The bottom line:

If an application can prepare the Response in a few milliseconds, then it should answer immediately. If it takes more than 100ms, then it is better postponing the reply in order to not slow down communication on the MS/TP network.




Svetlana Lyons
Svetlana Lyons

Author



Leave a comment

Comments will be approved before showing up.


Also in Cimetrics News

New BACnet Explorer with File Transfer and more writable properties.
New BACnet Explorer with File Transfer and more writable properties.

by Svetlana Lyons June 25, 2019

New BACnet Explorer with File Transfer and more writable properties.

Read More

Bi-Weekly CyberSecurity Recap end of June 2019
Bi-Weekly CyberSecurity Recap end of June 2019

by Svetlana Lyons June 21, 2019

Read More

Bi-Weekly CyberSecurity Recap June 2019
Bi-Weekly CyberSecurity Recap June 2019

by Svetlana Lyons June 07, 2019

Read More

cimetrics.com Legal Terms and Conditions

June 29, 2016

cimetrics.com (the "Site") is owned by Cimetrics Inc. ("Cimetrics").

PLEASE READ THESE TERMS AND CONDITIONS CAREFULLY BEFORE USING THIS SITE.  YOU MAY NOT USE THIS SITE IF YOU DO NOT ACCEPT THE TERMS AND CONDITIONS.

Terms of Use

The information herein provided is for general informative purposes only, and no warranties or representations are made with respect thereto. The information may contain inaccuracies or typographical errors.  The information provided is subject to change at any time, and without notice. Changed information may include, but is not limited to, technical specifications and pricing. Binding declarations are only given after detailed enquiries.

BECAUSE THE INFORMATION IS NOT WARRANTED, ALL LIABILITY FOR THE ACCURACY OF THE INFORMATION IS EXPRESSLY EXCLUDED.

IN NO EVENT SHALL CIMETRICS, ITS OFFICERS, DIRECTORS, EMPLOYEES, PARENTS, AFFILIATES, SUCCESSORS OR ASSIGNS, BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OR PERFORMANCE OF THE CIMETRICS SITE, WITH THE DELAY OR INABILITY TO USE THE CIMETRICS SITE OR RELATED SERVICES, THE PROVISION OF OR FAILURE TO PROVIDE SERVICES, OR FOR ANY INFORMATION, SOFTWARE, PRODUCTS, SERVICES AND RELATED GRAPHICS OBTAINED THROUGH THE CIMETRICS SITE, OR OTHERWISE ARISING OUT OF THE USE OF THE CIMETRICS SITE, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF CIMETRICS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. IF YOU ARE DISSATISFIED WITH ANY PORTION OF THE CIMETRICS SITE, OR WITH ANY OF THESE TERMS OF USE, YOUR SOLE AND EXCLUSIVE REMEDY IS TO DISCONTINUE USING THE CIMETRICS SITE.

Passwords

If you have been given a Password in order to gain access to certain information on this Site, or any other affiliates’ website, then you agree, as a condition of receiving said Password, that you shall keep the Password confidential. You shall only disclose the Password to your employees or agents who have a need to know. You are solely responsible for all activities that occur using your Password.

If you become aware of any unauthorized use of your Password, you agree to notify Cimetrics immediately.  Cimetrics reserves the right to revoke your Password access at any time for any reason whatsoever.

Copyrights and Trademarks

All information provided on the web pages of Cimetrics.com is protected by copyright. It is prohibited to copy, process, modify or commercially distribute this information without the express written permission of Cimetrics.

Analytika, Infometrics, Metermetrics, BACstac, BACstac/DN, Secured by Cimetrics™ and BAS-o-matic are trademarks or registered trademarks of Cimetrics.  The Analytika, Cimetrics, Infometrics and Metermetrics logos are trademarks or registered trademarks of Cimetrics.  All other trademarks are owned by their respective companies.

Links to Other Websites

This Site may from time to time contain links to other websites ("Linked Site") or other Internet information sources ("Third Party Source"). These links are provided solely as a convenience to users of this Site and do not constitute an endorsement, sponsorship or recommendation by Cimetrics.  Each Third Party Source or Linked Site may have its own terms of use and privacy policy. Cimetrics is not responsible for the content, availability, or policies of any Linked Site or Third Party Source, or any additional links contained therein.

Privacy

Please read the privacy policy for this Site, which is incorporated into these Terms and Conditions by reference.