Need a Simple and Understandable Guide to the UPB Protocol

I'm trying to develop an app on my computer that will send and receive commands to my Simply Automated Serial PIM. I hope eventually be able to control and schedule my light switches over the internet. The problem is, I am having too much trouble learning the protocol. All of my switches are programmed and working flawlessly from UPStart.
 
I have found only one source: PimComm1.5a.pdf (sadly I cannot post the link as I am a new member). It is on the SAI website. It explains the UPB protocol, and it is very descriptive and detailed, but it is a little confusing and I haven't been able to get an commands to work.
 
Not only would I like to send command, but I would like to receive the events. I have my switches programmed to announce whenever a link or device is activated or deactivated. UPStart shows these events, and the light on the LED blinks. If an example is required to decode, then I can get one from my serial terminal.
 
I understand that there is a UPB network (0 being global/all and 1 being Network 1, 2 is Network 2, etc.). I also understand Devices and Links. I unlocked UPB Explorer in UPStart, but I cannot get that to work either. I also understand that there is some HEX encoding envolved.
 
Here is what I would like to do:
  • Recieve device/link states from the PIM in realtime (as a switch is pressed)
  • Send commands
  • Send and receive commands (Dim, Activate, Deactivate, get status, blink, turn on or off with a specific fade time)
Thanks!
 
Attached are two wintel serial programs that I just played with.  The serial program has a receive window and a send window.
 
Its a bit more granular than Procomm.
 
Testing here via a network connection to a UPB via a Quatech serial server.  I have a UPB PIM on the HAI OPII panel and Homeseer.
 
Might be easier to play if you have two UPB PIMs.
 
I was able to send and receive commands just fine with the serial program.  I sent commands from the OPII panel and Homeseer.
 
You can watch the traffic in ASCII.
 
Just set the terminal to the comm port and set the speed to 4800 8N1. 
 

Attachments

  • serial.zip
    429 KB · Views: 14
  • terminalprogram2.jpg
    terminalprogram2.jpg
    64.9 KB · Views: 16
Attached is a serial port splitter application such that you can use one PIM, Upstart and a terminal program.
 

Attachments

  • xport153.zip
    46.3 KB · Views: 11
Thanks!
 
I've been using the Terminal by Br@y++ for a while, but I couldn't get Xport to work. UPStart wouldn't recognize the PIM through it. It said on the Xport website that it wouldn't work with Windows 8. Are there any other free alternative? I have a linux machine running and I could have it act as a serial server.
 
I also cound't get the PCS software to work. I tried the commands that the Command Wizard was giving me to no avail.
 
Well, I set up Termite to forward my PIM to a virtual port from com0com. This way I can see the PIM's and UPStart's serial commands on screen as they interact. It works, but after a little while Termite crashes probably from the PIM's endless heartbeats overflowing the application. If I can get the parts, I will make a serial spy cable, but that probably won't be for a while.
 
Is there a way to get this to work under Linux? I have a box sitting around with serial. I could use it to serve the serial to UPStart on my Windows computer, but how?
 
UPStart wouldn't recognize the PIM through it. It said on the Xport website that it wouldn't work with Windows 8. Are there any other free alternative?
 
Yup; except they are really old made to work with GPS's similiar to xport.
 
I have a linux machine running and I could have it act as a serial server.  Yes; you can use minicom.
 
Above testing was with the UPB PIM attached to a Quatech serial server.
 
If you can get two PIMs then connect one to the Linux box and talk to it via minicom/ssh and UPStart on the second PIM.
 
So set up your com server on the Linux box and try this program in Windows for virtual split com ports.  (I just googled this).
 
Windows Virtual Com
 
Another playing around program is this one this morning.  Works
 
Serial over Ethernet
 
I'll have to look some more as in the 1990's had configured a little multiserial linux (unix) application box booting up from a floppy disk.  Very simple little machine.  Its only purpose was to act as a network multiport serial server.
 
Googling some more ....what we want to do is utilize the following: (doing this to document and to learn for myself)
 
1 - use ser2net to take the linux serial port connected to the UPB PIM to ethernet
2 - use real term to echo ethernet serial data to a wintel serial port
real term
3 - use com0com to create a virtual serial port on the Wintel PC for Upstart use.
com0com
4 - use termite in wintel
termite
 
ser2net configuration would be something like this

