How does BACnet MSTP discover new devices on a network ?

(To provide clarity this article does simplify the issues to some extent.)

BACnet MSTP is a token passing protocol. Only nodes with the token are allowed to initiate service requests such as requests for data. A device that receives a request, a request that requires a response, may respond without having the token.

Based on this behavior it is easy to understand the difference between a MSTP master and slave. A slave is a device that can only send responses. A master is an initiator of a service request.

Only allowing masters to initiate a message exchange when they have the token provides a mechanism whereby there can be multiple masters on a network and contention or collision can be avoided. Ethernet uses a different system – it allows collisions and provides a recovery mechanism. Imposing rules on the token passing such as specifying how much a master can do while it has the token provides a mechanism to balance the performance of various devices on a single network.

Back to the question of how new devices are added to the network. If you add a new slave device then you will need to program at least one master on the network to exchange data with that slave. The master needs to be programmed specifically to read that slave since slave devices don’t support discovery.(That’s one of the reasons that most field devices are not slave devices.)

If you add another master it needs to receive the token before it can act like a master but the other devices on the network need to discover the new device first. Every master on the network, has the job, of periodically polling for a new master.

Each master knows who the next master on a network is, because that is who it will pass the token to. So, each master, must poll for masters that could exist in the address range that exists between its own address and the next master’s address. Thus a master addressed as 1 must look for master’s in the range 2 to 10 if the next known master is 11. Master number 11 must look for new masters starting at 12 etc. The master with the highest number must try masters …,127,0…… When a device receives a poll asking if it is a master (Called a ‘Poll for Master’ message) it replies immediately. In the above example, if master number 1 cant find a master number 2 it should try number 3.

When should it try ? That’s a choice that is left up to the implementor of the BACnet protocol on that device. The spec only demands a minimum of 1 Poll for Master every 50 times a master receives or uses the token. The new master must respond within 20 milliseconds.

You can see, that if every master polls for a large number of new masters and they do this often then lots of bandwidth is lost. For this reason BACnet MSTP has a parameter called Max Master. Each master has its own setting for this variable. Typically it is set at 127 but imagine that master number 50 is the highest master on the network, and its Max Master is set to 64. Then it will never discover a new master whose address is larger than its max master, ie it will never discover master with address 65 to 127. This is a common reason why a new device on a network is not discovered.

How often should a master search ?

You may also wish to read our article on duplicate Mac Address and Device Instance Numbers. 2 BACnet MSTP devices with the same device ID