IO ports
Output and Input Ports (PA and PB)
The controller comes with OUTPUT and INPUT ports. These correspond to the terms PA and PB in the documentation. OUTPUT (PA) is a Dsub 15 pin female port on the back, and INPUT (PB) is a Dsub 9 male port. Both ports are in a horizontal orientation.
Note that in standard Dsub 15 pin numbering, the female pins are read right-to-left, and the male port pins are read left-to-right.
OUTPUT (PA) port pins
8 7 6 5 4 3 2 1
o o o o o o o o
o o o o o o o
15 14 13 12 11 10 9
+ + + + + - -
INPUT (PB) port pins
1 2 3 4 5
. . . . .
. . . .
6 7 8 9
Internally, the first row of PA pins connect to two ULN2068B devices. They are socketed, which is nice from a maintenance standpoint. The "u" notch is positioned pointing towards the connector header on the board, which then goes to the exterior port on a ribbon cable.
The ULN2068B is a quad-Darlington pair device. Each Darlington pair has K, C, and B pins. C is the collector, and B is the base.
The base pin of each Darlington pair goes through a resistor array and back to the controller somewhere.
Each collector (C) pin is connected to one of the PA port input pins. The physical positioning of each device allows easy connection of pins 8, 2, 16, and 10 to one set of header pins, and in the same order, 8, 2, 16, and 10 to the other set of header pins. As such, the first device's four collectors go to pins 1, 2, 3, and 4, and the other device's four go to pins 5, 6, 7, and 8.
The pin B connections aren't as visible, but I was able to test connectivity by removing the chips from their sockets and doing a continuity test between the pins and the resistor array points.
The output port's lower pins are set up as V+ (pins 15, 14, 13, 12, 11), and ground (GND) (pins 10, 9). As expected, the associated wires are colored red and black on the corresponding internal cable.
Measuring the voltage output across pins 9 and 14, for example, yields +12VDC.
For testing, I used a step-down buck converter to bring the +12VDC down to +5VDC. Then, I set up a test circuit on each pin as:
For each pin i in range (1..8)
+12v (9) -> step-down +5v -> 330 ohms -> LED+ -> LED- -> PA pin i
GND (14) -> step-down GND
Note that on my buck converter, the input and output ground lines are common, and I do not connect the output GND to anything.
All eight pins share the same +5v output, but have individual output paths.
Also, the GND pins on the PA port appear to connect to case ground.
Software activation of PA pins
To activate an output pin (i.e., to allow the flow of current through a collector), there are convenience functions in ROBOFORTH called PA n ON or PA n OFF. Note that the n value here is in the range 0..7.
TBD: I think the pins are in reverse order, too. That is, PA 0 ON turns on Dsub15 pin 8, and PA 7 ON turns on Dsub15 pin 1.
Using the above test circuit, you can say "PA 1 ON" or "PA 3 ON", and one of the LEDs will be lit.
These functions for PA n are a shorthand for individual pin access. Later for the MultiIOcard, we'll see that QA, QB, and QC pin references are done in a different, binary or bit-aware way.
The R12 manual (page 6) has an odd warning, saying, "The gripper drive module uses PA 0 and PA 1 so PA 1 should not be used for any other purpose". However, it does not associate PA 0 nor PA 1 with physical pins. One page 14, it only shows connections between pins 8 (black) and 11 (red). We now see that what they're describing is a device the gripper is provided +12v on pin 11, and it drains back to pin 8 when the corresponding ULN2068B base pin is activated by saying "PA 0 ON".
I think that if you don't have a standard gripper end-effector, and don't use the built-in GRIP and UNGRIP functions, then the restriction on PA 0 and PA 1 usage isn't applicable.
Naming conventions
As it turns out, there is a bit of a hidden naming convention in the IO pins. "A" is for output, and "B" is for input. There's also "C" that has half input and half output, as we'll see later.
PB wiring
I have not yet tested the input
MultiIOcard ports
The MultiIO card, once wired up, gives you access to potentially three more Dsub25 "digital" male ports, plus an additional Dsub25 Analog female port. Mine only came partially configured, so there are only two of the Dsub25 "digital" male ports.
The MultiIO card (see MultiIOcard.pdf) is similar to what is depicted in MultiIOcard.pdf, page 2, but in my controller, the layout is a bit different. The Gecko drives are positioned underneath a stack of cards that share a bus, and the boards are rotated 90 degrees clockwise compared to the picture.
Still, the junctions are as depicted. J4 connects to the port labeled QQ, and J5 connects to QR. I do not have the large IC shown in the upper part of the board, and I do not have a connector or Dsub25 represented as RR.
The analog Dsub25 female, AN, is connected to junction points J2 and J3.
QQ and QR were unlabeled on the outside of my controller box.
Naming conventions
As it turns out, the names QQ, QR, and RR are associated to halves of the Dsub25 for different purposes. QQ (J4) handles the QB and QC pins. QR (J5) is meant to be shared between QA pins and RB pins, though for my controller, the "R" bank isn't working, presumably because that IC is missing from the board. RR would then represent the RA and RC pins.
This mapping of QA,QB,QC and RA,RB,RC can be found on page 4 of the MultiIOcard.pdf document.
As mentioned earlier, "A" means output, "B" means input, and "C" provides 4 pins for input, and 4 for output.
The physical-to-logical layout of the pins is described on page 4 as well. But, the indication of "which pins on QC are for what purpose" isn't described.
Testing the QQ and RR ports
The MultIOcard.pdf document page 3 shows a sequence of commands used to test the proper output activity on QQ and RR, but doesn't really describe what's happening behind the scenes, nor does it describe how to test the input pins. You first run a "PROGPIA" command. It's not clear what that does, but it appears to activate the MultiIOcard. Then, you run the "HEX" command which enables dictionary words 00..FF. With that, you can use the command hh QA OUT to send a hex byte hh to the port. To read the value back in, you use QA IN X. (declare QA as the port you want, IN pulls the data byte from it, and X. prints the value in hexadecimal).
If the value written matches the value pulled back in, then the chip is working.
Even with that test defined, you may want to test for a valid connection from there through the HE headers to the actual output Dsub25 pins.
Software activation of QA pins
Unlike the PA port, where the port activation opens up a collector to ground, the QA output ports actually emit +5v when activated, and 0v when not activated.
The pin table shown on page 4 of MultiIOcard.pdf does not show the association of QA bits to corresponding QA0..QA7 references.
To work with the QA output pins, you can use the n QA OUT command. This can be done in decimal values, but to me it's more easily "visualized" using hex values. So, I prefer to say something like
> PROGPIA
> HEX
> AA QA OUT
> 55 QA OUT
> 1C QA OUT
Similar applies for the QC port, but only the highest 4 bits are used for output (0x80, 0x40, 0x20, and 0x10 bits, combined with OR as desired).
> DECIMAL
Software input on QB pins
The input ports can be read as an entire byte, or using individual pin references.
To read a full byte, you can use the IN and X. commands as shown earlier:
> QB IN ( get a value from QB onto the stack )
> QB IN X. ( get the value from QB and print it in hexadecimal format )
To read individual bits, you can AND the values with a bit mask
> DECIMAL
> QB IN 16 AND .
allowing you to test an individual bit or a set of bits at once.
The document tutorial5-axis.pdf, page 50, also shows that the BIT? operation can be used for individual bit tests.
> QB 5 BIT? . 32 OK
You can also do a WAIT operation to loop until you see a transition from 0 to 1, or 1 to 0, e.g.,
> QB 5 1 WAIT ( wait for bit 5 to transition from 0 to 1 )
I have not tested the WAIT operation yet.
Note that for both the BIT? and WAIT operations, the bit number (e.g., 5 above) is in the 0..7 numeric range, not 1..8. Also, the WAIT operation has a built-in STOP check.
Danger
The pins for each of the Dsub25 connections does not appear to go through a socketed device, as was done for PA. It also does not appear to have any optoisolation as might be found on an IO1 card (see IO1 card.pdf). One safety approach that might be worth pursuing is to create an opto-isolation board for QB and QC inputs (12 of the pins of QQ/J4).
The headers for Dsub25 for each of QQ, QR, and RR, are physically the same. However, their purposes are quite different.
Comparing the "first" 8 pins of each Dsub25 (pins 1, 14, 2, 15, 3, 16, 4, 17):
QQ (J4) pins are "B" inputs QB0..QB7
QR (J5) pins are "A" outputs QA0..QA7
RR (J6) pins are "C" ins and outs RC0..RC7
Because of this, be very careful in what you attach to the pins. A given test circuit for one has the potential to blow up another.
Electrical characteristics
The pin limits are not described. For example, it's not clear what the max current draw is for the QA output pins. I've made the assumption that they're about as limited as an Arduino, so my test circuits have LEDs with 330 ohm resistors in series, and that has worked so far.
As with the input pins, it may be a good idea to opto-isolate external circuitry from the QA pins. Since I can light up a visible LED, it's doable to light up the internal LED of an optoisolator.
Input pins test circuit
For the input pins on QB and QC, I set up a test circuit:
Each pin is pulled high to 5v, and if a jumper is added across the two header pins, the value goes low. As such, this is inverse logic. By default, QB pin values, using this circuit, yields a 1 bit, and adding the jumper yields a 0 bit.
These pins were set up on a board matching the QB pins: 1, 14, 2, 15, 3, 16, 4, 17.
Test: jumper on pin 1
> QB IN X. 00FE OK
Test: jumper on pin 2
> QB IN X. 00FB OK
Test: jumper on pin 7
> QB IN X. 007F OK
Output pins test circuit
For the eight QA pins and the upper four QC pins, the output test circuit is similar to what was used for PA, except that we don't need the step-down converter, because the voltage supplied on the output pin is already at +5v.QR port (J5), for each PIN_i (1, 14, 2, 15, 3, 16, 4, 17, aka QA 1..8):
PIN_i -> 330 ohms -> LED+ -> LED- -> GND (pin 18)
The ground line is shared across all LED cathodes.
QQ port (J4), for each PIN_i (8, 21, 9, 22, aka QC 5..8):
PIN_i -> 330 ohms -> LED+ -> LED- -> GND (pin 18)
Turning a QA or QC pin on turns the corresponding LED light on.
See mapping below for relationship of QA and QC pins to Dsub25 pins.
QA port and pin associations
NB: QR is the Dsub25 that correlates to J5. The first set of pins is for QA, and the latter set is for RB, but my MultiIO card was not configured to support the R pins, or its corresponding IC was removed for some reason.
NB: Examples of "n QA OUT" shown below must be preceded by the commands PROGPIA and HEX. You can, of course, use decimal equivalent values instead and use the command DECIMAL instead of HEX.
NB: +5v is on pin 5, GND is on pin 18 (as with all QQ, QR, RR ports, if wired properly).
QB port and pin associations
NB: QQ is the Dsub25 that correlates to J4
QC port and pin associations
Analog port
The analog port is a Dsub25 female port, oriented vertically, and positioned near the OUTPUT (PA) and INPUT (PB) ports.
It appears to be connected to the J2 and J3 junctions on the MultiIO card. Their function is not well described.
The tutorial5-axis.pdf (page 50) says:
When fitted there are 4 input channels to the ADC 0-3 and 2 DAC output channels A and
B. To read an input
0 ADC reads channel 0 and leaves the value on the stack.
0 DACA sends 0 volts out of DAC channel A
and then MultiIOcard.pdf has this brief blurb for testing:
Quick test of the analog input-output
Connect AN connector pins 2 and 8 (DACA to ADC channel 0)
Enter
0 DACA 0 ADC . - answer should be roughly zero
1000 DACA 0 ADC . – answer should be roughly 1000
etc.
Based on the descriptions, it seems that the ROBOFORTH variable name patterns are
DACA
DACB
0 ADC
1 ADC
2 ADC
3 ADC
Near J2 and J3, there are three socketed devices. All three are labeled 44AE0RG3 / LF / 412CN.
The closest I can find is a Texas Instruments device called LF412CN, "Low Offset, Low Drift Dual JFET Input Operational Amplifier". Its Applications suggested list includes "Fast D/A Converters".
Each LF412CN has two pairs of inputs (one inverting, one not) and two outputs. Thus it makes sense that having three of these would cover the four ADC plus two DAC functions above.
NOTE: Digikey says some versions of the LF412CN are obsolete. Presumably, the one I saw was obsoleted due to Pb content, given the name of this suggested substitute: https://www.digikey.com/en/products/detail/texas-instruments/LF412CN-NOPB/8893
The device pins are
1 OUTPUT A
2 INVERTING INPUT A
3 NON-INVERTING INPUT A
4 V-
5 NON-INVERTING INPUT B
6 INVERTING INPUT B
7 OUTPUT B
8 V+
Dsub 25 pin connections to op amps (LF412CN)
Since these are socketed, I removed the devices and found the following with just continuity testing. (ASCII depiction of Dsub 25 female port pins, port labeled AN.)
o 13 NC?
25 o
o 12 NC?
24 o
o 11 NC?
23 o
o 10 GND
22 o
o 9 GND
21 o
o 8 U3_7 (OUTPUT B), and R1 to ?
20 o
o 7 U3_1 (OUTPUT A), and R2 to ?
19 o
o 6 GND
18 o
o 5 U5_5 (NON-INV INPUT B), and R8 (1M) to GND
17 o
o 4 U5_3 (NON-INV INPUT A), and R7 (1M) to GND
16 o
o 3 U4_5 (NON-INV INPUT A), and R6 (1M) to GND
15 o
o 2 U4_3 (NON-INV INPUT A), and R5 (1M) to GND
14 o
o 1 GND
All pins 14..25 tone to GND
All GND lines are common, connecting to case GND.
R5..R8 are 1 M ohm.
Resistances for R1 and R2 are not yet measured, and it's not known what else they connect to, but it's not GND.
LF412CN and HE and AN pin associations
U4 and U5 are the LF412CN devices for the J2 socket.
Socket numbering, my way, J2 and J3 connector -- note 'V' key position. J2 corresponds to U3 and U4. J3 corresponds to U5.
The associations between J2 pins and AN pins is
The associations between J3 pins and AN pins is
More internal devices
On the J2/U4/U5 side of the board, there is a device labeled ADS7824P. It has a "BB" logo, which correlates to an online data sheet that says "Burr-Brown (TI)". That's a 4-channel, A/D converter.
On the J3/U3 side of the boards, there is a device labeled AD7237 JNZ / #1513 / AL83868, a "Dual 12-bit complete DAC with double buffered byte loading".
Analysis
The documentation says, "there are 4 input channels to the ADC 0-3". Given we have four pins on J2/U4/U5 connected to AN 2, 3, 4, and 5, and given the physical positioning of the ADS7824P, it looks like those are the Analog Input pins.
Similarly, the documentation says that there are "2 DAC output channels A and B", and we see two pins connected to J3/U3, and physically proximate AD7237. As such, it seems AN 8 and 7 are the Analog Output pins.
Then, recall the test above:
Quick test of the analog input-output
Connect AN connector pins 2 and 8 (DACA to ADC channel 0)
Enter
0 DACA 0 ADC . - answer should be roughly zero
1000 DACA 0 ADC . – answer should be roughly 1000
etc.
What they're really saying is:
AN 2 = ADC channel 0
AN 3 probably is ADC channel 1
AN 4 probably is ADC channel 2
AN 5 probably is ADC channel 3
AN 8 is DACA
AN 7 is probably DACB
If I got that right, then I think the documentation makes things a little confusing, only because the order of ADC vs DAC is reversed (they say pins 2 and 8 (DACA to ADC channel 0) where I think it would be better written as pins 8 and 2 (DACA to ADC channel 0).
Reference ground is available on a number of pins, but the proximate ones are:
ADC (J2, U4, U5): AN 2,3,4,5 have ground nearby (and represented in the connector) as AN 14, 15, 16, 17, 18 (nearest pins on the wide side, adjacent to 2, 3, 4, 5). But, you could also use AN 1 or AN 6 on the narrower side of the D sub 25.
DAC (J3, U3): AN 7,8 have ground nearby (and represented in the connector) as AN 19, 20, 21. But, you could also use AN 9 or AN 10 on the narrower side of the D sub 25.
What is the purpose of the three LF412CN devices?
It seems the LF412CN op amp U3 is there for the purpose of amplifying DAC output to the pins to a particular voltage level. Device pins 1 and 7 (OUTPUT A and OUTPUT B) find their way out to AN port pins.
It seems, also, that the LF412CN op amps U4 and U5 are there to reverse-amplify the ADC signals before they're provided to the ADS7824P. I suppose they also thereby provide some level of safety to the ADS7824P. If anything's going to blow up, it's the socketed U4 or U5 chip, not the ADS7824P.
Existing AN wired-up connector
The controller came with a Dsub25 male connector that had three wires attached. Orange = pin 2, unlabeled. Two gray wires = pin 17 and pin 18, which we know now are GND.
As such, that connector could have been used for ADC channel 0 testing, but safe voltage is not yet certain.
I re-wired it in order to be able to test against pins 2, 3, 4, 5 (input ADC), and 7, 8 (output DAC).
Voltage testing (DAC outputs)
Wire AN 7 and 8 for testing V+ output. Wire to correlated ground pins AN 19, 20, or 21. Shrink-wrap for safe insulation.
Connect to multimeter. Insulate/protect any unused wires for safety.
Issue values for the range 0..1000 DACA or 0..1000 DACB and report voltage results.
Test 1: AN 8 and GND
startup: 10v!
0 DACA = -10v
2048 DACA = 0V
4095 DACA = 10V
4096 DACA = -10V AGAIN!
3076 DACA = 5.03V
value is not affected by DE-ENERGIZE
Value is not properly controlled in a non-START condition.
> connect
> ROBOFORTH
> 3076 DACA = -9V
> START
> 3076 DACA = 5V
Connected to pin 7, DACB has similar controls, but what I'm seeing is a significant delay as the DAC output transitions.
First, on pin 7, at startup the pin is giving me around 4.37V, whereas DACA initialized at 10V.
> connect
> ROBOFORTH
> START
still at 4.37v
2048 DACB
0v
4095 DACB
10v
But then the next thing I'm observing is that the transition between values causes the DAC to dip to 0v before going to the new value.
3076 DACB
Multimeter shows 0v for a little bit, and then 5v.
4095 DACA
4095 DACB
So... in the end, good news and bad news (maybe?) on the DAC front.
Good news
- I'm pretty sure of my pin analysis. DACA is AN 8, and DACB is AN 7.
- Voltage can swing from -10V to 10V, PWM, presumably.
- Both DACA and DACB lines appear to be working, though the initial voltage is odd. (Would a 1 Meg or 100K resistor to GND help to bias it to 0v? It seems like a solid voltage, like it's not floating, like maybe the controller just hasn't initialized a value. But it is an amplified signal, so maybe it is floating behind the op amp?)
Bad news
- Initial voltage is strange and inconsistent. Anything you connect should be prepared to receive +5 to +10 VDC at startup, prior to connection and until the first DACA or DACB command is issued.
- Voltage can swing negative, so any circuit attached to the lines should have appropriate rectifying / guards.
ADC inputs
Now that I know what DACA and DACB can emit, I can feel comfortable tying DACA to ADC 0, 1, 2, or 3.
To test the inputs, I'll connect DACA (pin AN 8) to one of the inputs, starting with ADC 0 (AN2) and going up to ADC 3 (AN5).
Given the negative voltage that I'm not really expecting, and the initial value of 10v, I'll do this:
> connect
> ROBOFORTH
> START
> 2048 DACA
> 0 ADC .
and then vary the values to DACA
Indeed, all of that worked. ADC 0 reported back values that were typically 3 lower than what was sent in from DACA, even when ADC 0 was set to a 0 (-10v).
Repeat with ADC 1 (AN 3). Same.
Repeat with ADC 2 (AN 4). Same.
Repeat with ADC 3 (AN 5). Same.
Analog - end result and findings
The Analog port AN is a Dsub25 female port. A diagram of the pin numbers is shown earlier in this document.
It is connected through HE connectors to ports J2 and J3 on the MultiIOcard. (That is an optional card, so this information may not be pertinent for all K11R controller owners.)
DAC (output PWM signal)
The DAC output ports are available on AN pins 8 (DACA) and 7 (DACB) with corresponding ground on neighboring pins AN 19, 20, or 21. (Other ground pins on the Dsub 25 exist, but these seem like good choices due to proximity and header connections.)
DACA initializes at 10v
DACB initializes at around 4.4V
Neither gets a new voltage unless you issue the n DACA or n DACB command.
The value of n DACA or n DACB must be in the range 0..4095. 0 yields approximately -10v. 2048 is around 0v. 3076 is around 5v. 4095 is around +10v.
If n exceeds 4095, it loops back around to the negative values, so I think it's paying attention to the lowest 12 bits of a 16-bit value.
Input ADC pins
ADC ports are available at AN pins 2, 3, 4, 5. The ADC command, given a channel number parameter, reads the DAC value from the device and puts it on the FORTH stack. The pin and ADC channel print command relationships are:
AN 2 = 0 ADC .
AN 3 = 1 ADC .
AN 4 = 2 ADC .
AN 5 = 3 ADC .
Recommended corresponding ADC GND pins are AN 14, 15, 16, 17, or 18. (Other ground pins on the Dsub 25 exist, but these seem like good choices due to proximity and header connections.)
All four ADC pins had no problem reading back values in the 0..4095 from DACA. As such, the pins are capable of receiving -10v to +10v, relative to GND.
DAC and ADC
Behind the scenes, the DAC and ADC pins connect to an op amp LF412CN before going to an ADC device (ADS7824P) or DAC device (AD7237).
If the LF412CN chips blow up, they are socketed and are therefore replaceable. Replacements currently cost about $2, ignoring shipping/handling.
Recommendations
If the AN pins are going to be used for any active mechanism (e.g., an end-effector), we should add a little bit more safety, because the AN pins are not set up with a consistent default voltage at power-up.
It might good to include an "enable" mechanism in the end-effector circuit. That then would be controlled by a QA or QC output pin. The startup sequence would be PROGPIA, 0 QA OUT, 0 QC OUT, 2048 DACA, 2048 DACB to get things in proper order. After that's been established, the program can enable the circuit using whichever QA or QC pin was chosen, and then set DACA or DACB values as desired.
I'm not sure what to do about the voltage drop problem which I observed on DACB. If, for example, a grip mechanism were to be holding an object with DACB at 4095, and then if we were to lessen the grip to DACB at 4000, we don't want the gripper to release completely. But, it looks like that might happen, given the momentary voltage drop to 0v. It may be a good idea to use a capacitor on the DAC output to avoid sudden changes. It probably would be a good idea to try to capture that voltage drop on an oscilloscope to understand it better (particularly, measure its duration).
Next steps
Consider looking at AN output pins on an oscilloscope both to understand voltage and PWM, but also to record and measure the perceived voltage drop.
No comments:
Post a Comment