3333:raw:0:/dev/ttyUSB0:4800,8DATABITS,NONE,1STOPBIT
start ser2net
 
accessing it via wintel would be using port 3333 and IP of linux box.
 
ser2net stuff
 
Like the pictures on the web page. 
 
ser2netproxy.jpg
 
Here playing with OpenWRT on a TP link so installed remserial this morning on it.
 
geez just noticed I already had installed it. 
 
Here been talking to the OPII via serial while on the device via ssh.
 
Never thought of trying a virtual serial port connection from PCA to the little microrouter to see if that works.
 
PCA via the network through the microuter to the OPII works fine.
 
root@ICS-TPLink-MR:~# remserial --help
Remserial version 1.3.  Usage:
remserial [-r machinename] [-p netport] [-s "stty params"] [-m maxconnect] device

-r machinename          The remote machine name to connect to.  If not
                        specified, then this is the server side.
-p netport              Specifiy IP port# (default 23000)
-s "stty params"        If serial port, specify stty parameters, see man stty
-m max-connections      Maximum number of simultaneous client connections to allow
-d                      Run as a daemon program
-x debuglevel           Set debug level, 0 is default, 1,2 give more info
-l linkname             If the device name is a pseudo-tty, create a link to the slave
-w                      Only write to the device, no reading
device                  I/O device, either serial port or pseudo-tty master
 
 
Alright,
So I didn't know that RealTerm had the same forwarding capabilities that Termite has. It just calls it "Echo Port." Because of this, I really didn't need my Linux computer nor ser2net. Here's what I did:
  • Find what port your PIM is on. Mine was on COM1.
  • com0com Setup
    Add a Virtual Port Pair 1 if there isn't one already
  • On both sides of the config, check "use Ports class" and "emulate baud rate."
  • Apply
  • The port names it gives you will be the equivalent to my COM14 (left) and COM13 (right).

[*]RealTerm
  • Display - Hex[space]
  • Port - 4800 baud, port 14 (com0com), no parity, 8 data bits, 1 stop bit, no hardware flow control, no software flow control
  • Pins - RTS Set, DTR Set
  • Echo Port - 4800 baud, port 1 (PIM), no parity, 8 data bits, 1 stop bit, no hardware flow control, no software flow control, DTR, RTS, Echo On. If you turn on "Monitor," you will the PIM's constant status updates. I only turn it on and off immediately before and after sending a command from UPStart. This way UPStart's command (yellow) stays on screen and the PIM's response directly after it.
  • Port - Open button

[*]UPStart
  • Start UPStart. It might say it couldn't connect to the PIM. Don't worry.
  • Go to Tools > UPB Interface Device > Select
  • Interface: RS232 PIM; Port: Comm 13
  • Connect
  • OK
  • If you want to run the Verify that gets the status of switches and checks for changes that would have normally run at startup, got to Network > Verify.

So, I now have a DIY software serial spy.
 
I can see the communication between my PIM and UPStart. Perfect!
 
So, here is my first message to decode: 14 38 39 31 30 38 37 30 44 46 46 32 30 46 46 46 46 42 36 0D
This is sent from UPStart to activate link 13. If someone could give an explanation of this command (i.e. break down every bit), that would be nice.
 
Thank you very much pete_c for helping me so far.
 
 
14 38 39 31 30 38 37 30 44 46 46 32 30 46 46 46 46 42 36 0D

Matches message format

<Ctl-T>UU..KK<Cr>

UU..KK are ASCII hex so converting you get

8910870DFF20FFFFB6

8910 is control word
87 is network Id
0d is destination
FF is source
20FFFF is msg
B6 is checksum
 
Well, I just installed the new UPStart, and not much has changed. Especially since I have all SAI switches, and one major feature seams to be just for a new PCS keypad. I am 100% fluent in using UPStart - I've been using it for quite a few years now and have my system tuned to perfection.
 
I have read the UPB spec guide, but I am still confused. Mainly on formulating commands. Also because UPStart says my Network ID is 135, but the command above says 87. There are many inconsistencies that don't make sense. So, if someone could post a 1, 2, 3 guide on making a command (including the control word, message, and checksum), it would be much appreciated.
 
From another document on the PCS resources page, I also found that the UPE export file is actually a CSV table (easily opened in Excel). This will make my final program much more automated. Some for of CSV integration is in most programming languages or in well-developed libraries.
 
Back
Top