PMAC-VME for the Bewildered


The PMAC motor controller is a very complicated beast. These are my notes for working on them and getting them running.

Intended outline


Setting up the PMAC-VME

• Serial Communications

After plugging the PMAC into the VME crate, you'll probably want to talk to it. Before you can talk to it through the VME bus, you'll need to set up its VME address. This is done via the serial port (J4 on our PMACs). To connect this to a computer, you will need a cable with the following pin-out:
DB9 123 456 789
26-pin J4 1553 141311 7918

Jumpers E44-E47 determine the baud rate. The communications are 8-N-1 by default, but if E49 is "off," it's odd parity. XON/XOFF is not supported.

While you are communicating with the PMAC through the serial cable, nothing should be trying to access it through the VME bus. To quote from the PMAC manual:

Either the serial port or the bus port is the active response port....
PMAC powers up/resets with the serial port as the active response port.
However, any command received over the bus port makes the bus port the
active response port....

A subsequent command from the serial port does not automatically make
the serial port the active response port again, so it is possible that PMAC
will respond to a command over the serial port by sending data to the bus 
port.... To make the serial port the active response port again, you must 
send a <CNTRL-Z> to PMAC.
Therefore, if EPICS is running on the crate you are working with, it should be turned off.

To check communications, type requests for data, such as "I0" (India-zero). The response should be the value of the variable. The following variables set certain communication paramaters:

I1 Serial Port Mode = 0: CS Handshaking, no serial address used
I2 Control Panel (JPAN) = 0: Enable
= 1: Disable
= 3: Enable DPRAM functions (our default)
I3 Acknowldege receipt of command = 0: return nothing
= 1: return <LF>, precede output with <LF>
= 2: return <ACK>
= 3: return <ACK>, precede output with <LF>
I4 Data Checksum = 0: Disabled, report errors immediately
I6 Error Reporting = 1: <BELL>ERRnnn<CR>
= 3: <BELL><CR>ERRnnn
I9 Data Response Format = 0: short/decimal
= 1: long/decimal
= 2: short/hex
= 3: long/hex

To set a variable, simply type {variable}={value}. For example, to set variable I9 to report back long responses in hexidecimal, type:

I9=3
and hit return.

When you can reliably talk to the PMAC through the serial port, it's time to set up VME communications.

• VME-bus Communications

The next order of business is to set up the PMAC's VME address and communications. The address is purely determined by the avaliable address space in your VME crate. These are the relavent fields which need setting:

Description Our Default Byte Address (PMAC 1) I-Variable (PMAC-Turbo)
Address Modifier: $29=A16, $39=A24, $09=A32 $09 X:$0783 I90
Address Modifier "don't care" bit $04 X:$0784 I91
Base address (Byte 3) $80 X:$0785 I92
Base address (Byte 2) $7F X:$0786 I93
Base address (Byte 1)
Start at "$A0" and climb by 2's for each PMAC in crate (bit 8 must be zero)
$Ax X:$0787 I94
Interrupt Level ($01-$07 valid) $02 X:$0788 I95
Interrupt Vector Pair (latter)
Start with $A1 (specifying $A0=data received and $A1 = data ready to send) and climb by 4's
  X:$0789 I96
Bits 23-20 DPRAM address
Bits 31-24 are the same as the base address
Bits 19-14 are specified by the host computer every time the system is powered up or reset.
$70 X:$078A I97
DPRAM Enable ($E0=Enable, $60=Disable) $E0 X:$078B I98
Address Bus Width/DPRAM
16-bit: $30, 24-bit $10, 32-bit $00 (no DPRAM)
16-bit: $B0, 24-bit $90, 32-bit $80 (w/ DPRAM)
$80 X:$078C I99


For PMAC model 1, these values must be written into "X" memory. To read or write these values, we must use the following commands:

R[H]{address}[,{no. of bytes}]

So, to read the bytes before setting them you can use the command:

RHX:$0783,10

To write the data, we use the "W" command which is simply

W{address},{value}[,{value}...]

For example,

WX$0783,$09,$04,$80,$7F,$A2,$02,$A5,$70,$E0,$80
would take care of the second PMAC in our VME crate.


At this point, double check the settings and send the save command to load the parameters into non-volitale memory. Then reset the card with the $$$ command.


PMAC Variables

The PMAC has a large number of variables that tell it how to move. These variables are all stored on the card in non-volitle memory

The save command must be used to store these variables in memory before the card is powered down or reset.

• I-Variables

The "I" variables store the card's initialization parameters. The variables are broken into "general" and "motor-specific."

The 160 general I-variables run from I0-I99 and from I940-I999. We have already seen a few above in setting up communications correctly.

The motor-specific I-variables are grouped by hundreds. I100-I199 are for motor #1, I200-299 are for motor #2, etc. The standard method of specifying a particular motor-specific variable without specifying the exact motor is to use an "x" in the hundreds spot: Ix00, for example. This variable enables or disables motor "x."

At the most basic level, the following I-variables must be correctly set:

Description PMAC 1 (Default) PMAC TURBO (Default) Notes
Motor Enable Ix00 (1) Ixx00 (1) 1=Motor Enabled
Motor Commutation Ix01 (0) Ixx01 (0) Motor is not commutated by PMAC
(Typical for our DC servo motors)
Address of output DAC x Ix02 ($C003) Ixx02 ($078003) Default address is for first motor only. Check documentation for other motors.
Address of Position Encoder x Ix03 ($720) Ixx03 ($003501) Default address is for first motor only. Encoder addresses are sequential. Should equal Ix(x)04
Address of Velocity Encoder x Ix04 (equal to Ix03) Ixx04 (equal to Ixx03) Should equal Ix(x)03
Address of Limit and Home Flags x Ix25 ($A0C000) Ixx25 ($078000?) For PMAC 1, bits 16-19 control the usage of these flags. For PMAC TURBO, this is done by Ixx24. Limit addresses are sequential by 4's
DAC x output range Ix69 (32767) Ixx69 (32767) max = 32767 = 10V
Method of decoding the encoder I900 + 5(x-1) (7) I7mn0 (7) 3 = CW x4
7 = CCW x4
Encoder Digital Filtering I901 + 5(x-1) (0) I7mn1 (0) 0 = On
1 = Off
Encoder Position Capture Control I902 + 5(x-1) (1) I7mn2 (1?) Used for homing. 1 = third channel, rising edge (whatever *that* means)
Encoder Flag Select I903 + 5(x-1) (2) I7mn3 (2?) Used for homing.
0 = Home Flag (PMAC default, but we don't use a home switch)
1 = Negative Limit
2 = Positive Limit

# Addresses---where to find things

The PMAC 1 uses 16-bit addressing, however, some of the I-variables can have a 8-bit "mode" prepended to the address.

InputEncoderLimit/Home FlagsDAC
1$0720$C000$C003

ModeAddressDescription
$01FlagDisable Amplifier ENAble line
$02FlagIgnore limit switches
$03Flag Disable Amplifier ENAble line and Ignore limit switches

Once you can move the motor a little with the commands listed below, here are the movement I-variables that need to be tuned:

Ix11 Fatal Following Error Limitcounts
Ix19Maximum accelerationcounts/ms2
Ix20 Acceleration timems
Ix21 S-curve timems
Ix22 Jog Speedcounts/ms
Ix23 Homing Jog Speedcounts/ms
Ix30 Proportional Gain Value
Ix31 Derivative Gain Value
Ix32 Velocity Feed-forward Gain Value
Ix33 Integral Gain Value
Ix63 Integration Limit
Ix67 Big Step Limitcounts?

Ix90Coordinate System "x" Time Unitms


Useful PMAC Commands

• Motion

CommandDescription
#n Tells PMAC to address all further motor commands to motor "n"
PReport position of motor
KKills DAC output for motor
OxxOpen-loop drive at xx% (can be negative)
J+"Jog-forward" Closed-loop forward motion
J-"Jog-reverse" Closed-loop reverse motion
J/"Jog-stop" Closed-loop hold-position
HM"Home" Perform a homing move and reset the counter

• Coordinates

CommandDescription
& Return current coordinate system
&n Tells PMAC to address all further commands to coordinate system "n"
#n->[scale]{X,Y} Set motor "n" as axis X (or Y) with a scale factor of "scale"


At this point, reference this internal page for the motion programs and m and q variable definitions. I'll make these globally avaliable as I tease them out.

EPICS

How EPICS interfaces with this device will be interesting to learn....

Motor Hardware Connections

Here are some notes about our hardware set-up:

• From PMAC-VME P2 to Motor Amp

No notes yet.

• From Motor Amp to Servo Motor Amplifier Buffer

No notes yet.

• From Servo Motor Amplifier Buffer to Motor Break-Out Box

The 36-pin cable that connects the SMAB to the Break-Out Box has the following pin-outs:
  ____                                          ____
 /    |                                        |    |
|19 18|                                        |10 9|
|     |                                        |8  7|
|     |  36-pin Centronix "D" connector        |6  5 ]  10-pin ribbon cable
|     |                                        |4  3|
|36  1|                                        |2  1|
 \____|                                        |____|

 1 - JM1                           36 - JM2
 2 - Drive +                       35 - Drive -
 3 - Drive +                       34 - Drive -
 4 - +5 V (pin 2/10-pin)           33 - +5 GND (pin 3/10-pin)
 5 - Encoder A (pin 5/10pin) JM4   32 - Encoder B (pin 7/10pin) JM5
 6 - (pin 9/10pin)           JM6   31 - (pin 4/10pin)
 7                                 30
 8 - GND                           29 - GND
 9 - + OverTravel Normally Open    28 - + OverTravel Normally Closed
10 - + Limit Normally Open         27 - + Limit Normally Closed
11 - Home Normally Open            26 - Home Normally Closed
12 - - Limit Normally Open         25 - - Limit Normally Closed
13 - - OverTravel Normally Open    24 - - OverTravel Normally Closed
14 - GND                           23 - GND
15 - Address 0 JM3                 22 - Address 1 JM3
16 - Address 2 JM3                 21 - Address 3 JM3
17 - Address 4 JM3                 20 - Address 5 JM3
18 - Address 6 JM3                 19 - Address 7 JM3
The other end of the limit/home/overtravel switches lives on the GND line.

• Break-out Box to Motor

The Break-out box has six jumper blocks that can be set:
JM1 - Ties Centronix pin 1 to ground
JM2 - Ties Centronix pin 36 to ground
JM3 - Sets address of motor by tying Centronix pins 15-22 to ground
JM4 - Encoder Type:  Will read [5] (5k-type) or  [1] (6k-type)
JM5 - Encoder Type:  Will read [7] (5k-type) or  [8] (6k-type)
JM6 - Encoder Type:  Will read [9] (5k-type) or [10] (6k-type)

• Motor Pin-out

1 - Drive +
2 - +5 V
3 - Encoder A
4 - Encoder B
5 - GND
6 - Drive -

This page CONSTANTLY under construction...

...but not yet up to date with my brain (or, actually, my notes, because, as Thomas Dolby put it: "My Brain is Like a Sieve").