Monday, 30 January 2012

Trouble Shooting BACnet MSTP

One badly behaved device on a MSTP trunk can cause a collapse in performance.

To understand why consider this one example of what can go wrong. RS485 is s shared trunk. When two devices transmit at the same time this causes a collision. In simple terms think of the messages interfering with each other and corrupting each other so neither message is recognizable. To prevent this happening and to allow for multiple master on a network, BACnet has chosen a token based system. Only devices with the token can initiate a message transaction. To keep things running smoothly, BACnet has some demanding timing requirements. For example, a device passes the token on. The receiving device has 15msec to use the token. Lets say it responds in 18msec. During that interval, the original device doesn't see the token being used so it send the token again. As it sends it, the 2nd device uses the token (3 msec late). Now the messages from the 1st and 2nd device clash. The 2nd device thinks it has the token and starts to use it. The 1st device thinks the token got lost and starts to poll for a new master. Messages clash, causing contention and eventually both devices recover to a valid state using the protocol rules. These rules require waiting various timeout periods. All the waiting, collisions and recovery waste time and bandwidth. If this happens often (as it will because one device doesn't meet the spec) then you can lose significant bandwidth.

Strategy

Capture Traffic using USB-485 converter
Use a tool like BACspy
Or
Use Hyperterminal
Analyze Traffic
Use a tool like BACspy online or Offline
Or
Perform a manual analysis


Configure HyperTerminal
Select the COM port which corresponds to your USB converter
Set the Baud Rate correctly
Set the other parameters as shown






Capture to File
Use this menu to start and stop the capture




As the messages are captured you will see these non-human readable characters fill the screen.





Inspect the captured data before you leave site to see if it usable.
You need a viewer capable of displaying the hex bytes. Here is a free download and hex viewer. Open the log file. 
To ensure you captured useful data look for messages that begin 55 FF. All BACnet MSTP messages begin with the same codes.
If you don’t see any then this may mean you captured at the wrong baud rate or some other setting is wrong. It is also possible that there is no BACnet communication.



You can use the CAS BACspy tool
BACspy automates this process of capture and analysis.

No comments:

Post a Comment