6. Remote Interface

The Bridge12 MPS is equipped with a Serial Interface to allow control of the system remotely from a computer. Communication is enabled using standard serial communication (RS232) over USB.

Warning

The remote interface should only be used by users familiar with the operation of the MPS. Please contact Bridge12 at support@bridge12.com if you have any questions about the serial interface.

6.1. Serial Port Configuration

The Serial Interface is configured with the following operation parameters:

Table 6.1 Serial Port Configuration

Parameter

Value

Baud Rate

115200

Data Bits

8

Parity Bit

No

Stop Bit

1

It is possible to communicate with the MPS through any serial terminal. Make sure the baud rate, number of data bits, number of parity bits, and the number of stop bits are set to the correct values (see Table 6.1).

6.2. Communicating with the MPS

Most likely, the Bridge12 MPS will perform a reset at the time the serial connection (socket) is established. This is very normal behavior of the interface. When developing customer applications to control the MPS through the serial interface, the serial socket should only be opened once when the customer program goes through its initialization routine. The serial socket is kept open until the customer application closes. Closing the serial socket is important, otherwise the remote computer may report an error.

When opening the serial socket the system will respond with the following message:

Bridge12 MPS Started

Once the system is initialized and ready the system will respond with the following message:

System Ready
Synthesizer detected

The user needs to wait for the System Ready statement before issuing any command. All commands that are issued before the System Ready message will be ignored.

6.3. Command Syntax

Commands are not case sensitive. When opening a serial socket to the MPS, the microcontroller will reset. Therefore, the serial socket should only be opened once and closed only after the last command is sent to the unit.

The general structure for sending a command is:

COMMAND VALUE <CR>

The general structure to query a value is:

COMMAND? <CR>

6.4. Python Package to Control the MPS

Bridge12 has developed a python package to control the MPS. The python package can be installed as a python module and its functionality can be integrated into user specific applications.

For more information about the package please visit pyB12MPS.

6.5. Description of Available Commands

Currently the following commands are implemented. If a special command is required, please contact Bridge12 at support@bridge12.com.

6.5.1. General Remote Commands

Table 6.2 Serial Port Configuration

Command

Description

Firmware

ampstatus

Set/Query amplifier power.

1.0.0

amptemp

Query amplifier temperature

1.3.1

firmware

Query firmware version

1.1.0

freq

Set/query microwave frequency in kHz

1.0.0

help

Get help instructions on serial port

1.0.0

id

Query MPS ID number

1.1.0

lockdelay

Set/Query frequency lock delay in ms

1.4.0

lockstatus

Set/Query frequency lock

1.4.0

lockstep

Set/Query frequency lock step in kHz

1.4.0

power

Set/query microwave power in dBm times 10

1.0.0

rfstatus

Set/Query RF status

1.1.0

rfsweepsw

Set/query the sweep width for cavity tune sweeps. The system has 4 predefined sweep widths, corresponding to integers between 0 and 3. The following arguments are allowed: 0 to set a sweep widht of 250 MHz, 1 to set a sweep widht of 100 MHz, 2 to set a sweep widht of 50 MHz, and 3 to set a sweep widht of 10 MHz.

1.5.4

rfsweepdosweep

Trigger a single cavity tune sweep through the serial interface. The values of the reflected power are stored internally in an array, which can be accessed using the rfsweepdata command. IMPORTANT: Any character sent to the serial interface will abort the current sweep. This functionality can be used to abort an active sweep.

1.5.4

rfsweepnpts

Set/query number of points of cavity tune sweep. The default is 50 points. The maximum number of points is 1024.

1.5.4

rxpowerdbm

Query Rx diode power in dBm times 10

1.0.0

rxpowermv

Query Rx diode reading in mV times 10

1.0.0

screen

Set/Query the current screen on the front panel. A value of 0 corresponds to the Main Screen. A value of 1 corresponds to the Tune Screen. A value of 2 corresponds to the Operate Screen.

1.4.0

serial

Query serial number

1.1.0

systemstatus

Query a selection of system variables. The command returns a list of comma separated values of system variables. The format is human readable: systemvariable1:value,systemvariable2:value ….

1.1.0

txpowerdbm

Query Tx diode power in dBm times 10

1.0.0

txpowermv

Query Tx diode reading in mV times 10

1.0.0

wgstatus

Set/Query Waveguide status

1.1.0

6.5.2. Specialized Remote Commands

