Stepper Motor Control (Receiver Optics & Secondary Mirror)

Contents

Stepper Motor Controller Overview

Stepper motors are used to move the secondary mirror, heterodyne receiver optics and instrument rotators at the Cassegrain focus. These motors are connected to either one of three stepper motor controllers (SMCs) called SMC1, SMC2 and SMC3. (They are actually VMEbus DSP modules with four or five stepper motor interface cards and one serial communication card.) These controllers are located at the bottom of the Sidecab rack and connected to the antenna computer in the AOS room by asynchronous serial lines.

Stepper motors are usually controlled by the telescope control software (TCS). However, you sometimes have to control them manually. There are several ways to communicate with the SMCs; you can connect a dumb terminal or PC running any terminal emulation software directly to SMCs' serial port (9600 bps, 8 bits, 1 stop, no parity, no flow control), or you can use kermit from the antenna computer (with the same communication parameter, kermit to /dev/sio4, /dev/sio5 and /dev/sio6 for SMC1, SMC2 and SMC3, respectively). The preferred way, however, is to use a program called smc, which are explained below in detail.

Note that UIP macros SMC1, SMC2 and SMC3 do not work yet.

Software Overview

Once you logged on to the antenna computer, SMCs can be controlled directly by a program called smc. It resides in /usr/local/cso/bin, which should be accessible by default. It takes a SMC number (1, 2 or 3) as its (only) command line argument. For example, type:

hau$ smc 1

to control SMC1. There are three shell scripts, smc1, smc2 and smc3, for your convenience.

To make common tasks easier, there are several other shell scripts. For example, you can use the shell script secondary.home to home the secondary mirror as:

hau$ secondary.home

instead of running the smc program (or the smc3 shell script) and typing several commands manually.

The program smc and all the SMC shell scripts can in principle be used while the TCS is running. However, the result is not always safe or predictable if commands from more than one program are interleaved. For example, you do not want to reset the SMC3 when the TCS is trying to adjust the secondary mirror focus. On the other hand, it is probably safe to play with the SMC1 and SMC2 if the TCS is not trying to switch from one heterodyne reciever to another (i.e. if you do not issue the LO command from the UIP). It is necessary to reload the antenna computer once you reset the SMCs and homed the motors.

SMC Program

There are only several commands you usually have to use: reset, load, home, send and exit. Here is a brief description of these commands:

The reset command resets the SMC and communication parameters by software. If this command hangs, you have to ^C-out and restart the smc program, then issue the reset command again. If it still hangs, you probably have to power-cycle the SMCs.

The load command loads all the necessary macros to the SMC. You have to issue this command after the reset command.

The home command homes one of the motors if you give the motor number (1, 2, ...) as an argument (e.g. home 2), or homes all the motors (see note about homing the instrument rotators) if you type home all. Homing stepper motors may take a few minutes. You should hear funky sound while motors are being homed.

The send command takes a double-quoted string ("...") as its argument, sends it to the SMC, and prints the response if any. The following three forms are most commonly used: send "ts", send "tp", and send "to", to print the status information (like homed, busy, etc.), absolute position, and encoder reading of all the motors active, respectively.

The exit command terminate the smc program gracefully. It closes the serial device and releases the mutex (explained below) if it is locked. Note that the interrupt handler for ^C also invokes the same cleanup routines.

In addition, lock and unlock commands are useful. The lock command locks the mutex and the unlock command unlocks the mutex. Operations guarded by these commands are guaranteed to be atomic. Note that each command or each access to the SMC is guaranteed to be atomic without the use of lock and unlock.

Shell Scripts

Here is the list of SMC-related shell scripts currently available:

Homing the Secondary Mirror (SMC3)

To home the secondary mirror's focus, vertical, horizontal and rotary motors, log on to the antenna computer and run the shell script secondary.home:

hau$ secondary.home
Opening SMC3... done
Resetting SMC3... done
Loading macros to SMC3... done
Homing motor #1 of SMC3... done
Homing motor #2 of SMC3... done
Homing motor #3 of SMC3... done
Homing motor #4 of SMC3... done
     ...snip...
hau$

Or, alternatively, you can use the shell script smc3 and issue commands as explained below. Note that you have to type only the letters shown like this:

hau$ smc3
Opening SMC3... done
smc3> reset           // see note below
Resetting SMC3... done
smc3> load            // see note below
Loading macros to SMC3... done
smc3> home all        // all motors
Homing motor #1 of SMC3... done
Homing motor #2 of SMC3... done
Homing motor #3 of SMC3... done
Homing motor #4 of SMC3... done
smc3> status
Motor 1: status =         74 = armed complete homed
Motor 2: status =         74 = armed complete homed
Motor 3: status =         74 = armed complete homed
Motor 4: status =         74 = armed complete homed
smc3> exit
hau$

