在调试以太网流量时,有许多硬件和软件工具可供选择,Wireshark是一个很好的例子,它是免费的。在分析RS485总线上的MSTP流量时,选择是有限的。 Bacnet通信的专业特性加上紧张的时机使得像Windows和Linux这样的多任务操作系统难以跟上。 Bacnet指定设备应该在15到20ms内开始其应答,这接近PC的限制。感谢Steve Kargs的一些创造性工作,我们可以使用一台普通的PC来捕获MSTP数据包,并使用Wireshark进行实时查看。史蒂夫的工作的故事在这里: http://steve.kargs.net/bacnet/wireshark-and-bacnet-mstp/.
Getting The Hardware:
You’ll need an RS485 port on your PC and a Bacnet device to talk to.
For the RS485 port, we make this low cost USB to RS485 converter. The LEDS are a great help in themselves.
https://dev.bravocontrols.com/product/usb-to-rs485-converter/
And you’ll need a Bacnet device, if you haven’t got one already here’s a $30 device we’re making. Its normal job is a ‘pulse input to analog output’ but you can use it as general purpose I/O with its six universal inputs and six analog/binary outputs. There is a link on the product page to the source code for this product which uses an Arm STM32F103VC processor. With these two bits of hardware you can be up & programming with Bacnet MSTP in short order.
https://dev.bravocontrols.com/product/pwm-input-to-voltage-output-transducer/
Installing Wireshark and the MSTP helper tool
Next install the Wireshark 2.0 packet capture tool: https://www.wireshark.org/#download
全部通过安装过程选择默认选项。接下来,我们需要下载Steve Kargs的帮助文件,并将其保存到安装Wireshark的特殊文件夹中。启动Wireshark并点击帮助 - >关于Wireshark - >文件夹选项卡 - > Extcap路径来查看文件应该被复制的位置。
您可以点击标签4中的链接,这将弹出正确的文件夹,如tab5所示。
4.从Steve下载并解压缩mstpcap.exe助手文件,可以在这里找到: https://sourceforge.net/projects/bacnet/files/bacnet-tools/bacnet-tools-0.8.5 . There are many utilities in this zip file, you’ll only need the mstpcap.exe. Unzip the bacnet tools file to a temporary folder and copy the important mstpcap.exe file to the wireshark\extcap folder.
During installation Wireshark asks if we’d like to reboot which I found to be unnecessary, possibly because I had installed this software many times before. Your results may vary.
When we first run Wireshark we are greeted with a list of the available communications ports on your PC. There’s a network activity graph at Tab5 which shows some action on the Wifi port so the installation went well.
要查看MSTP流量,我们首先单击tab6上的'COM6上的BACnet MS / TP'图标,这会弹出一个对话框,我们可以在tab7中编辑波特率。然后在tab8开始捕获。
Finally here is the MSTP traffic, this particular capture is from a session on COM1.
Setting Filters In Wireshark:
You can home in on the traffic of interest by setting a filter which you edit directly at tab9, here we have set up a simple filter to capture all data going to bacnet ID = 3, ‘mstp.dst == 0x03’ is the syntax. Filters can get complex so there is a dialog to help build the filter expressions by clicking at tab10 which brings up this dialog. Here we’ve selected the Bacnet MSTP protocol at tab11, picked the ‘destination address’ filter at tab 12, selected ‘==’ at tab 13 to pick an exact match and finally entered the Bacnet address ID in hex format, 0x03 at tab 14.
8.If you’re having troubles you can try at different baud rates. My particular setup didn’t work at 78k baud but surprisingly did manage to work at 112k. There is also a setting for the COM port latency which can be found in ‘Windows Device Manager’ under the port settings ->Advanced Settings -> Latency Timer. Here’s the default setting for the common USB com port chip from FTDI which is set to 16 msec, you can experiment with lower settings if the driver supports it.
Other Open Source Tools:
Finally, for higher level debugging of bacnet objects we have the venerable ‘Yabe’ which stands for ‘Yet another Bacnet Explorer’. It is an open source project which is currently maintained by Frédéric Chaxel. It is installed automatically when you install our T3000 software and is available under Tools -> Bacnet Tool. If you’d like to install the tool without installing our T3000 software, here is the link for the Yabe open source project:
https://sourceforge.net/projects/yetanotherbacnetexplorer/
这就是在不花费大量资金的情况下调试Bacnet MSTP流量的方法。
Professional Bacnet Tools:
Below are a few popular tools from Cimetrics, Polarsoft and Chipkin which the professional developer or integrator will want to have around. However, they do come at a price as you can see. We purchased the Chipkin Bacnet explorer tool long before the Yabe tool was around and it has paid for itself but the crew here doesn’t use it much now that the features in Yabe have filled in.