BACnet Interoperability Workshop

SwitchPak MS/TP MenuAt work, I have spent the past month, and in particular, the past two weeks, preparing for the BACnet Interoperabilty Workshop. What does that mean? Well, we were going to take two beta products to the plugfest, as it is affectionately called. My original plan was to take our existing product, convert and upgrade the BACnet stack in it, and add routing capability. It probably requires about a month of work to do that. However, many other things came up at work, and I didn’t even come close getting a good start on the project. Two weeks ago I talked to our specification manager who is going to be at the plugfest with me, and she asked for a completely different product to have BACnet capability added.

One side of my cubicle officeSo two weeks ago on a Monday afternoon, I pulled the product source code from our version control system (I wish it was Subversion). I setup the MPLAB IDE for that project, and connected my ICD2 to the PIC18F6720 based lighting controller. The product was developed by my friend and colleague Mark. We use a software coding standard at work that I created. Coding standards make it easy to work on each others code and it still looks somewhat familiar.

On Tuesday I grabbed the latest version of the BACnet Stack at Sourceforge from subversion, and set about integrating BACnet into the product. I cut out some code to make space for the BACnet stack – just the self test code and the RS-232 terminal. By Wednesday I had MS/TP communications and a Device Object responding to WhoIs service requests with I-Am service responses.

On Wednesday and Thursday I added support for the rest of the objects (8 Binary Inputs, 8 Binary Values, and 1 Analog Input) and DeviceCommunicationControl, ReadProperty, TimeSync, ReinitializeDevice, WhoIs, and I-Am services.

On Friday I fine tuned the MS/TP state machine. I started to use the Bitscope attached to my PC, but it didn’t have the deep capture and user friendly features of my favorite scope, the HP54645D 100MHz 2+16 channel mixed signal oscilloscope. The HP54645D is great for protocol analysis. For example, I capture 5 seconds of communication. Then I use the MegaZoom feature.  I simply twist the timebase knob and zoom in on the trace.  I use the horizonal scroll to move the trace in time to the place of interest. I can then use the cursors to measure the time or frequency or voltage. This works great, for example, when checking to see how long it takes from receiving an MS/TP token to actually using the token.  It also works well to spot a collision and determine which packet caused it.

HP54645D Scope of MS/TP Trace actual capture HP54645D Scope MSTP trace - some Mega Zoom HP54645D Scope MSTP trace - more Mega Zoom and time cursors

This week, on Monday, I added the WriteProperty service, and began validating that all the services were integrated properly. I added hooks to write to various BACnet properties since I didn’t take the time to modify the keypad menus for setting things like the BACnet Device Object Instance Number and the MS/TP baud rate.

So, it took about five working days to go from zero to BACnet. Wow! I still have some work to do in order to design the networking interaction of this device with other devices of its kind. In other words, I have to figure out how to make it do simple control networking out of the box. I also have to add menus to configure the BACnet parameters. However, I am able to read and write to the 8 relays. I am able to read the values of the inputs. I am able to read the time and date, and set the time and date. I am able to control the device communications, and able to reset the device. All using the BACnet protocol.

I guess we will see how robust the unit is based on how it behaves at the plugfest. Stay tuned!

About skarg

I write software for a living. So, I dedicated some web space for some stuff that I have worked on. I mostly write embedded C for PC based controllers, but I have dabbled in a few other areas as well.
This entry was posted in BACnet. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *