#LyX 1.3 created this file. For more info see http://www.lyx.org/ \lyxformat 221 \textclass book \begin_preamble \usepackage[plainpages=false,pdfpagelabels,colorlinks=true,linkcolor=blue]{hyperref} \end_preamble \language english \inputencoding default \fontscheme bookman \graphics default \float_placement !htbp \paperfontsize default \spacing single \papersize letterpaper \paperpackage a4 \use_geometry 1 \use_amsmath 1 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \leftmargin 1in \topmargin 1in \rightmargin 0.8in \bottommargin 0.8in \secnumdepth 1 \tocdepth 5 \paragraph_separation skip \defskip smallskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Chapter Hardware Drivers \layout Section \begin_inset LatexCommand \label{sec:Parport} \end_inset Parport \begin_inset LatexCommand \index{parallel port} \end_inset \layout Standard Parport is a driver for the traditional PC parallel port. The port has a total of 17 physical pins. The original parallel port divided those pins into three groups: data, control, and status. The data group consists of 8 output pins, the control group consists of 4 pins, and the status group consists of 5 input pins. \layout Standard In the early 1990's, the bidirectional parallel port was introduced, which allows the data group to be used for output or input. The HAL driver supports the bidirectional port, and allows the user to set the data group as either input or output. If configured as output, a port provides a total of 12 outputs and 5 inputs. If configured as input, it provides 4 outputs and 13 inputs. \layout Standard In some parallel ports, the control group pins are open collectors, which may also be driven low by an external gate. On a board with open collector control pins, the \begin_inset Quotes eld \end_inset x \begin_inset Quotes erd \end_inset mode allows a more flexible mode with 8 dedicated outputs, 5 dedicated inputs, and 4 open collector pins. In other parallel ports, the control group has push-pull drivers and cannot be used as an input. \begin_inset Foot collapsed false \layout Standard HAL cannot automatically determine if the \begin_inset Quotes eld \end_inset x \begin_inset Quotes erd \end_inset mode bidirectional pins are actually open collectors (OC). If they are not, they cannot be used as inputs, and attempting to drive them LOW from an external source can damage the hardware. \layout Standard To determine whether your port has \begin_inset Quotes eld \end_inset open collector \begin_inset Quotes erd \end_inset pins, load hal_parport in \begin_inset Quotes eld \end_inset x \begin_inset Quotes erd \end_inset mode, output a HIGH value on the pin. HAL should read the pin as TRUE. Next, insert a 470 \begin_inset Formula $\Omega$ \end_inset resistor from one of the control pins to GND. If the resulting voltage on the control pin is close to 0V, and HAL now reads the pin as FALSE, then you have an OC port. If the resulting voltage is far from 0V, or HAL does not read the pin as FALSE, then your port cannot be used in \begin_inset Quotes eld \end_inset x \begin_inset Quotes erd \end_inset mode. \layout Standard The external hardware that drives the control pins should also use open collector gates (e.g., 74LS05). Generally, the -out HAL pins should be set to TRUE when the physical pin is being used as an input. \layout Standard On some machines, BIOS settings may affect whether \begin_inset Quotes eld \end_inset x \begin_inset Quotes erd \end_inset mode can be used. \begin_inset Quotes eld \end_inset SPP \begin_inset Quotes erd \end_inset mode is most most likely to work. \end_inset \layout Standard No other combinations are supported, and a port cannot be changed from input to output once the driver is installed. Figure \begin_inset LatexCommand \ref{fig:Parport-block-diag} \end_inset shows two block diagrams, one showing the driver when the data group is configured for output, and one showing it configured for input. \layout Standard The parport driver can control up to 8 ports (defined by MAX_PORTS in hal_parpor t.c). The ports are numbered starting at zero. \layout Subsection Installing \layout LyX-Code loadrt hal_parport cfg="" \layout Standard The config string consists of a hex port address, followed by an optional direction, repeated for each port. The direction is \begin_inset Quotes eld \end_inset in \begin_inset Quotes erd \end_inset , \begin_inset Quotes eld \end_inset out \begin_inset Quotes erd \end_inset , or \begin_inset Quotes eld \end_inset x \begin_inset Quotes erd \end_inset and determines the direction of the physical pins 2 through 9, and whether to create input HAL pins for the physical control pins. If the direction is not specified, the data group defaults to output. For example: \layout LyX-Code loadrt hal_parport cfg="0x278 0x378 in 0x20A0 out" \layout Standard This example installs drivers for one port at 0x0278, with pins 2-9 as outputs (by default, since neither \begin_inset Quotes eld \end_inset in \begin_inset Quotes erd \end_inset nor \begin_inset Quotes eld \end_inset out \begin_inset Quotes erd \end_inset was specified), one at 0x0378, with pins 2-9 as inputs, and one at 0x20A0, with pins 2-9 explicitly specified as outputs. Note that you must know the base address of the parallel port to properly configure the driver. For ISA bus ports, this is usually not a problem, since the port is almost always at a \begin_inset Quotes eld \end_inset well known \begin_inset Quotes erd \end_inset address, like 0278 or 0378 which is typically configured in the system BIOS. The address for a PCI card is usally shown in \begin_inset Quotes eld \end_inset lspci -v \begin_inset Quotes erd \end_inset in an \begin_inset Quotes eld \end_inset I/O ports \begin_inset Quotes erd \end_inset line, or in the kernel message log after executing \family typewriter \begin_inset Quotes eld \end_inset sudo modprobe -a parport_pc \family default \begin_inset Quotes erd \end_inset . There is no default address; if \family typewriter \family default does not contain at least one address, it is an error. \layout Standard \begin_inset Float figure wide false collapsed false \layout Standard \align center \begin_inset Graphics filename parport-block-diag.eps width 8in height 10in keepAspectRatio rotateAngle 90 rotateOrigin center \end_inset \layout Caption \begin_inset LatexCommand \label{fig:Parport-block-diag} \end_inset Parport Block Diagram \end_inset \layout Subsection Pins \layout Itemize \family typewriter \noun on (bit) \noun default parport..pin--out \family default -- Drives a physical output pin. \layout Itemize \family typewriter \noun on (bit) \noun default parport..pin--in \family default -- Tracks a physical input pin. \layout Itemize \family typewriter \noun on (bit) \noun default parport..pin--in-not \family default -- Tracks a physical input pin, but inverted. \layout Standard For each pin, \family typewriter \family default is the port number, and \family typewriter \family default is the physical pin number in the 25 pin D-shell connector. \layout Standard For each physical output pin, the driver creates a single HAL pin, for example \family typewriter parport.0.pin-14-out \family default . Pins 2 through 9 are part of the data group and are output pins if the port is defined as an output port. (Output is the default.) Pins 1, 14, 16, and 17 are outputs in all modes. These HAL pins control the state of the corresponding physical pins. \layout Standard For each physical input pin, the driver creates two HAL pins, for example \family typewriter parport.0.pin-12-in \family default and \family typewriter parport.0.pin-12-in-not \family default . Pins 10, 11, 12, 13, and 15 are always input pins. Pins 2 through 9 are input pins only if the port is defined as an input port. The \family typewriter -in \family default HAL pin is TRUE if the physical pin is high, and FALSE if the physical pin is low. The \family typewriter -in-not \family default HAL pin is inverted -- it is FALSE if the physical pin is high. By connecting a signal to one or the other, the user can determine the state of the input. In \begin_inset Quotes eld \end_inset x \begin_inset Quotes erd \end_inset mode, pins 1, 14, 16, and 17 are also input pins. \layout Subsection Parameters \layout Itemize \family typewriter \noun on (bit) \noun default parport..pin--out-invert \family default -- Inverts an output pin. \layout Itemize \family typewriter \noun on (bit) \noun default parport..pin--out-reset \family default (only for pins 2..9) -- TRUE if this pin should be reset when the \family typewriter -reset \family default function is executed. \layout Itemize \family typewriter (U32) parport..reset-time \family default -- The time (in nanoseconds) between a pin is set by \family typewriter write \family default and reset by \family typewriter reset \family default HAL functions. \layout Standard The \family typewriter -invert \family default parameter determines whether an output pin is active high or active low. If \family typewriter -invert \family default is FALSE, setting the HAL \family typewriter -out \family default pin TRUE drives the physical pin high, and FALSE drives it low. If \family typewriter -invert \family default is TRUE, then setting the HAL \family typewriter -out \family default pin TRUE will drive the physical pin low. \layout Standard If \family typewriter -reset \family default is TRUE, then the \family typewriter reset \family default function will set the pin to the value of \family typewriter -out-invert \family default . This can be used in conjunction with stepgen's \family typewriter doublefreq \family default to produce one step per period. \layout Subsection Functions \layout Itemize \family typewriter \noun on (funct) \noun default parport..read \family default -- Reads physical input pins of port \family typewriter \family default and updates HAL \family typewriter -in \family default and \family typewriter -in-not \family default pins. \layout Itemize \family typewriter \noun on (funct) \noun default parport.read-all \family default -- Reads physical input pins of all ports and updates HAL \family typewriter -in \family default and \family typewriter -in-not \family default pins. \layout Itemize \family typewriter \noun on (funct) \noun default parport..write \family default -- Reads HAL \family typewriter -out \family default pins of port \family typewriter \family default and updates that port's physical output pins. \layout Itemize \family typewriter \noun on (funct) \noun default parport.write-all \family default -- Reads HAL \family typewriter -out \family default pins of all ports and updates all physical output pins. \layout Itemize \family typewriter \noun on (funct) \noun default parport..reset \family default -- Waits until \family typewriter reset-time \family default has elapsed since the associated \family typewriter write \family default , then resets pins to values indicated by \family typewriter -out-invert \family default and \family typewriter -out-invert \family default settings. \family typewriter reset \family default must be later in the same thread as \family typewriter write \layout Standard The individual functions are provided for situations where one port needs to be updated in a very fast thread, but other ports can be updated in a slower thread to save CPU time. It is probably not a good idea to use both an \family typewriter -all \family default function and an individual function at the same time. \layout Subsection Common problems \layout Standard If loading the module reports \layout LyX-Code insmod: error inserting '/home/jepler/emc2/rtlib/hal_parport.ko': \newline -1 Device or resource busy \layout Standard then ensure that the standard kernel module \family typewriter parport_pc \family default is not loaded \begin_inset Foot collapsed false \layout Standard In the emc packages for Ubuntu, the file /etc/modprobe.d/emc2 generally prevents \family typewriter parport_pc \family default from being automatically loaded. \end_inset and that no other device in the system has claimed the I/O ports. \layout Standard If the module loads but does not appear to function, then the port address is incorrect or the \family typewriter probe_parport \family default module is required. \layout Section \begin_inset LatexCommand \label{sec:probe_parport} \end_inset probe_parport \layout Standard In modern PCs, the parallel port may require plug and play (PNP) configuration before it can be used. The \family typewriter probe_parport \family default module performs configuration of any PNP ports present, and should be loaded before \family typewriter hal_parport \family default . On machines without PNP ports, it may be loaded but has no effect. \layout Subsection Installing \layout LyX-Code loadrt probe_parport \newline loadrt hal_parport ... \layout Standard If the Linux kernel prints a message similar to \layout LyX-Code parport: PnPBIOS parport detected. \layout Standard when the parport_pc module is loaded ( \family typewriter sudo modprobe -a parport_pc; sudo rmmod parport_pc) \family default then use of this module is probably required. \layout Section \begin_inset LatexCommand \label{sec:AX5214} \end_inset AX5214H \layout Standard The Axiom Measurement & Control AX5214H is a 48 channel digital I/O board. It plugs into an ISA bus, and resembles a pair of 8255 chips. \begin_inset Foot collapsed true \layout Standard In fact it may be a pair of 8255 chips, but I'm not sure. If/when someone starts a driver for an 8255 they should look at the ax5214 code, much of the work is already done. \end_inset \layout Subsection Installing \layout LyX-Code loadrt hal_ax5214h cfg="" \layout Standard The config string consists of a hex port address, followed by an 8 character string of \begin_inset Quotes eld \end_inset I \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset O \begin_inset Quotes erd \end_inset which sets groups of pins as inputs and outputs. The first two character set the direction of the first two 8 bit blocks of pins (0-7 and 8-15). The next two set blocks of 4 pins (16-19 and 20-23). The pattern then repeats, two more blocks of 8 bits (24-31 and 32-39) and two blocks of 4 bits (40-43 and 44-47). If more than one board is installed, the data for the second board follows the first. As an example, the string \family typewriter \series bold "0x220 IIIOIIOO 0x300 OIOOIOIO" \family default \series default installs drivers for two boards. The first board is at address 0x220, and has 36 inputs (0-19 and 24-39) and 12 outputs (20-23 and 40-47). The second board is at address 0x300, and has 20 inputs (8-15, 24-31, and 40-43) and 28 outputs (0-7. 16-23, 32-39, and 44-47). Up to 8 boards may be used in one system. \layout Subsection Pins \layout Itemize \family typewriter \noun on (bit \noun default ) ax5214..out- \family default -- Drives a physical output pin. \layout Itemize \family typewriter ( \noun on bit \noun default ) ax5214..in- \family default -- Tracks a physical input pin. \layout Itemize \family typewriter ( \noun on bit \noun default ) ax5214..in--not \family default -- Tracks a physical input pin, inverted. \layout Standard For each pin, \family typewriter \family default is the board number (starts at zero), and \family typewriter \family default is the I/O channel number (0 to 47). \layout Standard Note that the driver assumes active LOW signals. This is so that modules such as OPTO-22 will work correctly (TRUE means output ON, or input energized). If the signals are being used directly without buffering or isolation the inversion needs to be accounted for. The \family typewriter in- \family default HAL pin is TRUE if the physical pin is low (OPTO-22 module energized), and FALSE if the physical pin is high (OPTO-22 module off). The \family typewriter in--not \family default HAL pin is inverted -- it is FALSE if the physical pin is low (OPTO-22 module energized). By connecting a signal to one or the other, the user can determine the state of the input. \layout Subsection Parameters \layout Itemize \family typewriter ( \noun on bit \noun default ) ax5214..out--invert \family default -- Inverts an output pin. \layout Standard The \family typewriter -invert \family default parameter determines whether an output pin is active high or active low. If \family typewriter -invert \family default is FALSE, setting the HAL \family typewriter out- \family default pin TRUE drives the physical pin low, turning ON an attached OPTO-22 module, and FALSE drives it high, turning OFF the OPTO-22 module. If \family typewriter -invert \family default is TRUE, then setting the HAL \family typewriter out- \family default pin TRUE will drive the physical pin high and turn the module OFF. \layout Subsection Functions \layout Itemize \family typewriter \noun on (funct) \noun default ax5214..read \family default -- Reads all digital inputs on one board. \layout Itemize \family typewriter \noun on (funct) \noun default ax5214..write \family default -- Writes all digital outputs on one board. \layout Section \begin_inset LatexCommand \label{sec:Servo-To-Go} \end_inset Servo-To-Go \layout Standard The Servo-To-Go is one of the first PC motion control cards \begin_inset Foot collapsed true \layout Standard a motion control card usually is a board containing devices to control one or more axes (the control devices are usually DAC's to set an analog voltage, encoder counting chips for feedback, etc.) \end_inset supported by EMC. It is an ISA card and it exists in different flavours (all supported by this driver). The board includes up to 8 channels of quadrature encoder input, 8 channels of analog input and output, 32 bits digital I/O, an interval timer with interrupt and a watchdog. \layout Subsection Installing: \layout LyX-Code loadrt hal_stg [base=
] [num_chan=] [dio=""] [model=] \layout Standard The base address field is optional; if it's not provided the driver attempts to autodetect the board. The num_chan field is used to specify the number of channels available on the card, if not used the 8 axis version is assumed. The digital inputs/outputs configuration is determined by a config string passed to insmod when loading the module. The format consists of a four character string that sets the direction of each group of pins. Each character of the direction string is either "I" or "O". The first character sets the direction of port A (Port A - DIO.0-7), the next sets port B (Port B - DIO.8-15), the next sets port C (Port C - DIO.16-23), and the fourth sets port D (Port D - DIO.24-31). The model field can be used in case the driver doesn't autodetect the right card version \begin_inset Foot collapsed true \layout Standard hint: after starting up the driver, 'dmesg' can be consulted for messages relevant to the driver (e.g. autodetected version number and base address) \end_inset . For example: \layout LyX-Code loadrt hal_stg base=0x300 num_chan=4 dio="IOIO" \layout Standard This example installs the stg driver for a card found at the base address of 0x300, 4 channels of encoder feedback, DAC's and ADC's, along with 32 bits of I/O configured like this: the first 8 (Port A) configured as Input, the next 8 (Port B) configured as Output, the next 8 (Port C) configured as Input, and the last 8 (Port D) configured as Output \layout LyX-Code loadrt hal_stg \layout Standard This example installs the driver and attempts to autodetect the board address and board model, it installs 8 axes by default along with a standard I/O setup: Port A & B configured as Input, Port C & D configured as Output. \layout Subsection Pins \layout Itemize \family typewriter \noun on (s32 \noun default ) stg..counts \family default -- Tracks the counted encoder ticks. \layout Itemize \family typewriter ( \noun on float \noun default ) stg..position \family default -- Outputs a converted position. \layout Itemize \family typewriter ( \noun on float \noun default ) stg..dac-value \family default -- Drives the voltage for the corresponding DAC. \layout Itemize \family typewriter ( \noun on float \noun default ) stg..adc-value \family default -- Tracks the measured voltage from the corresponding ADC. \layout Itemize \family typewriter \noun on (bit) \noun default stg.in- \family default -- Tracks a physical input pin. \layout Itemize \family typewriter \noun on (bit) \noun default stg.in--not \family default -- Tracks a physical input pin, but inverted. \layout Itemize \family typewriter \noun on (bit) \noun default stg.out- \family default -- Drives a physical output pin \layout Standard For each pin, \family typewriter \family default is the axis number, and \family typewriter \family default is the logic pin number of the STG \begin_inset Foot collapsed true \layout Standard if IIOO is defined, there are 16 input pins (in-00 .. in-15) and 16 output pins (out-00 .. out-15), and they correspond to PORTs ABCD (in-00 is PORTA.0, out-15 is PORTD.7) \end_inset . \layout Standard The \family typewriter in- \family default HAL pin is TRUE if the physical pin is high, and FALSE if the physical pin is low. The \family typewriter in--not \family default HAL pin is inverted -- it is FALSE if the physical pin is high. By connecting a signal to one or the other, the user can determine the state of the input. \layout Subsection Parameters \layout Itemize \family typewriter \noun on (float) \noun default stg..position-scale \family default -- The number of counts / user unit (to convert from counts to units). \layout Itemize \family typewriter ( \noun on float \noun default ) stg..dac-offset \family default -- Sets the offset for the corresponding DAC. \layout Itemize \family typewriter ( \noun on float \noun default ) stg..dac-gain \family default -- Sets the gain of the corresponding DAC. \layout Itemize \family typewriter ( \noun on float \noun default ) stg..adc-offset \family default -- Sets the offset of the corresponding ADC. \layout Itemize \family typewriter ( \noun on float \noun default ) stg..adc-gain \family default -- Sets the gain of the corresponding ADC. \layout Itemize \family typewriter ( \noun on bit \noun default ) stg.out--invert \family default -- Inverts an output pin. \layout Standard The \family typewriter -invert \family default parameter determines whether an output pin is active high or active low. If \family typewriter -invert \family default is FALSE, setting the HAL \family typewriter out- \family default pin TRUE drives the physical pin high, and FALSE drives it low. If \family typewriter -invert \family default is TRUE, then setting the HAL \family typewriter out- \family default pin TRUE will drive the physical pin low. \layout Subsection Functions \layout Itemize \family typewriter \noun on (funct) \noun default stg.capture-position \family default -- Reads the encoder counters from the axis \family typewriter \family default . \layout Itemize \family typewriter \noun on (funct) \noun default stg.write-dacs \family default -- Writes the voltages to the DACs. \layout Itemize \family typewriter \noun on (funct) \noun default stg.read-adcs \family default -- Reads the voltages from the ADCs. \layout Itemize \family typewriter \noun on (funct) \noun default stg.di-read \family default -- Reads physical \family typewriter in- \family default pins of all ports and updates all HAL \family typewriter in- \family default and \family typewriter in--not \family default pins. \layout Itemize \family typewriter \noun on (funct) \noun default stg.do-write \family default -- Reads all HAL \family typewriter out- \family default pins and updates all physical output pins. \layout Section Mesa Electronics m5i20 \begin_inset Quotes eld \end_inset Anything I/O Card \begin_inset Quotes erd \end_inset \layout Standard The Mesa Electronics m5i20 card consists of an FPGA that can be loaded with a wide variety of configurations, and has 72 pins that leave the PC. The assignment of the pins depends on the FPGA configuration. Currently there is a HAL driver for the \begin_inset Quotes eld \end_inset 4 axis host based motion control \begin_inset Quotes erd \end_inset configuration, and this FPGA configurations is also provided with EMC2. It provides 8 encoder counters, 4 PWM outputs (normally used as DACs) and up to 48 digital I/O channels, 32 inputs and 16 outputs. \begin_inset Foot collapsed true \layout Standard Ideally the encoders, \begin_inset Quotes eld \end_inset DACs \begin_inset Quotes erd \end_inset , and digital I/O would comply with the canonical interfaces defined earlier, but they don't. Fixing that is on the things-to-do list. \end_inset \layout Standard Installing: \layout LyX-Code loadrt hal_m5i20 [loadFpga=1|0] [dacRate=] \layout Standard If \family typewriter \series bold loadFpga \family default \series default is 1 (the default) the driver will load the FPGA configuration on startup. If it is 0, the driver assumes the configuration is already loaded. \family typewriter \series bold dacRate \family default \series default sets the carrier frequency for the PWM outputs, in Hz. The default is 32000, for 32KHz PWM. Valid values are from 1 to 32226. The driver prints some useful debugging message to the kernel log, which can be viewed with \family typewriter \series bold dmesg \family default \series default . \layout Standard Up to 4 boards may be used in one system. \layout Subsection Pins \layout Standard In the following pins, parameters, and functions, is the board ID. According to the naming conventions the first board should always have an ID of zero, however this driver uses the PCI board ID, so it may be non-zero even if there is only one board. \layout Itemize \family typewriter \noun on (s32 \noun default ) m5i20..enc--count \family default -- Encoder position, in counts. \layout Itemize \family typewriter ( \noun on float \noun default ) m5i20..enc--position \family default -- Encoder position, in user units. \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..enc--index \family default -- Current status of index pulse input? \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..enc--index-enable \family default -- when \noun on true \noun default , and an index pulse appears on the encoder input, reset counter to zero and clear \family typewriter index-enable \family default . \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..enc--reset \family default -- When true, counter is forced to zero. \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..dac--enable \family default -- Enables DAC if true. DAC outputs zero volts if false? \layout Itemize \family typewriter \noun on (float) \noun default m5i20..dac--value \family default -- Analog output value for PWM \begin_inset Quotes eld \end_inset DAC \begin_inset Quotes erd \end_inset (in user units, see \family typewriter -scale \family default and \family typewriter -offset \family default ) \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..in- \family default -- State of digital input pin, see canonical digital input. \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..in--not \family default -- Inverted state of digital input pin, see canonical digital input. \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..out- \family default -- Value to be written to digital output, see canonical digital output. \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..estop-in \family default -- Dedicated estop input, more details needed. \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..estop-in-not \family default -- Inverted state of dedicated estop input. \layout Itemize \family typewriter \noun on (bit) \noun default m5i20..watchdog-reset \family default -- Bidirectional, - Set TRUE to reset watchdog once, is automatically cleared. If bit value 16 is set in \family typewriter watchdog-control \family default then this value is not used, and the hardware watchdog is cleared every time the \family typewriter dac-write \family default function is executed. \layout Subsection Parameters \layout Itemize \family typewriter \noun on (float) \noun default m5i20..enc--scale \family default -- The number of counts / user unit (to convert from counts to units). \layout Itemize \family typewriter ( \noun on float \noun default ) m5i20..dac--offset \family default -- Sets the DAC offset. \layout Itemize \family typewriter ( \noun on float \noun default ) m5i20..dac--gain \family default -- Sets the DAC gain (scaling). \layout Itemize \family typewriter ( \noun on bit \noun default ) m5i20..dac--interlaced \family default -- Sets the DAC to interlaced mode. Use this mode if you are filtering the PWM to generate an anaolg voltage. \begin_inset Foot collapsed true \layout Standard With normal 10 bit PWM, 50% duty cycle would be 512 cycles on and 512 cycles off = ca 30 kHz with 33 MHz reference counter. With fully interleaved PWM this would be 1 cycle on, 1 cycle off for 1024 cycles (16.66 MHz if the PWM reference counter runs at 33 MHz) = much easier to filter. The 5I20 configuration interlace is somewhat between non and fully interlaced (to make it easy to filter but not have as many transistions as fully interleav ed). \end_inset \layout Itemize \family typewriter ( \noun on bit \noun default ) m5i20..out--invert \family default -- Inverts a digital output, see canonical digital output. \layout Itemize \family typewriter ( \noun on u32 \noun default ) m5i20..watchdog-control \family default -- Configures the watchdog. The value may be a bitwise OR of the following values: \newline \begin_inset Tabular \begin_inset Text \layout Standard Bit # \end_inset \begin_inset Text \layout Standard Value \end_inset \begin_inset Text \layout Standard Meaning \end_inset \begin_inset Text \layout Standard 0 \end_inset \begin_inset Text \layout Standard 1 \end_inset \begin_inset Text \layout Standard Watchdog is enabled \end_inset \begin_inset Text \layout Standard 1 \end_inset \begin_inset Text \layout Standard 2 \end_inset \begin_inset Text \layout Standard Watchdog is automatically reset by DAC writes (the HAL \family typewriter dac-write \family default function) \end_inset \end_inset Typically, the useful values are 0 (watchdog disabled) or 3 (watchdog enabled, cleared by \family typewriter dac-write \family default ). \layout Itemize \family typewriter ( \noun on u32 \noun default ) m5i20..led-view \family default -- Maps some of the I/O to onboard LEDs. See table below. \layout Subsection Functions \layout Itemize \family typewriter \noun on (funct) \noun default m5i20..encoder-read \family default -- Reads all encoder counters. \layout Itemize \family typewriter \noun on (funct) \noun default m5i20..digital-in-read \family default -- Reads digital inputs. \layout Itemize \family typewriter \noun on (funct) \noun default m5i20..dac-write \family default -- Writes the voltages (PWM duty cycles) to the \begin_inset Quotes eld \end_inset DACs \begin_inset Quotes erd \end_inset . \layout Itemize \family typewriter \noun on (funct) \noun default m5i20..digital-out-write \family default -- Writes digital outputs. \layout Itemize \family typewriter \noun on (funct) \noun default m5i20..misc-update \family default -- Writes watchdog timer configuration to hardware. Resets watchdog timer. Updates E-stop pin (more info needed). Updates onboard LEDs. \layout Subsection Connector pinout \layout Standard The Hostmot-4 FPGA configuration has the following pinout. There are three 50-pin ribbon cable connectors on the card: P2, P3, and P4. There are also 8 status LEDs. \layout Subsubsection Connector P2 \layout Standard \begin_inset Tabular \begin_inset Text \layout Standard m5i20 card connector P2 \end_inset \begin_inset Text \layout Standard Function/HAL-pin \end_inset \begin_inset Text \layout Standard 1 \end_inset \begin_inset Text \layout Standard enc-01 A input \end_inset \begin_inset Text \layout Standard 3 \end_inset \begin_inset Text \layout Standard enc-01 B input \end_inset \begin_inset Text \layout Standard 5 \end_inset \begin_inset Text \layout Standard enc-00 A input \end_inset \begin_inset Text \layout Standard 7 \end_inset \begin_inset Text \layout Standard enc-00 B input \end_inset \begin_inset Text \layout Standard 9 \end_inset \begin_inset Text \layout Standard enc-01 index input \end_inset \begin_inset Text \layout Standard 11 \end_inset \begin_inset Text \layout Standard enc-00 index input \end_inset \begin_inset Text \layout Standard 13 \end_inset \begin_inset Text \layout Standard dac-01 output \end_inset \begin_inset Text \layout Standard 15 \end_inset \begin_inset Text \layout Standard dac-00 output \end_inset \begin_inset Text \layout Standard 17 \end_inset \begin_inset Text \layout Standard DIR output for dac-01 \end_inset \begin_inset Text \layout Standard 19 \end_inset \begin_inset Text \layout Standard DIR output for dac-00 \end_inset \begin_inset Text \layout Standard 21 \end_inset \begin_inset Text \layout Standard dac-01-enable output \end_inset \begin_inset Text \layout Standard 23 \end_inset \begin_inset Text \layout Standard dac-00-enable output \end_inset \begin_inset Text \layout Standard 25 \end_inset \begin_inset Text \layout Standard enc-03 B input \end_inset \begin_inset Text \layout Standard 27 \end_inset \begin_inset Text \layout Standard enc-03 A input \end_inset \begin_inset Text \layout Standard 29 \end_inset \begin_inset Text \layout Standard enc-02 B input \end_inset \begin_inset Text \layout Standard 31 \end_inset \begin_inset Text \layout Standard enc-02 A input \end_inset \begin_inset Text \layout Standard 33 \end_inset \begin_inset Text \layout Standard enc-03 index input \end_inset \begin_inset Text \layout Standard 35 \end_inset \begin_inset Text \layout Standard enc-02 index input \end_inset \begin_inset Text \layout Standard 37 \end_inset \begin_inset Text \layout Standard dac-03 output \end_inset \begin_inset Text \layout Standard 39 \end_inset \begin_inset Text \layout Standard dac-02 output \end_inset \begin_inset Text \layout Standard 41 \end_inset \begin_inset Text \layout Standard DIR output for dac-03 \end_inset \begin_inset Text \layout Standard 43 \end_inset \begin_inset Text \layout Standard DIR output for dac-02 \end_inset \begin_inset Text \layout Standard 45 \end_inset \begin_inset Text \layout Standard dac-03-enable output \end_inset \begin_inset Text \layout Standard 47 \end_inset \begin_inset Text \layout Standard dac-02-enable output \end_inset \begin_inset Text \layout Standard 49 \end_inset \begin_inset Text \layout Standard Power +5 V (or +3.3V ?) \end_inset \begin_inset Text \layout Standard all even pins \end_inset \begin_inset Text \layout Standard Ground \end_inset \end_inset \layout Subsubsection Connector P3 \layout Standard Encoder counters 4 - 7 work simultaneously with in-00 to in-11. \layout Standard If you are using in-00 to in-11 as general purpose IO then reading enc-<4-7> will produce some random junk number. \layout Standard \begin_inset Tabular \begin_inset Text \layout Standard m5i20 card connector P3 \end_inset \begin_inset Text \layout Standard Function/HAL-pin \end_inset \begin_inset Text \layout Standard Secondary Function/HAL-pin \end_inset \begin_inset Text \layout Standard 1 \end_inset \begin_inset Text \layout Standard in-00 \end_inset \begin_inset Text \layout Standard enc-04 A input \end_inset \begin_inset Text \layout Standard 3 \end_inset \begin_inset Text \layout Standard in-01 \end_inset \begin_inset Text \layout Standard enc-04 B input \end_inset \begin_inset Text \layout Standard 5 \end_inset \begin_inset Text \layout Standard in-02 \end_inset \begin_inset Text \layout Standard enc-04 index input \end_inset \begin_inset Text \layout Standard 7 \end_inset \begin_inset Text \layout Standard in-03 \end_inset \begin_inset Text \layout Standard enc-05 A input \end_inset \begin_inset Text \layout Standard 9 \end_inset \begin_inset Text \layout Standard in-04 \end_inset \begin_inset Text \layout Standard enc-05 B input \end_inset \begin_inset Text \layout Standard 11 \end_inset \begin_inset Text \layout Standard in-05 \end_inset \begin_inset Text \layout Standard enc-05 index input \end_inset \begin_inset Text \layout Standard 13 \end_inset \begin_inset Text \layout Standard in-06 \end_inset \begin_inset Text \layout Standard enc-06 A input \end_inset \begin_inset Text \layout Standard 15 \end_inset \begin_inset Text \layout Standard in-07 \end_inset \begin_inset Text \layout Standard enc-06 B input \end_inset \begin_inset Text \layout Standard 17 \end_inset \begin_inset Text \layout Standard in-08 \end_inset \begin_inset Text \layout Standard enc-06 index input \end_inset \begin_inset Text \layout Standard 19 \end_inset \begin_inset Text \layout Standard in-09 \end_inset \begin_inset Text \layout Standard enc-07 A input \end_inset \begin_inset Text \layout Standard 21 \end_inset \begin_inset Text \layout Standard in-10 \end_inset \begin_inset Text \layout Standard enc-07 B input \end_inset \begin_inset Text \layout Standard 23 \end_inset \begin_inset Text \layout Standard in-11 \end_inset \begin_inset Text \layout Standard enc-07 index input \end_inset \begin_inset Text \layout Standard 25 \end_inset \begin_inset Text \layout Standard in-12 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 27 \end_inset \begin_inset Text \layout Standard in-13 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 29 \end_inset \begin_inset Text \layout Standard in-14 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 31 \end_inset \begin_inset Text \layout Standard in-15 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 33 \end_inset \begin_inset Text \layout Standard out-00 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 35 \end_inset \begin_inset Text \layout Standard out-01 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 37 \end_inset \begin_inset Text \layout Standard out-02 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 39 \end_inset \begin_inset Text \layout Standard out-03 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 41 \end_inset \begin_inset Text \layout Standard out-04 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 43 \end_inset \begin_inset Text \layout Standard out-05 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 45 \end_inset \begin_inset Text \layout Standard out-06 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 47 \end_inset \begin_inset Text \layout Standard out-07 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 49 \end_inset \begin_inset Text \layout Standard Power +5 V (or +3.3V ?) \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard all even pins \end_inset \begin_inset Text \layout Standard Ground \end_inset \begin_inset Text \layout Standard \end_inset \end_inset \layout Subsubsection Connector P4 \layout Standard The index mask masks the index input of the encoder so that the encoder index can be combined with a mechanical switch or opto detector to clear or latch the encoder counter only when the mask input bit is in proper state (selected by mask polarity bit) and encoder index occurs. This is useful for homing. The behaviour of these pins is controlled by the Counter Control Register (CCR), however there is currently no function in the driver to change the CCR. See REGMAP4 \begin_inset Foot collapsed false \layout Standard emc2/src/hal/drivers/m5i20/REGMAP4E \end_inset for a description of the CCR. \layout Standard \begin_inset Tabular \begin_inset Text \layout Standard m5i20 card connector P4 \end_inset \begin_inset Text \layout Standard Function/HAL-pin \end_inset \begin_inset Text \layout Standard Secondary Function/HAL-pin \end_inset \begin_inset Text \layout Standard 1 \end_inset \begin_inset Text \layout Standard in-16 \end_inset \begin_inset Text \layout Standard enc-00 index mask \end_inset \begin_inset Text \layout Standard 3 \end_inset \begin_inset Text \layout Standard in-17 \end_inset \begin_inset Text \layout Standard enc-01 index mask \end_inset \begin_inset Text \layout Standard 5 \end_inset \begin_inset Text \layout Standard in-18 \end_inset \begin_inset Text \layout Standard enc-02 index mask \end_inset \begin_inset Text \layout Standard 7 \end_inset \begin_inset Text \layout Standard in-19 \end_inset \begin_inset Text \layout Standard enc-03 index mask \end_inset \begin_inset Text \layout Standard 9 \end_inset \begin_inset Text \layout Standard in-20 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 11 \end_inset \begin_inset Text \layout Standard in-21 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 13 \end_inset \begin_inset Text \layout Standard in-22 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 15 \end_inset \begin_inset Text \layout Standard in-23 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 17 \end_inset \begin_inset Text \layout Standard in-24 \end_inset \begin_inset Text \layout Standard enc-04 index mask \end_inset \begin_inset Text \layout Standard 19 \end_inset \begin_inset Text \layout Standard in-25 \end_inset \begin_inset Text \layout Standard enc-05 index mask \end_inset \begin_inset Text \layout Standard 21 \end_inset \begin_inset Text \layout Standard in-26 \end_inset \begin_inset Text \layout Standard enc-06 index mask \end_inset \begin_inset Text \layout Standard 23 \end_inset \begin_inset Text \layout Standard in-27 \end_inset \begin_inset Text \layout Standard enc-07 index mask \end_inset \begin_inset Text \layout Standard 25 \end_inset \begin_inset Text \layout Standard in-28 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 27 \end_inset \begin_inset Text \layout Standard in-29 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 29 \end_inset \begin_inset Text \layout Standard in-30 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 31 \end_inset \begin_inset Text \layout Standard in-31 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 33 \end_inset \begin_inset Text \layout Standard out-08 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 35 \end_inset \begin_inset Text \layout Standard out-09 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 37 \end_inset \begin_inset Text \layout Standard out-10 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 39 \end_inset \begin_inset Text \layout Standard out-11 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 41 \end_inset \begin_inset Text \layout Standard out-12 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 43 \end_inset \begin_inset Text \layout Standard out-13 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 45 \end_inset \begin_inset Text \layout Standard out-14 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 47 \end_inset \begin_inset Text \layout Standard out-15 \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard 49 \end_inset \begin_inset Text \layout Standard Power +5 V (or +3.3V ?) \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard all even pins \end_inset \begin_inset Text \layout Standard Ground \end_inset \begin_inset Text \layout Standard \end_inset \end_inset \layout Subsubsection LEDs \layout Standard The status LEDs will monitor one motion channel set by the \family typewriter m5i20..led-view \family default parameter. A call to \family typewriter m5i20..misc-update \family default is required to update the viewed channel. \layout Standard \begin_inset Tabular \begin_inset Text \layout Standard LED name \end_inset \begin_inset Text \layout Standard Output \end_inset \begin_inset Text \layout Standard LED0 \end_inset \begin_inset Text \layout Standard IRQLatch ? \end_inset \begin_inset Text \layout Standard LED1 \end_inset \begin_inset Text \layout Standard enc- A \end_inset \begin_inset Text \layout Standard LED2 \end_inset \begin_inset Text \layout Standard enc- B \end_inset \begin_inset Text \layout Standard LED3 \end_inset \begin_inset Text \layout Standard enc- index \end_inset \begin_inset Text \layout Standard LED4 \end_inset \begin_inset Text \layout Standard dac- DIR \end_inset \begin_inset Text \layout Standard LED5 \end_inset \begin_inset Text \layout Standard dac- \end_inset \begin_inset Text \layout Standard LED6 \end_inset \begin_inset Text \layout Standard dac--enable \end_inset \begin_inset Text \layout Standard LED7 \end_inset \begin_inset Text \layout Standard watchdog timeout ? \end_inset \end_inset \layout Section Vital Systems Motenc-100 and Motenc-LITE \layout Standard The Vital Systems Motenc-100 and Motenc-LITE are 8- and 4-channel servo control boards. The Motenc-100 provides 8 quadrature encoder counters, 8 analog inputs, 8 analog outputs, 64 (68?) digital inputs, and 32 digital outputs. The Motenc-LITE has only 4 encoder counters, 32 digital inputs and 16 digital outputs, but it still has 8 analog inputs and 8 analog outputs. The driver automatically identifies the installed board and exports the appropriate HAL objects. \begin_inset Foot collapsed true \layout Standard Ideally the encoders, DACs, ADCs, and digital I/O would comply with the canonical interfaces defined earlier, but they don't. Fixing that is on the things-to-do list. \end_inset \layout Standard Installing: \layout LyX-Code loadrt hal_motenc \layout Standard During loading (or attempted loading) the driver prints some usefull debugging message to the kernel log, which can be viewed with \family typewriter \series bold dmesg \family default \series default . \layout Standard Up to 4 boards may be used in one system. \layout Subsection Pins \layout Standard In the following pins, parameters, and functions, is the board ID. According to the naming conventions the first board should always have an ID of zero. However this driver sets the ID based on a pair of jumpers on the baord, so it may be non-zero even if there is only one board. \layout Itemize \family typewriter \noun on (s32 \noun default ) motenc..enc--count \family default -- Encoder position, in counts. \layout Itemize \family typewriter ( \noun on float \noun default ) motenc..enc--position \family default -- Encoder position, in user units. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..enc--index \family default -- Current status of index pulse input. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..enc--idx-latch \family default -- Driver sets this pin true when it latches an index pulse (enabled by \family typewriter latch-index \family default ). Cleared by clearing \family typewriter latch-index \family default . \layout Itemize \family typewriter \noun on (bit) \noun default motenc..enc--latch-index \family default -- If this pin is true, the driver will reset the counter on the next index pulse. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..enc--reset-count \family default -- If this pin is true, the counter will immediately be reset to zero, and the pin will be cleared. \layout Itemize \family typewriter \noun on (float) \noun default motenc..dac--value \family default -- Analog output value for DAC (in user units, see \family typewriter -gain \family default and \family typewriter -offset \family default ) \layout Itemize \family typewriter \noun on (float) \noun default motenc..adc--value \family default -- Analog input value read by ADC (in user units, see \family typewriter -gain \family default and \family typewriter -offset \family default ) \layout Itemize \family typewriter \noun on (bit) \noun default motenc..in- \family default -- State of digital input pin, see canonical digital input. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..in--not \family default -- Inverted state of digital input pin, see canonical digital input. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..out- \family default -- Value to be written to digital output, seen canonical digital output. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..estop-in \family default -- Dedicated estop input, more details needed. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..estop-in-not \family default -- Inverted state of dedicated estop input. \layout Itemize \family typewriter \noun on (bit) \noun default motenc..watchdog-reset \family default -- Bidirectional, - Set TRUE to reset watchdog once, is automatically cleared. \layout Subsection Parameters \layout Itemize \family typewriter \noun on (float) \noun default motenc..enc--scale \family default -- The number of counts / user unit (to convert from counts to units). \layout Itemize \family typewriter ( \noun on float \noun default ) motenc..dac--offset \family default -- Sets the DAC offset. \layout Itemize \family typewriter ( \noun on float \noun default ) motenc..dac--gain \family default -- Sets the DAC gain (scaling). \layout Itemize \family typewriter ( \noun on float \noun default ) motenc..adc--offset \family default -- Sets the ADC offset. \layout Itemize \family typewriter ( \noun on float \noun default ) motenc..adc--gain \family default -- Sets the ADC gain (scaling). \layout Itemize \family typewriter ( \noun on bit \noun default ) motenc..out--invert \family default -- Inverts a digital output, see canonical digital output. \layout Itemize \family typewriter ( \noun on u32 \noun default ) motenc..watchdog-control \family default -- Configures the watchdog. The value may be a bitwise OR of the following values: \newline \begin_inset Tabular \begin_inset Text \layout Standard Bit # \end_inset \begin_inset Text \layout Standard Value \end_inset \begin_inset Text \layout Standard Meaning \end_inset \begin_inset Text \layout Standard 0 \end_inset \begin_inset Text \layout Standard 1 \end_inset \begin_inset Text \layout Standard Timeout is 16ms if set, 8ms if unset \end_inset \begin_inset Text \layout Standard 2 \end_inset \begin_inset Text \layout Standard 4 \end_inset \begin_inset Text \layout Standard Watchdog is enabled \end_inset \begin_inset Text \layout Standard 4 \end_inset \begin_inset Text \layout Standard 16 \end_inset \begin_inset Text \layout Standard Watchdog is automatically reset by DAC writes (the HAL \family typewriter dac-write \family default function) \end_inset \end_inset Typically, the useful values are 0 (watchdog disabled) or 20 (8ms watchdog enabled, cleared by \family typewriter dac-write \family default ). \layout Itemize \family typewriter ( \noun on u32 \noun default ) motenc..led-view \family default -- Maps some of the I/O to onboard LEDs? \layout Subsection Functions \layout Itemize \family typewriter \noun on (funct) \noun default motenc..encoder-read \family default -- Reads all encoder counters. \layout Itemize \family typewriter \noun on (funct) \noun default motenc..adc-read \family default -- Reads the analog-to-digital converters. \layout Itemize \family typewriter \noun on (funct) \noun default motenc..digital-in-read \family default -- Reads digital inputs. \layout Itemize \family typewriter \noun on (funct) \noun default motenc..dac-write \family default -- Writes the voltages to the DACs. \layout Itemize \family typewriter \noun on (funct) \noun default motenc..digital-out-write \family default -- Writes digital outputs. \layout Itemize \family typewriter \noun on (funct) \noun default motenc..misc-update \family default -- Updates misc stuff. \layout Section Pico Systems PPMC (Parallel Port Motion Control) \layout Standard Pico Systems has a family of boards for doing servo, stepper, and pwm control. The boards connect to the PC through a parallel port working in EPP mode. Although most users connect one board to a parallel port, in theory any mix of up to 8 or 16 boards can be used on a single parport. One driver serves all types of boards. The final mix of I/O depends on the connected board(s). The driver doesn't distinguish between boards, it simply numbers I/O channels (encoders, etc) starting from 0 on the first card. \layout Standard Installing: \layout LyX-Code loadrt hal_ppmc port_addr=[,[,...]] \layout Standard The \family typewriter \series bold port_addr \family default \series default parameter tells the driver what parallel port(s) to check. By default, \family typewriter \series bold \family default \series default is 0x0378, and \family typewriter \series bold \family default \series default and following are not used. The driver searches the entire address space of the enhanced parallel port(s) at \family typewriter \series bold port_addr \family default \series default , looking for any board(s) in the PPMC family. It then exports HAL pins for whatever it finds. During loading (or attempted loading) the driver prints some usefull debugging message to the kernel log, which can be viewed with \family typewriter \series bold dmesg \family default \series default . \layout Standard Up to 3 parport busses may be used, and each bus may have up to 8 devices on it. \layout Subsection Pins \layout Standard In the following pins, parameters, and functions, is the board ID. According to the naming conventions the first board should always have an ID of zero. However this driver sets the ID based on a pair of jumpers on the baord, so it may be non-zero even if there is only one board. \layout Itemize \family typewriter \noun on (s32 \noun default ) ppmc..encoder..count \family default -- Encoder position, in counts. \layout Itemize \family typewriter \noun on (s32 \noun default ) ppmc..encoder..delta \family default -- Change in counts since last read. \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..encoder..position \family default -- Encoder position, in user units. \layout Itemize \family typewriter \noun on (bit) \noun default ppmc..encoder..index \family default -- Something to do with index pulse. \begin_inset Foot collapsed true \layout Standard Index handling does _not_ comply with the canonical encoder interface, and should be changed. \end_inset \layout Itemize \family typewriter \noun on (bit) \noun default ppmc..pwm..enable \family default -- Enables a PWM generator. \layout Itemize \family typewriter \noun on (float) \noun default ppmc..pwm..value \family default -- Value which determines the duty cycle of the PWM waveforms. The value is divided by \family typewriter pwm..scale \family default , and if the result is 0.6 the duty cycle will be 60%, and so on. Negative values result in the duty cycle being based on the absolute value, and the direction pin is set to indicate negative. \layout Itemize \family typewriter \noun on (bit) \noun default ppmc..stepgen..enable \family default -- Enables a step pulse generator. \layout Itemize \family typewriter \noun on (float) \noun default ppmc..stepgen..velocity \family default -- Value which determines the step frequency. The value is multiplied by \family typewriter stepgen..scale \family default , and the result is the frequency in steps per second. Negative values result in the frequency being based on the absolute value, and the direction pin is set to indicate negative. \layout Itemize \family typewriter \noun on (bit) \noun default ppmc..in- \family default -- State of digital input pin, see canonical digital input. \layout Itemize \family typewriter \noun on (bit) \noun default ppmc..in..not \family default -- Inverted state of digital input pin, see canonical digital input. \layout Itemize \family typewriter \noun on (bit) \noun default ppmc..out- \family default -- Value to be written to digital output, seen canonical digital output. \layout Subsection Parameters \layout Itemize \family typewriter \noun on (float) \noun default ppmc..enc..scale \family default -- The number of counts / user unit (to convert from counts to units). \layout Itemize \family typewriter \noun on (float) \noun default ppmc..pwm..freq \family default -- The PWM carrier frequency, in Hz. Applies to a group of four consecutive PWM generators, as indicated by \family typewriter \family default . Minimum is 153Hz, maximum is 500KHz. \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..pwm..scale \family default -- Scaling for PWM generator. If \family typewriter scale \family default is X, then the duty cycle will be 100% when the \family typewriter value \family default pin is X (or -X). \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..pwm..max-dc \family default -- Maximum duty cycle, from 0.0 to 1.0. \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..pwm..min-dc \family default -- Minimum duty cycle, from 0.0 to 1.0. \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..pwm..duty-cycle \family default -- Actual duty cycle (used mostly for troubleshooting.) \layout Itemize \family typewriter ( \noun on bit \noun default ) ppmc..pwm..bootstrap \family default -- If true, the PWM generator will generate a short sequence of pulses of both polarities when it is enabled, to charge the bootstrap capacators used on some MOSFET gate drivers. \layout Itemize \family typewriter ( \noun on u32 \noun default ) ppmc..stepgen..setup-time \family default -- Sets minimum time between direction change and step pulse, in units of 100nS. Applies to a group fof four consecutive PWM generators, as indicated by \family typewriter \family default . \layout Itemize \family typewriter ( \noun on u32 \noun default ) ppmc..stepgen..pulse-width \family default -- Sets width of step pulses, in units of 100nS. Applies to a group fof four consecutive PWM generators, as indicated by \family typewriter \family default . \layout Itemize \family typewriter ( \noun on u32 \noun default ) ppmc..stepgen..pulse-space-min \family default -- Sets minimum time between pulses, in units of 100nS. The maximum step rate is 1/( 100nS * ( \family typewriter pulse-width \family default + \family typewriter pulse-space-min \family default )). Applies to a group fof four consecutive PWM generators, as indicated by \family typewriter \family default . \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..stepgen..scale \family default -- Scaling for step pulse generator. The step frequency in Hz is the absolute value of \family typewriter velocity \family default * \family typewriter scale \family default . \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..stepgen..max-vel \family default -- The maximum value for \family typewriter velocity \family default . Commands greater than \family typewriter max-vel \family default will be clamped. Also applies to negative values. (The absolute value is clamped.) \layout Itemize \family typewriter ( \noun on float \noun default ) ppmc..stepgen..frequency \family default -- Actual step pulse frequency in Hz (used mostly for troubleshooting.) \layout Itemize \family typewriter ( \noun on bit \noun default ) ppmc..out..invert \family default -- Inverts a digital output, see canonical digital output. \layout Subsection Functions \layout Itemize \family typewriter \noun on (funct) \noun default ppmc..read \family default -- Reads all inputs (digital inputs and encoder counters) on one port. \layout Itemize \family typewriter \noun on (funct) \noun default ppmc..write \family default -- Writes all outputs (digital outputs, stepgens, PWMs) on one port. \layout Section \begin_inset LatexCommand \label{sec:Pluto-P:-generalities} \end_inset Pluto-P \begin_inset LatexCommand \index{Pluto-P} \end_inset : generalities \layout Standard The Pluto-P is an inexpensive ($60) FPGA board featuring the ACEX1K \begin_inset LatexCommand \index{ACEX1K} \end_inset chip from Altera. \layout Subsection Requirements \layout Enumerate A Pluto-P board \layout Enumerate An EPP-compatible parallel port, configured for EPP mode in the system BIOS \layout Subsection Connectors \layout Itemize The Pluto-P board is shipped with the left connector presoldered, with the key in the indicated position. The other connectors are unpopulated. There does not seem to be a standard 12-pin IDC connector, but some of the pins of a 16P connector can hang off the board next to QA3/QZ3. \layout Itemize The bottom and right connectors are on the same .1" grid, but the left connector is not. If OUT2\SpecialChar \ldots{} OUT9 are not required, a single IDC connector can span the bottom connector and the bottom two rows of the right connector. \layout Subsection Physical Pins \layout Itemize Read the ACEX1K datasheet for information about input and output voltage thresholds. The pins are all configured in "LVTTL/LVCMOS" mode and are generally compatible with 5V TTL logic. \layout Itemize Before configuration and after properly exiting emc2, all Pluto-P pins are tristated with weak pull-ups (20k \begin_inset Formula $\Omega$ \end_inset min, 50k \begin_inset Formula $\Omega$ \end_inset max). If the watchdog timer is enabled (the default), these pins are also tristated after an interruption of communication between emc2 and the board. The watchdog timer takes approximately 6.5ms to activate. However, software bugs in the pluto_servo firmware or emc2 can leave the Pluto-P pins in an undefined state. \layout Itemize In pwm+dir mode, by default dir is HIGH for negative values and LOW for positive values. To select HIGH for positive values and LOW for negative values, set the corresponding dout-NN-invert parameter TRUE to invert the signal. \layout Itemize The index input is triggered on the rising edge. Initial testing has shown that the QZx inputs are particularly noise sensitive, due to being polled every 25ns. Digital filtering has been added to filter pulses shorter than 175ns (seven polling times). Additional external filtering on all input pins, such as a Schmitt buffer or inverter, RC filter, or differential receiver (if applicable) is recommended. \layout Itemize The IN1\SpecialChar \ldots{} IN7 pins have 22-ohm series resistors to their associated FPGA pins. No other pins have any sort of protection for out-of-spec voltages or currents. It is up to the integrator to add appropriate isolation and protection. Traditional parallel port optoisolator boards do not work with pluto_servo due to the bidirectional nature of the EPP protocol. \layout Subsection LED \layout Itemize When the device is unprogrammed, the LED glows faintly. When the device is programmed, the LED glows according to the duty cycle of PWM0 ( \series bold LED \series default = \series bold UP0 \series default \emph on xor \emph default \series bold DOWN0 \series default ) or STEPGEN0 ( \series bold LED \series default = \series bold STEP0 \series default \emph on xor \emph default \series bold DIR0 \series default ). \layout Subsection Power \layout Itemize A small amount of current may be drawn from VCC. The available current depends on the unregulated DC input to the board. Alternately, regulated +3.3VDC may be supplied to the FPGA through these VCC pins. The required current is not yet known, but is probably around 50mA plus I/O current. \layout Itemize The regulator on the Pluto-P board is a low-dropout type. Supplying 5V at the power jack will allow the regulator to work properly. \layout Subsection PC interface \layout Itemize At present, only a single pluto_servo or pluto_step board is supported. At present there is no provision for multiple boards on one parallel port (because all boards reside at the same EPP address) but supporting one board per parallel port should be possible. \layout Subsection Rebuilding the FPGA firmware \layout Standard The \family typewriter src/hal/drivers/pluto_servo_firmware/ \family default and \family typewriter src/hal/drivers/pluto_step_firmware/ \series bold \family default \series default subdirectories contain the Verilog source code plus additional files used by Quartus for the FPGA firmwares. Altera's Quartus II software is required to rebuild the FPGA firmware. To rebuild the firmware from the .hdl and other source files, open the \family typewriter .qpf \family default file and press CTRL-L. Then, recompile emc2. \layout Standard Like the HAL hardware driver, the FPGA firmware is licensed under the terms of the GNU General Public License. \layout Standard The gratis version of Quartus II runs only on Microsoft Windows, although there is apparently a paid version that runs on Linux. \layout Subsection For more information \layout Standard The Pluto-P board may be ordered from \begin_inset LatexCommand \htmlurl{http://www.knjn.com/ShopBoards_Parallel.html} \end_inset (US based, international shipping is available). Some additional information about it is available from \begin_inset LatexCommand \htmlurl{http://www.fpga4fun.com/board_pluto-P.html} \end_inset and from \begin_inset LatexCommand \htmlurl[the developer's blog]{http://emergent.unpy.net/01165081407} \end_inset . \layout Section \begin_inset LatexCommand \label{sec:pluto-servo} \end_inset pluto-servo \begin_inset LatexCommand \index{pluto-servo} \end_inset : Hardware PWM and quadrature counting \layout Standard The pluto_servo system is suitable for control of a 4-axis CNC mill with servo motors, a 3-axis mill with PWM spindle control, a lathe with spindle encoder, etc. The large number of inputs allows a full set of limit switches. \layout Standard This driver features: \layout Itemize 4 quadrature channels with 40MHz sample rate. The counters operate in "4x" mode. The maximum useful quadrature rate is 8191 counts per emc2 servo cycle, or about 8MHz for EMC2's default 1ms servo rate. \layout Itemize 4 PWM channels, "up/down" or "pwm+dir" style. 4095 duty cycles from -100% to +100%, including 0%. The PWM period is approximately 19.5kHz (40MHz / 2047). A PDM-like mode is also available. \layout Itemize 18 digital outputs: 10 dedicated, 8 shared with PWM functions. (Example: A lathe with unidirectional PWM spindle control may use 13 total digital outputs) \layout Itemize 20 digital inputs: 8 dedicated, 12 shared with Quadrature functions. (Example: A lathe with index pulse only on the spindle may use 13 total digital inputs) \layout Itemize EPP communication with the PC. The EPP communication typically takes around 100uS on machines tested so far, enabling servo rates above 1kHz. \layout Subsection Pinout \layout Description UPx The "up" (up/down mode) or \begin_inset Quotes eld \end_inset pwm \begin_inset Quotes erd \end_inset (pwm+direction mode) signal from PWM generator X. May be used as a digital output if the corresponding PWM channel is unused, or the output on the channel is always negative. The corresponding digital output invert may be set to TRUE to make UPx active low rather than active high. \layout Description DNx The "down" (up/down mode) or \begin_inset Quotes eld \end_inset direction \begin_inset Quotes erd \end_inset (pwm+direction mode) signal from PWM generator X. May be used as a digital output if the corresponding PWM channel is unused, or the output on the channel is never negative. The corresponding digital ouput invert may be set to TRUE to make DNx active low rather than active high. \layout Description QAx,\SpecialChar ~ QBx The A and B signals for Quadrature counter X. May be used as a digital input if the corresponding quadrature channel is unused. \layout Description QZx The Z (index) signal for quadrature counter X. May be used as a digital input if the index feature of the corresponding quadrature channel is unused. \layout Description INx Dedicated digital input #x \layout Description OUTx Dedicated digital output #x \layout Description GND Ground \layout Description VCC +3.3V regulated DC \layout Standard \begin_inset Float figure wide false collapsed false \layout Caption Pluto-Servo Pinout \begin_inset LatexCommand \index{pluto-servo pinout} \end_inset \begin_inset LatexCommand \label{fig:Pluto-Servo-Pinout} \end_inset \layout Standard \align center \begin_inset Graphics filename pluto-pinout.eps \end_inset \end_inset \layout Standard \begin_inset Float table wide false collapsed false \layout Caption \begin_inset LatexCommand \label{table:Pluto-Servo-Alternate-Pin} \end_inset Pluto-Servo Alternate Pin Functions \begin_inset LatexCommand \index{pluto-servo alternate pin functions} \end_inset \layout Standard \begin_inset Tabular \begin_inset Text \layout Standard Primary function \end_inset \begin_inset Text \layout Standard Alternate Function \end_inset \begin_inset Text \layout Standard Behavior if both functions used \end_inset \begin_inset Text \layout Standard \series bold UP0 \end_inset \begin_inset Text \layout Standard PWM0 \end_inset \begin_inset Text \layout Standard When pwm-0-pwmdir is TRUE, this pin is the PWM output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT10 \end_inset \begin_inset Text \layout Standard XOR'd with UP0 or PWM0 \end_inset \begin_inset Text \layout Standard \series bold UP1 \end_inset \begin_inset Text \layout Standard PWM1 \end_inset \begin_inset Text \layout Standard When pwm-1-pwmdir is TRUE, this pin is the PWM output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT12 \end_inset \begin_inset Text \layout Standard XOR'd with UP1 or PWM1 \end_inset \begin_inset Text \layout Standard \series bold UP2 \end_inset \begin_inset Text \layout Standard PWM2 \end_inset \begin_inset Text \layout Standard When pwm-2-pwmdir is TRUE, this pin is the PWM output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT14 \end_inset \begin_inset Text \layout Standard XOR'd with UP2 or PWM2 \end_inset \begin_inset Text \layout Standard \series bold UP3 \end_inset \begin_inset Text \layout Standard PWM3 \end_inset \begin_inset Text \layout Standard When pwm-3-pwmdir is TRUE, this pin is the PWM output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT16 \end_inset \begin_inset Text \layout Standard XOR'd with UP3 or PWM3 \end_inset \begin_inset Text \layout Standard \series bold DN0 \end_inset \begin_inset Text \layout Standard DIR0 \end_inset \begin_inset Text \layout Standard When pwm-0-pwmdir is TRUE, this pin is the DIR output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT11 \end_inset \begin_inset Text \layout Standard XOR'd with DN0 or DIR0 \end_inset \begin_inset Text \layout Standard \series bold DN1 \end_inset \begin_inset Text \layout Standard DIR1 \end_inset \begin_inset Text \layout Standard When pwm-1-pwmdir is TRUE, this pin is the DIR output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT13 \end_inset \begin_inset Text \layout Standard XOR'd with DN1 or DIR1 \end_inset \begin_inset Text \layout Standard \series bold DN2 \end_inset \begin_inset Text \layout Standard DIR2 \end_inset \begin_inset Text \layout Standard When pwm-2-pwmdir is TRUE, this pin is the DIR output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT15 \end_inset \begin_inset Text \layout Standard XOR'd with DN2 or DIR2 \end_inset \begin_inset Text \layout Standard \series bold DN3 \end_inset \begin_inset Text \layout Standard DIR3 \end_inset \begin_inset Text \layout Standard When pwm-3-pwmdir is TRUE, this pin is the DIR output \end_inset \begin_inset Text \layout Standard \end_inset \begin_inset Text \layout Standard OUT17 \end_inset \begin_inset Text \layout Standard XOR'd with DN3 or DIR3 \end_inset \begin_inset Text \layout Standard \series bold QZ0 \end_inset \begin_inset Text \layout Standard IN8 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QZ1 \end_inset \begin_inset Text \layout Standard IN9 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QZ2 \end_inset \begin_inset Text \layout Standard IN10 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QZ3 \end_inset \begin_inset Text \layout Standard IN11 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QA0 \end_inset \begin_inset Text \layout Standard IN12 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QA1 \end_inset \begin_inset Text \layout Standard IN13 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QA2 \end_inset \begin_inset Text \layout Standard IN14 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QA3 \end_inset \begin_inset Text \layout Standard IN15 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QB0 \end_inset \begin_inset Text \layout Standard IN16 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QB1 \end_inset \begin_inset Text \layout Standard IN17 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QB2 \end_inset \begin_inset Text \layout Standard IN18 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \begin_inset Text \layout Standard \series bold QB3 \end_inset \begin_inset Text \layout Standard IN19 \end_inset \begin_inset Text \layout Standard Read same value \end_inset \end_inset \end_inset \layout Subsection Input latching and output updating \layout Itemize PWM duty cycles for each channel are updated at different times. \layout Itemize Digital outputs OUT0 through OUT9 are all updated at the same time. Digital outputs OUT10 through OUT17 are updated at the same time as the pwm function they are shared with. \layout Itemize Digital inputs IN0 through IN19 are all latched at the same time. \layout Itemize Quadrature positions for each channel are latched at different times. \layout Subsection HAL Functions, Pins and Parameters \layout Standard A list of all 'loadrt' arguments, HAL function names, pin names and parameter names is in the manual page, \emph on pluto_servo.9 \emph default . \layout Subsection Compatible driver hardware \layout Standard A schematic for a 2A, 2-axis PWM servo amplifier board is available ( \begin_inset LatexCommand \htmlurl{http://emergent.unpy.net/projects/01148303608} \end_inset ). The L298 H-Bridge ( \begin_inset LatexCommand \htmlurl[L298 H-bridge]{http://www.st.com/stonline/books/pdf/docs/1773.pdf} \end_inset ) is inexpensive and can easily be used for motors up to 4A (one motor per L298) or up to 2A (two motors per L298) with the supply voltage up to 46V. However, the L298 does not have built-in current limiting, a problem for motors with high stall currents. For higher currents and voltages, some users have reported success with International Rectifier's integrated high-side/low-side drivers. ( \begin_inset LatexCommand \url{http://www.cnczone.com/forums/showthread.php?t=25929} \end_inset ) \layout Section \begin_inset LatexCommand \label{sec:Pluto-step:-Hardware-step} \end_inset Pluto-step \begin_inset LatexCommand \index{pluto-step} \end_inset : 300kHz Hardware Step Generator \layout Standard Pluto-step is suitable for control of a 3- or 4-axis CNC mill with stepper motors. The large number of inputs allows for a full set of limit switches. \layout Standard The board features: \layout Itemize 4 \begin_inset Quotes eld \end_inset step+direction \begin_inset Quotes erd \end_inset channels with 312.5kHz maximum step rate, programmable step length, space, and direction change times \layout Itemize 14 dedicated digital outputs \layout Itemize 16 dedicated digital inputs \layout Itemize EPP communuication with the PC \layout Subsection Pinout \layout Description STEPx The \begin_inset Quotes eld \end_inset step \begin_inset Quotes erd \end_inset (clock) output of stepgen channel \series bold x \layout Description DIRx The \begin_inset Quotes eld \end_inset direction \begin_inset Quotes erd \end_inset output of stepgen channel \series bold x \layout Description INx Dedicated digital input #x \layout Description OUTx Dedicated digital output #x \layout Description GND Ground \layout Description VCC +3.3V regulated DC \layout Standard While the \begin_inset Quotes eld \end_inset extended main connector \begin_inset Quotes erd \end_inset has a superset of signals usually found on a Step & Direction DB25 connector--4 step generators, 9 inputs, and 6 general-purpose outputs--the layout on this header is different than the layout of a standard 26-pin ribbon cable to DB25 connector. \layout Standard \begin_inset Float figure wide false collapsed false \layout Caption \begin_inset LatexCommand \label{fig:Pluto-Step-Pinout} \end_inset Pluto-Step Pinout \begin_inset LatexCommand \index{pluto-step pinout} \end_inset \layout Standard \align center \begin_inset Graphics filename pluto-step-pinout.eps \end_inset \end_inset \layout Subsection Input latching and output updating \layout Itemize Step frequencies for each channel are updated at different times. \layout Itemize Digital outputs are all updated at the same time. \layout Itemize Digital inputs are all latched at the same time. \layout Itemize Feedback positions for each channel are latched at different times. \layout Subsection Step Waveform Timings \layout Standard The firmware and driver enforce step length, space, and direction change times. Timings are rounded up to the next multiple of \begin_inset Formula $1.6\mu s$ \end_inset , with a maximum of \begin_inset Formula $49.6\mu s$ \end_inset . The timings are the same as for the software stepgen component, except that \begin_inset Quotes eld \end_inset dirhold \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset dirsetup \begin_inset Quotes erd \end_inset have been merged into a single parameter \begin_inset Quotes eld \end_inset dirtime \begin_inset Quotes erd \end_inset which should be the maximum of the two, and that the same step timings are always applied to all channels. \layout Standard \begin_inset Float figure wide false collapsed false \layout Caption \begin_inset LatexCommand \label{fig:Pluto-Step-Timings} \end_inset Pluto-Step Timings \begin_inset LatexCommand \index{pluto-step timings} \end_inset \layout Standard \align center \begin_inset Graphics filename pluto_step_waveform.eps width 50page% keepAspectRatio \end_inset \end_inset \layout Subsection HAL Functions, Pins and Parameters \layout Standard A list of all 'loadrt' arguments, HAL function names, pin names and parameter names is in the manual page, \emph on pluto_step.9 \emph default . \the_end