The following list of serial commands is for reference only, and are typically not used in a day-to-day operation. Extreme caution should be used when using any of these commands since permanent damage can occur to the system if commands are used incorrectly.

Table 6.3 Special Serial Port Configuration

Command

Description

Firmware

ampgain

Set/query the amplifier gain on the fly. This parameter is used only for small adjustments during the calibration process. Users should not attempt to change this since it can cause permanent damage to the system.

1.5.5

debug

Enable debug mode. The following arguments are allowed: 0 - Debug mode disabled, 1 - Debug mode enabled, 2 - Verbose mode enabled

1.3.0

rfsweepdwelltime

Set/query the dwell time in microseconds between points when performing a cavity tune sweep. The default value is 110 us ms between each step.

1.5.5

rfsweepinitialdwelltime

Set/query the initial dwell time in milliseconds for the first point of the frequency sweep when performing a cavity tune sweep. The default value is 100 ms between each step.

1.5.5

rfsweeppower

Set/query the microwave power level used during a RF sweep. The default is 10 dBm. The maximum power available for a RF sweep is 20 dBm.

1.5.4

rxdiodesn

Query Rx diode serial number

1.1.0

txdiodesn

Query Tx diode serial number

1.1.0

6.6. Example using PuTTY (Windows)

Below is an example using PuTTY to communicate with the MPS. PuTTY can be downloaded from https://www.putty.org/. Please follow the instructions for installation.

To communicate with the MPS you first have to determine the COM port. This can be done using the Windows Device Manager. To open the Device Manager type

devmgm

into the search box and hit return. The Device Manager opens. Navigate to Ports (COM & LPT) and expand this section. Here, you will see MPS listed as Arduino Due Programming Port. Note down the COM port number.

To start communication using PuTTY follow these instructions:

  1. Start PuTTY

  2. In the PuTTY configuration window, click on Serial tab (all the way at the bottom)

  3. Enter the COM port number (from Windows Device Manager)

  4. Enter a Speed (baud) of 115200

  5. Return to the Session tab (all the way to the top right)

  6. Choose Serial as connection type. In Serial Line the correct COM port should be displayed and under Speed a speed of 115200 should be displayed

  7. Click the Open Button to start communication

Once you click the open button a new window will open. You will hear clicks from the MPS and the system will reboot and initialize. This will take a few seconds. In the new window you will see a few messages similar to this:

====================
Bridge12 MPS Started
====================
System Ready
Synthesizer detected

You are now ready to send commands to the MPS. For example to set a frequency of 9.543210 GHz type

freq 9543210

Depending on your settings and the type of serial terminal application you are using, you may not see the command that your typing and there will be no response for a correct command unless it is a query, in which case the value of the variable will be returned. If the syntax is not correct the MPS will answer with an error:

freq 954321
ERROR

(Note: this command creates an error since the frequency has to be entered in kHz.)

To close the COM port, simply close the PuTTY window.

6.7. Example with pySerial

Below is an example about how to use the MPS serial interface using pySerial. A MPS specific python package ( pyB12MPS) is available for more convenient remote control of the MPS.

import serial
import time

# MPS Serial Port
serialPort = 'COM5'

# Start Serial Connection
ser = serial.Serial(serialPort,115200,timeout = 1.)
time.sleep(0.1)

system_ready_string = 'Synthesizer detected'

# Initialize MPS
while not is_system_ready:
    time.sleep(0.1)
    bytes_in_waiting = ser.in_waiting
    if bytes_in_waiting > 0:
        read_bytes = ser.readline()
        read_string = read_bytes.decode('utf-8').rstrip()
        print(read_string)
        if read_string == system_ready_string:
            is_system_ready = True

# Command to send to MPS
command = 'freq 9400000\n'

# Encode MPS command (convert to bytes)
command_bytes = command.encode('utf-8')

# Send command to MPS
ser.write(command_bytes)

6.8. Error Codes

If the system does not recognize a command that was sent through the serial interface, it will return an error code. In Table 6.4 the system error codes are listed together with a description. If neither the debug nor the verbose mode is enabled, no acknowledgement will be returned if the command has the correct syntax. Enabling the debug

Table 6.4 Special Serial Port Configuration

Error Code

Description

E001

Value out of range.

E100

USB shield error. Please contact Bridge12 at support@bridge12.com.

E101

USB shield error. USB shield failed to send data. Please contact Bridge12 at support@bridge12.com.

E102

Temperature sensor not recognized.

E999

The command was not recognized, either because the command does not exist or because of a typo. The same error code is returned if the command was sent without a question mark (query).