Note that the reset and load commands are optional. If you reset the controller, however, it is mandatory to load macros.

Homing the Sidecab Receiver Optics (SMC1 & SMC2)

To home the Sidecab receiver optics (the fourth mirror's linear and rotary motors, the fifth mirror's vertical, horizontal and rotary motors, and two receiver dewars' focus), log on to the antenna computer and run the shell script sidecab.home:

hau$ sidecab.home
Opening SMC2... done
Resetting SMC2... done
Loading macros to SMC2... done
Homing motor #1 of SMC2... done
Homing motor #2 of SMC2... done
Homing motor #3 of SMC2... done
Homing motor #4 of SMC2... done
Homing motor #5 of SMC2... done
     ...snip...
Opening SMC1... done
Resetting SMC1... done
Loading macros to SMC1... done
Homing motor #1 of SMC1... done
Homing motor #2 of SMC1... done
     ...snip...
hau$

Or, alternatively, you can use the shell script smc2 and smc1 and issue commands as explained below. Note that you have to type only the letters shown like this:

hau$ smc2
Opening SMC2... done
smc2> home all        // all motors
Homing motor #1 of SMC2... done
Homing motor #2 of SMC2... done
Homing motor #3 of SMC2... done
Homing motor #4 of SMC2... done
Homing motor #5 of SMC2... done
smc2> status
Motor 1: status =         90 = armed complete negative homed
Motor 2: status =         90 = armed complete negative homed
Motor 3: status =         90 = armed complete negative homed
Motor 4: status =         74 = armed complete homed
Motor 5: status =         90 = armed complete negative homed
smc2> exit
hau$ smc1
Opening SMC1... done
smc1> home all        // motor #1 & motor #2
Homing motor #1 of SMC1... done
Homing motor #2 of SMC1... done
smc1> status
Motor 1: status =         74 = armed complete homed
Motor 2: status =         74 = armed complete homed
Motor 3: status =         10 = armed complete
Motor 4: status =         10 = armed complete
smc1> exit
hau$

Like the SMC3, resetting and loading macros are optional (not shown above). Note that it is very important that you home the SMC2 first. Otherwise, you might rotate the fifth mirror (motor 2 of the SMC1) into the local chains and bust them. Homing the SMC2 first insures that both the receiver dewars are at the safe position, away enough from the fifth mirror.

Power-cycling SMCs

We have a new VMEbus enclosure for the SMCs (we stole it from SMA). A power switch is now on the front panel, at the bottom-right corner.

You should wait for at least ten seconds before you turn the power back on. You have to reset, load macros and home all the motors for all the SMCs after cycling the power.

Troubleshooting SMCs

Restarting Antenna Process

First restart the antenna process to reopen the communication link between the antenna computer and the SMCs:

UIP> ANTENNA /RESTART /NOSYNCHRONIZE
Deleting process WEATHER_LOG
Deleting process Tau monitor
Deleting process ACQ_CLIENT
Deleting process ANT_MCP
Restarting ANT_MCP...
Restarting ACQ_CLIENT...
Restarting Tau monitor and WEATHER_LOG...
UIP>

Then issue the FOCUS command and the LO command (with the /FORCE option) and see if there appears any error message like "SMC3 not responding" on the status display:

UIP> FOCUS
UIP> LO 12CO2-1 /FORCE
Do you want to move the sidecab mirrors? [N]Y
Initiating movement of the sidecab mirrors
Pausing to switch LO matrix and downconverter
UIP>

Checking Semaphores

Run the program showsems on the antenna computer to list the status of counting semaphores for the SMCs. The values of /sem_smc1, /sem_smc2 and /sem_smc3 should be one:

hau$ showsems
/sem_smc1:      1
/sem_smc2:      1
/sem_smc3:      1
     ...snip...
hau$

If not, first check if there is any smc program running or if the UIP is executing the FOCUS, LO or any other command which may change the status of the secondary mirror, receiver mirrors or instrument rotators. If the smc program is already running, then stop it. Do not send any UIP command.

If any one of those three semaphores is still zero or negative, use the program rmsems to delete it. The smc program explained below will create a new one automatically:

hau$ showsems
/sem_smc1:      1
/sem_smc2:      0
/sem_smc3:      1
     ...snip...
hau$ rmsems /sem_smc2
hau$ showsems
/sem_smc1:      1
/sem_smc2:      does not exist
/sem_smc3:      1
     ...snip...
hau$

Checking SMCs

Run the program smc for the SMC you are having a problem and check if it is responding:

hau$ smc1
Opening SMC1... done
smc1> status
Motor 1: status =         74 = armed complete homed
Motor 2: status =         74 = armed complete homed
Motor 3: status =         10 = armed complete
Motor 4: status =         74 = armed complete homed
smc1> exit
hau$

If the smc program hangs, you have to reset the SMC and home the motors as explained here, or you may have to power-cycle the SMCs and home all the motors as explained in the next section.

Restarting Antenna Process

If the SMC is responding, restart the antenna process once again as explained above.

Setting Up SMCs

The following is a procedure to set up the SMCs for normal telescope operations:

  1. Power-cycle SMCs
  2. Reset semaphores
  3. Software-reset SMCs and load macros
  4. Home receiver mirrors
  5. Home secondary mirror
  6. Restart antenna process

More information about SMCs and related software can be found here.

Power-cycling SMCs

Power-cycle the SMCs in the receiver room. Wait for one minute before turning the power on.

Resetting semaphores

Run the program showsems on the antenna computer to list the status of counting semaphores for the SMCs. The values of /sem_smc1, /sem_smc2 and /sem_smc3 should be one:

hau$ showsems
/sem_smc1:      1
/sem_smc2:      1
/sem_smc3:      1
     ...snip...
hau$

If not, first check if there is any smc program running or if the UIP is executing the FOCUS, LO or any other command which may change the status of the secondary mirror, receiver mirrors or instrument rotators. If the smc program is already running, then stop it. Do not send any UIP command.

If any one of those three semaphores is still zero or negative, use the program rmsems to delete it. The smc program explained below will create a new one automatically:

hau$ showsems
/sem_smc1:      1
/sem_smc2:      0
/sem_smc3:      1
     ...snip...
hau$ rmsems /sem_smc2
hau$ showsems
/sem_smc1:      1
/sem_smc2:      does not exist
/sem_smc3:      1
     ...snip...
hau$

Software-resetting SMCs and loading macros

Run the program smc on the antenna computer to reset the SMCs and load macros necessary for telescope operations:

hau$ smc1
Opening SMC1... done
smc1> reset
Resetting SMC1... done
smc1> load
Loading macros to SMC1... done
smc1> exit
hau$ smc2
Opening SMC2... done
smc2> reset
Resetting SMC2... done
smc2> load
Loading macros to SMC2... done
smc2> exit
hau$ smc3
Opening SMC3... done
smc3> reset
Resetting SMC3... done
smc3> load
Loading macros to SMC3... done
smc3> exit
hau$

If the reset command hangs, type ^C, restart the smc program, then try the reset command again:

hau$ smc1
Opening SMC1... done
smc1> reset
Resetting SMC1... ^C
hau$ smc1
Opening SMC1... done
smc1> reset
Resetting SMC1... done
smc1>

If the reset command still hangs after several retries, you have to power-cycle the SMCs again.

Homing Receiver Mirrors

Home the receiver mirrors by running the shell script sidecab.home on hau:

hau$ sidecab.home
Opening SMC2... done
Resetting SMC2... done
Loading macros to SMC2... done
Homing motor #1 of SMC2... done
Homing motor #2 of SMC2... done
Homing motor #3 of SMC2... done
Homing motor #4 of SMC2... done
Homing motor #5 of SMC2... done
     ...snip...
Opening SMC1... done
Resetting SMC1... done
Loading macros to SMC1... done
Homing motor #1 of SMC1... done
Homing motor #2 of SMC1... done
     ...snip...
hau$

Homing Secondary Mirror

Home the secondary mirror by running the shell script secondary.home on hau:

hau$ secondary.home
Opening SMC3... done
Resetting SMC3... done
Loading macros to SMC3... done
Homing motor #1 of SMC3... done
Homing motor #2 of SMC3... done
Homing motor #3 of SMC3... done
Homing motor #4 of SMC3... done
     ...snip...
hau$

Restarting antenna process

First reestablish the connection to the antenna computer and restart the necessary programs:

UIP> ANTENNA /RESTART /NOSYNCHRONIZE
Deleting process WEATHER_LOG
Deleting process Tau monitor
Deleting process ACQ_CLIENT
Deleting process ANT_MCP
Restarting ANT_MCP...
Restarting ACQ_CLIENT...
Restarting Tau monitor and WEATHER_LOG...
UIP>

Then try the FOCUS command and the LO command and make sure you do not get any error messages on the status display:

UIP> FOCUS
UIP> ZA 44
UIP> LO 12CO2-1 /FORCE
Do you want to move the sidecab mirrors? [N]Y
Initiating movement of the sidecab mirrors
Pausing to switch LO matrix and downconverter
UIP>