Diagnose communication problems with a Zaber device

1.3k views Asked by At

When I write software to control Zaber devices, I sometimes get strange behaviour that I don't understand. Usually it's caused by bugs in my script or other software, and sometimes it's a hardware problem like a loose connection on the serial port.

How can I see exactly what commands my software is sending and how the device is responding? I'd like a kind of log file that I can search through to see what's causing the errors.

Most often, I'm writing scripts in Zaber Console using C#, but I also write LabVIEW VIs using the Zaber instrument driver.

1

There are 1 answers

0
Don Kirkby On BEST ANSWER

There are several techniques to see the raw data being sent to and received from Zaber devices. Some are restricted to certain operating systems, others only work with some software. Most of the options involve looking at the raw data, so look in the user manual for details about the message format, and a list of command numbers.

Below, I'll try to list a few options and tell you when they are available.

Zaber Console Log Window

Only in Zaber Console, only on Windows.

This is the easiest technique if you are using Zaber Console scripts or plug ins. The window in the top-right corner records all the requests and responses for you. You might find it easier to track down the problem if you clear the window just before the problem occurs, and stop the script right after. One shortcoming is that some corrupted messages are not shown, you just see a partial packet timeout error. If the messages you want are getting scrolled off the top, change the log size on the advanced tab.

Portmon

Only on 32-bit Windows.

Portmon was a great tool, and I'm sad that it never got upgraded to 64-bit Windows. If you're still running a 32-bit version of Windows, it's worth trying. I found that the latest version 3.03 didn't work for me, but 3.02 still does. If the official version doesn't work, then searching for "portmon 3.02" will usually find some site that carries the old version.

  • In version 3.02, open the Computer menu and choose Connect Local.
  • From the Capture menu, choose Ports: COM1, or whatever serial port you want to connect to. Make sure your software is currently closed, or Portmon won't be able to connect to the serial port. Sometimes after using Portmon, you have to restart the computer to make it release the serial port.
  • From the Edit menu, choose Filter/Highlight... and set the Include to be IRP_MJ_READ;IRP_MJ_WRITE
  • On the Options menu, enable Show Hex and Clock Time.
  • Try sending some commands from your software, and then look at the Portmon window. You should see something like this after you widen the Other column.

Portmon screenshot

In the screenshot you can see two commands being sent (1 block of 6 bytes for each command), and two responses coming back (6 blocks of 1 byte for each response). Remember that the display is using hexadecimal numbers, so the first command is 14 hexadecimal or 20 decimal (move absolute).

HHD Serial Monitor

The best replacement I've found for Portmon is HHD Serial Monitor. It's not free, but it has a trial period, and the license is pretty cheap. I think it might be more powerful than Portmon, but it's not as easy to use.

Here are the settings I found to be useful for logging Zaber device commands. After installing and starting the Device Monitoring Studio, I clicked on the serial port I want to monitor in the list of ports. That opens a list of available views, and I double click on Request View. On the right-hand side, I click the Start button. That opens the request view, and I click on the Complete tab.

Now when I send some commands to the device, I see read and write requests with hexadecimal and text display of the data. Here's the equivalent of the Portmon screenshot above.

HHD Serial Monitor screenshot

Again, the first command is 14 hexadecimal or 20 decimal (move absolute).

NI Spy or NI I/O Trace

Available with LabVIEW

This option isn't as easy to read, but it comes with LabVIEW, and you can read the documentation on how to start it. Here's a screenshot of the NI Spy tool. I think it came with older versions of LabVIEW.

NI Spy screenshot