SYNOPSIS
Siehe den Abschnitt config modparam unten für die Konfiguration der Mesa-Karte. Normalerweise wird hostmot2 ohne Parameter geladen, es sei denn, eine Fehlersuche ist erforderlich.
loadrt hostmot2 [ debug_idrom=N ] [ debug_module_descriptors=N ] [ debug_pin_descriptors=N ] [ debug_modules=N ]
- debug_idrom [Voreingestellt: 0]
-
Nur für Entwickler/Debugger! Aktiviert die Debug-Protokollierung des HostMot2-IDROM-Headers.
- debug_module_descriptors [Voreingestellt: 0]
-
Nur für Entwickler/Debugger! Aktiviert die Debug-Protokollierung der HostMot2-Modul-Deskriptoren.
- debug_pin_descriptors [Voreingestellt: 0]
-
Nur für Entwickler/Debugger! Aktiviert die Debug-Protokollierung der HostMot2-Pin-Deskriptoren.
- debug_modules [Voreingestellt: 0]
-
Nur für Entwickler/Debugger! Aktiviert die Debug-Protokollierung der verwendeten HostMot2-Module.
- use_serial_numbers [Voreingestellt: 0]
-
Wenn Sie HAL-Pins für Smart-Serial-Geräte erstellen, benennen Sie die Pins nach der Seriennummer der Karte und nicht nach der Karte und dem Port, an die sie angeschlossen sind. Wenn diese Option auf 1 gesetzt ist, haben die Pins Namen wie
hm2_8i20.1234.currentund nichthm2_5i23.0.8i20.0.1.current. Die Kennung besteht aus den letzten 4 Ziffern der Seriennummer des Boards, die sich normalerweise auf einem Aufkleber auf dem Board befindet. Dadurch werden die Konfigurationen weniger portabel, aber es bedeutet, dass die Boards etwas weniger Sorgfalt verlangen, wenn sie neu verbunden werden.
BESCHREIBUNG
hostmot2 ist ein Gerätetreiber, der die Mesa or litehm2 HostMot2 Firmware mit der LinuxCNC HAL verbindet. Dieser Treiber selbst tut nichts, die Boards, auf denen die Firmware tatsächlich ausgeführt wird, benötigen ihre eigenen Treiber, bevor etwas passieren kann. Derzeit sind Treiber für PCI-, Ethernet-, SPI- und EPP-Karten verfügbar.
Die HostMot2-Firmware bietet Module wie Encoder, PWM-Generatoren, Step/Dir-Generatoren und Allzweck-E/A-Pins (GPIOs). Diese Dinge werden als "Module" bezeichnet. Die Firmware wird bei der Kompilierung der Firmware so konfiguriert, dass sie null oder mehr Instanzen jedes dieser Module bereitstellt.
E/A-Pins der Karte
Die HostMot2-Firmware läuft auf einer FPGA-Karte. Die Platine ist über PCI, Ethernet, SPI oder EPP mit dem Computer verbunden und kann über E/A-Pins auf der Platine mit Bewegungssteuerungshardware wie Servos und Schrittmotoren verbunden werden.
Jeder E/A-Pin kann beim Laden des Board-Treibers so konfiguriert werden, dass er einem von zwei Zwecken dient: Entweder als ein bestimmter E/A-Pin einer bestimmten Modulinstanz (Encoder, pwmgen, stepgen usw.) oder als ein allgemeiner digitaler E/A-Pin. Standardmäßig sind alle Modulinstanzen aktiviert, und alle Pins der Karte werden von den Modulinstanzen verwendet.
Der Benutzer kann Modulinstanzen beim Laden des Boardtreibers deaktivieren, indem er einen hostmot2-Konfigurationsstring modparam angibt. Alle Pins, die zu Modulinstanzen gehören, die deaktiviert wurden, werden automatisch zu GPIOs.
Alle I/O-Pins haben eine gewisse HAL-Präsenz, unabhängig davon, ob sie zu einer aktiven Modulinstanz gehören oder vollständige GPIOs sind. GPIOs können (während der Laufzeit) zwischen Eingängen, normalen Ausgängen und Open Drains umgeschaltet werden und haben eine flexible HAL-Schnittstelle. IO-Pins, die zu aktiven Modulinstanzen gehören, sind durch die Anforderungen des eigenen Moduls eingeschränkt und haben eine begrenztere Schnittstelle in HAL. Dies wird im Abschnitt Allgemeine E/A weiter unten beschrieben.
config modparam
Alle Board-Treiber-Module (hm2_pci, hm2_eth usw.) akzeptieren zur Ladezeit ein Modparam vom Typ String-Array mit dem Namen "config". Dieses Array enthält einen config-String für jede Karte, die der Treiber verwenden soll. Der Konfigurationsstring jeder Karte wird an den hostmot2-Treiber übergeben und von diesem geparst, wenn der Treiber die Karte registriert.
Die Konfigurationszeichenfolge kann Leerzeichen enthalten, daher ist es in der Regel eine gute Idee, das Ganze in doppelte Anführungszeichen (das Zeichen ") zu verpacken.
Das Komma-Zeichen (,) trennt die Elemente des config-Arrays voneinander.
Wenn Ihr Steuercomputer beispielsweise über einen 5I20 und einen 5I23 verfügt, könnten Sie den hm2_pci-Treiber mit einem HAL-Befehl (in halcmd) wie dem folgenden laden:
loadrt hm2_pci config="firmware=hm2/5i20/SVST8_4.BIT num_encoders=3 num_pwmgens=3 num_stepgens=3,firmware=hm2/5i23/SVSS8_8.BIT sserial_port_0=0000 num_encoders=4"
Note: Dies setzt voraus, dass der hm2_pci-Treiber zuerst das 5I20 und dann das 5I23 erkennt. Wenn die Erkennungsreihenfolge nicht mit der Reihenfolge der Konfigurationsstrings übereinstimmt, weigert sich der hostmot2-Treiber, die Firmware zu laden, und der Board-Treiber (hm2_pci usw.) kann nicht geladen werden. Soweit ich weiß, gibt es keine Möglichkeit, die Reihenfolge, in der PCI-Karten vom Treiber erkannt werden, vorherzusagen, aber die Erkennungsreihenfolge wird konsistent sein, solange die PCI-Karten nicht verschoben werden. Am besten versuchen Sie, den Treiber zu laden und die Erkennungsreihenfolge zu überprüfen.
Die gültigen Einträge im Formatstring sind:
-
[firmware=F]
-
[num_dplls=N]
-
[num_encoders=N]
-
[ssi_chan_N=abc%nq]
-
[biss_chan_N=abc%nq]
-
[fanuc_chan_N=abc%nq]
-
[num_inmux=N]
-
[num_inms=N]
-
[num_resolvers=N]
-
[num_pwmgens=N]
-
[num_3pwmgens=N]
-
[num_oneshots=N]
-
[num_periodms=N]
-
[num_rcpwmgens=N]
-
[num_stepgens=N]
-
[stepgen_width=N]
-
[sserial_port_0=00000000]
-
[num_bspis=N]
-
[num_leds=N]
-
[num_ssrs=N]
-
[num_outms=N]
-
[num_xy2mods=N]
-
[enable_raw]
- firmware [optional]
-
Laden Sie die mit F angegebene Firmware in das FPGA auf dieser Karte. Wird kein "firmware=F"-String angegeben, dann wird das FPGA nicht neu programmiert, sondern kann mit einer zuvor heruntergeladenen Firmware weiterarbeiten.
Die angeforderte Firmware F wird von udev geholt, das im Firmware-Suchpfad des Systems, normalerweise /lib/firmware, nach der Firmware sucht. F hat normalerweise die Form "<BoardType>/file.bit"; ein typischer Wert für F könnte "hm2/5i20/SVST8_4.BIT" sein. Die hostmot2-Firmware-Dateien werden von den hostmot2-Firmware-Paketen geliefert, die von linuxcnc.org erhältlich sind und normalerweise durch Eingabe des Befehls "sudo apt-get install hostmot2-firmware-5i23" installiert werden können, um beispielsweise die Unterstützungsdateien für den 5I23 zu installieren.
Neuere FPGA-Karten werden mit vorprogrammierter Firmware geliefert, und bei diesen Karten sollte kein "firmware="-String verwendet werden. Um die Firmware auf diesen Karten zu ändern, sollte das Dienstprogramm "mesaflash" verwendet werden. Es ist durchaus zulässig und sinnvoll, diese Karten ohne jeglichen Konfigurationsstring zu laden.
- num_dplls [optional, voreingestellt: -1]
-
Das hm2dpll ist ein Phase-Locked-Loop-Timer-Modul, das verwendet werden kann, um Abtast- und Schreibzeit-Jitter für einige hm2-Module zu reduzieren. Dieser Parameter kann zum Deaktivieren des hm2dpll verwendet werden, indem die Zahl auf 0 gesetzt wird. Es gibt immer nur ein Modul dieses Typs mit 4 Zeitgeberkanälen, daher sind die anderen gültigen Zahlen -1 (alle aktivieren) und 1, die beide enden up bedeutet dasselbe.
- num_encoders [optional, voreingestellt: -1]
-
Aktivieren Sie nur die ersten N-Encoder. Wenn N -1 ist, sind alle Encoder aktiviert. Wenn N gleich 0 ist, sind keine Encoder aktiviert. Wenn N größer als die Anzahl der in der Firmware verfügbaren Encoder ist, kann sich die Karte nicht registrieren.
- ssi_chan_N [optional, voreingestellt: ""]
-
Gibt an, wie der Bitstrom von einem Gerät mit synchroner serieller Schnittstelle interpretiert wird. Für jedes angeschlossene Gerät sollte ein Eintrag vorhanden sein. Nur Kanäle mit einer Formatspezifikation werden aktiviert. (da die Software Datenraten und Bitlängen nicht erraten kann).
- biss_chan_N [optional, voreingestellt: ""]
-
Wie bei ssi_chan_N, aber für BiSS-Geräte.
- fanuc_chan_N [optional, voreingestellt: ""]
-
Gibt an, wie der Bitstrom von einem Fanuc-Absolutwertgeber interpretiert wird. Für jedes angeschlossene Gerät sollte ein Eintrag vorhanden sein. Nur Kanäle mit einer Formatspezifikation werden aktiviert (da die Software Datenraten und Bitlängen nicht erraten kann).
- num_resolvers [optional, voreingestellt: -1]
-
Aktiviert nur die ersten N Resolver. Wenn N = -1, sind alle Resolver aktiviert. Dieses Modul funktioniert nicht mit generischen Resolvern (im Gegensatz zum Encoder-Modul, das mit jedem Encoder funktioniert). Zum Zeitpunkt des Schreibens funktioniert die Hostmot2 Resolver-Funktion nur mit der Mesa 7I49-Karte.
- num_pwmgens [optional, voreingestellt: -1]
-
Aktiviert nur die ersten N pwmgens. Wenn N gleich -1 ist, werden alle pwmgens aktiviert. Wenn N gleich 0 ist, werden keine pwmgens aktiviert. Wenn N größer ist als die Anzahl der in der Firmware verfügbaren pwmgens, kann sich die Karte nicht registrieren.
- num_3pwmgens [optional, voreingestellt: -1]
-
Aktiviert nur die ersten N Dreiphasen-Pwmgen. Wenn N gleich -1 ist, sind alle 3pwmgens aktiviert. Wenn N gleich 0 ist, werden keine Pwmgens aktiviert. Wenn N größer ist als die Anzahl der in der Firmware verfügbaren Pwmgens, kann sich die Karte nicht registrieren.
- num_rcpwmgens [optional, voreingestellt: -1]
-
Aktiviert nur die ersten N RC pwmgens. Ist N gleich -1, werden alle rcpwmgens aktiviert. Wenn N gleich 0 ist, werden keine rcpwmgens aktiviert. Wenn N größer ist als die Anzahl der in der Firmware verfügbaren rcpwmgens, kann sich die Karte nicht registrieren.
- num_stepgens [optional, voreingestellt: -1]
-
Aktivieren Sie nur die ersten N Stepgen. Wenn N gleich -1 ist, werden alle Schrittweiten aktiviert. Wenn N gleich 0 ist, werden keine Schrittmotoren aktiviert. Wenn N größer ist als die Anzahl der in der Firmware verfügbaren Stepgens, kann sich die Karte nicht registrieren.
- num_xy2mods [optional, voreingestellt: -1]
-
Aktiviert nur die ersten N xy2mods. Wenn N gleich -1 ist, sind alle xy2mods aktiviert. Ist N gleich 0, sind keine xy2mods aktiviert. Wenn N größer ist als die Anzahl der in der Firmware verfügbaren xy2mods, kann sich die Karte nicht registrieren.
- stepgen_width [optional, voreingestellt: 2]
-
Wird verwendet, um zusätzliche, unerwünschte Stepgen-Pins zu maskieren. Schrittantriebe benötigen in der Regel nur zwei Pins (step und dir), aber der Hostmot2 stepgen kann bis zu 8 Ausgangspins für spezielle Anwendungen ansteuern (abhängig von der Firmware). Dieser Parameter gilt für alle Stepgen-Instanzen. Unbenutzte, maskierte Pins sind als GPIO verfügbar.
- sserial_port_N (N = 0 .. 3) [optional, voreingestellt: 00000000 für alle Ports]
-
Up to 32 Smart Serial devices can be connected to a Mesa Anything I/O board, depending on the firmware used and the number of physical connections on the board. These are arranged in 1-4 ports (N) of 1 to 8 channels. Some Smart Serial (SSLBP) cards offer more than one load-time configuration, for example all inputs, or all outputs, or offering additional analogue input on some digital pins. To set the modes for port 0 use for example sserial_port_0=0120xxxx. A "0" in the string sets the corresponding channel to mode 0, a "1" to mode 1, and so on up to mode 9. An "x" in any position disables that channel and makes the corresponding FPGA pins available as GPIO. The string can be up to 8 characters long, and if it defines more modes than there are channels on the port then the extras are ignored. Channel numbering is left to right so the example above would set sserial device 0.0 to mode 0, 0.1 to mode 1, 0.2 to mode 2, 0.3 to mode 0 and disables channels 0.4 onwards. The sserial driver will auto-detect connected devices, no further configuration should be needed. Unconnected channels will default to GPIO, but the pin values will vary semi-randomly during boot when card-detection runs, to it is best to actively disable any channel that is to be used for GPIO. See sserial(9) for more information.
- num_bspis [optional, voreingestellt: -1]
-
Aktivieren Sie nur die ersten N gepufferten SPI-Treiber. Wenn N -1 ist, sind alle Treiber aktiviert. Jeder BSPI-Treiber kann 16 Geräte adressieren.
- num_leds [optional, voreingestellt: -1]
-
Aktivieren Sie nur die ersten N der LEDs auf der FPGA-Platine. Wenn N -1 ist, dann werden HAL-Pins für alle LEDs erstellt. Für N=0 werden keine Pins hinzugefügt.
- num_ssrs [optional, voreingestellt: -1]
-
Aktivieren Sie nur die ersten N der SSR-Module auf der FPGA-Platine. Wenn N -1 ist, dann werden HAL-Pins für alle SSR-Ausgänge erstellt. Wenn N=0, werden keine Pins hinzugefügt.
- enable_raw [optional]
-
Wenn dies angegeben wird, so wird ein Rohzugriffsmodus aktiviert, bei dem ein Benutzer die Firmware von der HAL aus einsehen und anfassen kann. Siehe Raw-Modus unten.
dpll
The hm2dpll module has pins and parameters like hm2_<BoardType>.<BoardNum>.dpll It is likely that the pin-count will decrease in the future and that some pins will become parameters. This module is a phase-locked loop that will synchronise itself with the thread in which the hostmot2 "read" function is installed and will trigger other functions that are allocated to it at a specified time before or after the "read" function runs. This can be applied to the three absolute encoder types, quadrature encoder, stepgen, and xy2mod. In the case of the absolute encoders this allows the system to trigger a data transmission just prior to the time when the HAL driver reads the data. In the case of stepgens, quadrature encoders, and the xy2mod, the timers can be used to reduce position sampling jitter. This is especially valuable with the ethernet-interfaced cards.
Pins:
- .NN.timer-us (real, in)
-
This pin sets the triggering offset of the associated timer. There are 4 timers numbered 01 to 04, represented by the NN digits in the pin name. The units are microseconds (µs). Generally the value for reads will be negative, and positive for writes, so that input data is sampled prior to the main hostmot read and output data is written some time after the main hostmot2 read.
For stepgen and quadrature encoders, the value needs to be more than the maximum variation between read times. -100 will suffice for most systems, and -50 will work on systems with good performance and latency.
For serial encoders, the value also needs to include the time it takes to transfer the absolute encoder position. For instance, if 50 bits must be read at 500 kHz then subtract an additional 50/500 kHz = 100 µs to get a starting value of -200.
The xy2mod uses 2 DPLL timers, one for read and one for write. The read timer value can be the same as used by the stepgen and quadrature encoders so the same timer channel can be shared. The write timer is typically set to a time after the main hostmot2 write this may take some experimentation.
- .base-freq-khz (real, in)
-
This pin sets the base frequency of the phase-locked loop. By default it will be set to the nominal frequency of the thread in which the PLL is running and will not normally need to be changed.
- .phase-error-us (real, out)
-
Indicates the phase error of the DPLL. If the number cycles by a large amount it is likely that the PLL has failed to achieve lock and adjustments will need to be made.
- .time-const (uint, in)
-
The filter time-constant for the PLL. The default value is a compromise between insensitivity to single-cycle variations and being resilient to changes to the Linux CLOCK_MONOTONIC timescale, which can instantly change by up to ±500ppm from its nominal value, usually by timekeeping software like ntpd and ntpdate. Default 2000 (0x7d0).
- .plimit (uint, in)
-
Sets the phase adjustment limit of the PLL. If the value is zero then the PLL will free-run at the base frequency independent of the servo thread rate. This is probably not what you want. Default 4194304 (0x400000) Units not known…
- .ddsize (uint, out)
-
Used internally by the driver, likely to disappear.
- .prescale (uint, out)
-
Prescale factor for the rate generator. Default 1.
Encoder
Encoders have names like hm2_<BoardType>.<BoardNum>.encoder.<Instance>. "Instance" is a two-digit number that corresponds to the HostMot2 encoder instance number. There are "num_encoders" instances, starting with 00.
Der HAL-Pin mit der aktuellen Position des zweiten Encoders der ersten 5I25-Karte lautet beispielsweise: hm2_5i25.0.encoder.01.position (dies setzt voraus, dass die Firmware auf dieser Karte so konfiguriert ist, dass dieses HAL-Objekt verfügbar ist).
Jeder Encoder verwendet drei oder vier Eingangs-I/O-Pins, je nachdem, wie die Firmware kompiliert wurde. Dreipolige Encoder verwenden A, B und Index (manchmal auch als Z bekannt). Bei vierpoligen Encodern werden A, B, Index und Index-Maske verwendet.
Die hm2-Encoder-Darstellung ähnelt derjenigen, die von der kanonischen Geräteschnittstelle (im Dokument HAL General Reference) beschrieben wird, und der Software-Encoder-Komponente. Jede Encoder-Instanz hat die folgenden Pins und Parameter:
Pins:
- .count (sint, out)
-
Number of encoder counts since the previous reset. 32-bit truncation of the 64-bit internal counter; position is computed from the full-width internal value so it does not wrap.
- .position (real, out)
-
Encoder position in position units (count / scale).
- .position-interpolated (real, out)
-
Encoder interpolated position in position units (count / scale). Only valid when velocity is approximately constant and the time between counts is less than the velocity timeout parameter value. Do not use for position control. Useful for spindle synchronized moves with low resolution encoders.
- .position-latched (real, out)
-
Encoder latched position in position units (count / scale).
- .velocity (real, out)
-
Estimated encoder velocity in position units per second.
- .velocity-rpm (real, out)
-
Estimated encoder velocity in position units per minute.
- .reset (bool, in)
-
When this pin is True, the count and position pins are set to 0 (the value of the velocity pin is not affected by this). The driver does not reset this pin to FALSE after resetting the count to 0, that is the user’s job.
- .index-enable (bool, io)
-
When this pin is set to True, (and no_clear_on_index is false) the count (and therefore also position) are reset to zero on the next Index (Phase-Z) pulse. At the same time, index-enable is reset to zero to indicate that the pulse has occurred.
- .no_clear_on_index (bool, in)
-
When this pin is set to True, the count (and therefore also position) are NOT reset to zero on the next Index (Phase\-Z) pulse. On an index event the latched count and position will be set to indicate the count and position where the index occured.
- .probe-enable (bool, in)
-
When this pin is set to True, the encoder count (and therefore also position) are latched on the the next probe active edge. At the same time, probe-enable is reset to zero to indicate that latch event has occurred. (only present if supported by firmware)
- .probe-invert (bool, in)
-
If set to True, the rising edge of the probe input pin triggers the latch event (if probe-enable is True). If set to False, the falling edge triggers. (only present if supported by firmware)
- .rawcounts (sint, out)
-
Total number of encoder counts since the start, not adjusted for index or reset. Truncated view of the internal 64-bit counter.
- .count-latched (sint, out)
-
Encoder count at latch event (index or probe). Truncated view of the internal 64-bit latched count.
- .input-a, .input-b, .input-index (bool, out)
-
Real time filtered values of A,B,Index encoder signals
- .quad-error-enable (bool, in)
-
When this pin is True quadrature error reporting is enabled. When False, existing quadrature errors are cleared and error reporting is disabled.
- .quad-error (bool, out)
-
This bit indicates that a quadrature sequence error has been detected. It can only be set if the corresponding quad-error-enable bit is True.
The following pins are global to the encoder module and have no instance number in the name:
- .sample-frequency (uint, in)
-
This is the sample frequency that determines all standard encoder channels digital filter time constant (see filter parameter).
- .muxed-sample-frequency (uint, in)
-
This is the sample frequency that determines all muxed encoder channels digital filter time constant (see filter parameter). This also sets the encoder multiplexing frequency.
- .muxed-skew (uint, in)
-
This sets the muxed encoder sample time delay (in ns) from the multiplex signal. Setting this properly can increase the usable multiplex frequency and compensate for cable delays (suggested value is 3* cable length in feet +20).
- .hires-timestamp (bool, in)
-
When this pin is True the encoder timestamp counter frequency is ca. 10 MHz. When False the timestamp counter frequency is ca. 2 MHz. This should be set True for frequency counting applications to improve the resolution. It should be set False when servo thread periods longer than 1 ms are used.
- .timer-number (default: -1) (sint, in)
-
Sets the hm2dpll timer instance to be used to latch encoder counts. A setting of -1 does not latch encoder counts. A setting of 0 latches at the same time as the main hostmot2 read. A setting of 1..4 uses a time offset from the main hostmot2 read according to the dpll’s timer-us setting.
Normalerweise sollte timer-us eine negative Zahl sein, deren Betrag größer ist als die größte Latenz (z. B. -100 für ein System mit mittelmäßiger Latenz, -50 für ein System mit guter Latenz). Eine negative Zahl gibt an, dass die angegebene Zeit vor der nominalen hostmot2-Lesezeit verriegelt wird.
Wenn in der FPGA-Firmware kein DPLL-Modul vorhanden ist oder das Encoder-Modul DPLL nicht unterstützt, dann wird dieser Pin nicht angelegt.
Wenn verfügbar, sollte diese Funktion in der Regel aktiviert sein. Dadurch werden im Allgemeinen folgende Fehler reduziert.
Parameters:
- .scale (real, rw)
-
Converts from "count" units to "position" units.
- .index-invert (bool, rw)
-
If set to True, the rising edge of the Index input pin triggers the Index event (if index-enable is True). If set to False, the falling edge triggers.
- .index-mask (bool, rw)
-
If set to True, the Index input pin only has an effect if the Index-Mask input pin is True (or False, depending on the index-mask-invert pin below).
- .index-mask-invert (bool, rw)
-
If set to True, Index-Mask must be False for Index to have an effect. If set to False, the Index-Mask pin must be True.
- .counter-mode (bool, rw)
-
Set to False (the default) for Quadrature. Set to True for Step/Dir (in which case Step is on the A pin and Dir is on the B pin).
- .filter (bool, rw)
-
If set to True (the default), the quadrature counter needs 15 sample clocks to register a change on any of the three input lines (any pulse shorter than this is rejected as noise). If set to False, the quadrature counter needs only 3 clocks to register a change. The default encoder sample clock runs at approximately 25 to 33 MHz but can be changed globally with the sample-frequency or muxed-sample-frequency pin.
- .vel-timeout (real, rw)
-
When the encoder is moving slower than one pulse for each time that the driver reads the count from the FPGA (in the hm2_read() function), the velocity is harder to estimate. The driver can wait several iterations for the next pulse to arrive, all the while reporting the upper bound of the encoder velocity, which can be accurately guessed. This parameter specifies how long to wait for the next pulse, before reporting the encoder stopped. This parameter is in seconds.
Synchrone serielle Schnittstelle (SSI)
(Nicht zu verwechseln mit dem Smart Serial Interface)
SSI pins and parameters use the prefix hm2_XXXX.N.ssi.MM. One pin is created for each SSI instance regardless of data format:
- .data-invalid (bool, out)
-
This pin will be set "True" if the module was still transferring data when the value was read. When this problem exists there will also be a limited number of error messages printed to the UI. This pin should be used to monitor whether the problem has been addressed by config changes. Solutions to the problem depend on whether
-
the encoder read is being triggered by the hm2dpll phase-locked-loop timer (described above)
-
or by the trigger-encoders function (described below).
-
Die Namen der Pins, die vom SSI-Modul erzeugt werden, hängen vollständig von der Formatstring für jeden Kanal ab, der in der loadrt-Befehlszeile angegeben ist. Ein typischer Formatstring könnte sein ssi_chan_0=error%1bPosition%24g.
This would interpret the LSB of the bit-stream as a bool-type pin named "error" and the next 24 bits as a Gray-coded encoder counter. The encoder-related HAL pins would all begin with "position".
Der Formatstring sollte keine Leerzeichen enthalten, da diese vom Low-Level-Code als Trennzeichen verwendet werden.
Das Format besteht aus einer Zeichenkette mit alphanumerischen Zeichen, welche die HAL-Pin-Namen bilden, gefolgt von einem %-Symbol, einer Bit-Anzahl und einem Datentyp. Alle Bits des Pakets müssen definiert werden, auch wenn sie nicht verwendet werden. Es gibt eine Obergrenze von insgesamt 64 Bits.
Die gültigen Formatzeichen und die von ihnen erzeugten Pins sind:
- p: (Pad)
-
Erzeugt keine Pins, wird verwendet, um Abschnitte des Bitstroms zu ignorieren, die nicht benötigt werden.
- b: (Boolesch).
-
(bool, out) .<name>.
If any bits in the designated field width are non-zero then the HAL pin will be "True".
(bool, out) .<name>-not.
An inverted version of the above, the HAL pin will be "True" if all bits in the field are zero. - u: (ohne Vorzeichen)
-
(real, out) .<name>. The value of the bits interpreted as an unsigned integer then scaled such that the pin value will equal the scalemax parameter value when all bits are high. (for example if the field is 8 bits wide and the scalmax parameter was 20 then a value of 255 would return 20, and 0 would return 0.
- s: (mit Vorzeichen)
-
(real, out) .<name>.
The value of the bits interpreted as a 2s complement signed number then scaled similarly to the unsigned variant, except symmetrical around zero. - f: (BitFeld)
-
(bool, out) .<name>-NN.
The value of each individual bit in the data field. NN starts at 00 up to the number of bits in the field.
(bool, out) .<name>-NN-not.
An inverted version of the individual bit values. - e: (Encoder)
-
(sint, out) .<name>.count.
The lower 32 bits of the total encoder counts. This value is reset both by the …reset and the …index-enable pins.
(sint, out) .<name>.rawcounts.
The lower 32 bits of the total encoder counts. The pin is not affected by reset and index.
(real, out) .<name>.position.
The encoder position in machine units. This is calculated from the full 64-bit buffers so will show a True value even after the counts pins have wrapped. It is zeroed by reset and index enable.
(bool, io) .<name>.index-enable.
When this pin is set "True" the module will wait until the raw encoder counts next passes through an integer multiple of the number of counts specified by counts-per-rev parameter and then it will zero the counts and position pins, and set the index-enable pin back to "False" as a signal to the system that "index" has been passed. this pin is used for spindle-synchronised motion and index-homing.
(bool, io) .<name>.reset.
When this pin is set high the counts and position pins are zeroed. - h: (Split-Encoder, Bits höherer Ordnung)
-
Bei einigen Encodern (einschließlich Fanuc) werden die Teil- und Gesamtumdrehungszahlen in separaten, nicht zusammenhängenden Feldern gespeichert. Dieses Tag definiert die Bits höherer Ordnung eines solchen Encoder-Moduls. Es kann nur ein h- und ein l-Tag pro Kanal geben, das Verhalten bei mehreren solcher Kanäle ist undefiniert.
- l: (Split encoder, low-order bits)
-
Bits niedriger Ordnung (siehe "h")
- g: (Gray-code)
-
Dies ist ein Modifizierer, der angibt, dass die folgende Formatzeichenfolge im Gray-code kodiert ist.
- m: (Multi-turn)
-
Dies ist ein Modifizierer, der angibt, dass die folgenden Formatzeichenfolge ein Multiturn-Encoder ist. Dies gilt nur für Drehgeber (e, h l). Ein Sprung in der Encoderposition von mehr als der Hälfte des vollen Skalenendwerts wird als volle Umdrehung interpretiert und die Zählungen werden umgebrochen. Bei einem Multiturn-Encoder ist dies wahrscheinlich nur ein Datenfehler und führt zu einem permanenten Offset. Dieses Flag besteht darin, dass solche Encoder niemals umgebrochen werden.
Parameters
Zwei Parameter werden universell für alle SSI-Instanzen erstellt
- .frequency-khz (real, rw)
-
This parameter sets the SSI clock frequency. The units are kHz, so 500 will give a clock frequency of 500,000 Hz.
- .timer-number (uint, rw)
-
This parameter allocates the SSI module to a specific hm2dpll timer instance. This pin is only of use in firmwares which contain a hm2dpll function and will default to 1 in cases where there is such a function, and 0 if there is not. The pin can be used to disable reads of the encoder, by setting to a nonexistent timer number, or to 0.
Andere Parameter hängen von den in der Konfigurationszeichenfolge angegebenen Datentypen ab.
- p: (Pad)
-
Keine Parameter.
- b: (Boolesch)
-
Keine Parameter.
- u: (ohne Vorzeichen)
-
(real, rw) .<name>-scalemax. The scaling factor for the channel.
- s: (mit Vorzeichen)
-
(real, rw) .<name>-scalemax. The scaling factor for the channel.
- f: (BitFeld)
-
Keine Parameter.
- e: (Encoder)
-
(real, rw) .<name>.scale. The encoder scale in counts per machine unit. (uint, rw) .<name>.counts-per-rev. Used to emulate the index behaviour of an incremental+index encoder. This would normally be set to the actual counts per rev of the encoder, but can be any whole number of revs. Integer divisors or multipliers of the true PPR might be useful for index-homing. Non-integer factors might be appropriate where there is a synchronous drive ratio between the encoder and the spindle or ballscrew.
BiSS
BiSS is a bidirectional variant of SSI. Currently only a single direction is supported by LinuxCNC (encoder to PC). BiSS pins and parameters use the prefix hm2_XXXX.NN.biss.MM. One pin is created for each BiSS instance regardless of data format:
- .data-invalid (bool, out)
-
This pin will be set "True" if the module was still transferring data when the value was read. When this problem exists there will also be a limited number of error messages printed to the UI. This pin should be used to monitor whether the problem has been addressed by config changes. Solutions to the problem depend on whether the encoder read is being triggered by the hm2dpll phase-locked-loop timer (described above) or by the trigger-encoders function (described below).
Die Namen der Pins, die vom BiSS-Modul erzeugt werden, hängen vollständig von dem Formatstring für jeden Kanal ab, der in der loadrt-Befehlszeile angegeben ist, und folgen genau dem oben für SSI definierten Format. Derzeit Datenpakete von bis zu 96 Bit werden von der LinuxCNC-Treiber unterstützt, obwohl die Mesa Hostmot2 Modul kann 512 Bit-Pakete zu behandeln. Es sollte möglich sein, die Anzahl der vom Treiber unterstützten Pakete zu erweitern, wenn ein Bedarf dafür besteht.
Fanuc-Encoder
The pins and format specifier for this module are identical to the SSI module described above, except that at least one pre-configured format is provided. A modparam of fanuc_chan_N=AA64 (case sensitive) will configure the channel for a Fanuc Aa64 encoder. The pins use the prefix hm2_XXXX.N.fanuc.MM and are:
- .batt_fail (bool, out)
-
Anzeige des Batterie-Zustands
- .batt_fail-not (bool, out)
-
invertierte Version von oben
- .comm (uint, out)
-
Der absolute 0–1023-Ausgang für die Motor-Kommutierung
- .crc (uint, out)
-
Die CRC-Prüfsumme. Derzeit hat HAL keine Möglichkeit, dies zu verwenden
- .encoder.count (sint, out)
-
Encoder Zählung
- .encoder.index-enable (bool, io)
-
Simulierter Index. Gesetzt durch counts-per-rev parameter
- .encoder.position (real, out)
-
Zähler (engl. counts) sind skaliert durch den …scale (engl. für Skala) Parameter
- .encoder.rawcounts (sint, out)
-
"raw counts" (Maschinen-nahe Zählung), unbeeinflusst von einem Reset oder Index-Signal
- .encoder.reset (bool, io)
-
Wenn hoch/wahr werden die Zählung (counts) und Position auf Null gesetzt
- .pos_invalid (bool, out)
-
Indicates that the absolute position is not valid
- .pos_invalid-not (bool, out)
-
Invertierte Version
resolver
Resolver haben Namen wie hm2_<BoardType>.<BoardNum>.resolver.<Instance>. <Instance> ist eine zweistellige Zahl, die bei der 7I49-Karte zwischen 00 und 05 liegt. Diese Funktion funktioniert nur mit den Mesa Resolver-Schnittstellenkarten (von denen die 7I49 zum Zeitpunkt der Erstellung dieses Artikels das einzige Beispiel ist). Diese Karte verwendet eine SPI-Schnittstelle zur FPGA-Karte und funktioniert nur mit der richtigen Firmware. Die zugewiesenen Pins werden in der dmesg-Ausgabe aufgelistet, können aber wahrscheinlich nicht sinnvoll mit HAL-Tools getestet werden.
Pins:
- .angle (real, out)
-
This pin indicates the angular position of the resolver. It is a number between 0 and 1 for each electrical rotation.
- .position (real, out)
-
Calculated from the number of complete and partial revolutions since startup, reset, or index-reset multiplied by the scale parameter.
- .velocity (real, out)
-
Calculated from the rotational velocity and the velocity-scale parameter. The default scale is electrical rotations per second.
- .velocity-rpm (real, out)
-
Simply velocity scaled by a factor of 60 for convenience.
- .count (sint, out)
-
This pins outputs a simulated encoder count at 224 counts per rev (16777216 counts).
- .rawcounts (sint, out)
-
This is identical to the counts pin, except it is not reset by the "index" or "reset" pins. This is the pin which would be linked to the bldc HAL component if the resolver was being used to commutate a motor.
- .reset (bool, in)
-
Resets the position and counts pins to zero immediately.
- .joint-pos-fb (real, in)
-
The Mesa resolver driver has the capability of emulating an absolute encoder using a position file (see the INI-config section of the manual) and the single-turn absolute operation of resolvers. At startup, and only if the use-position-file parameter is set to "True", the resolver driver will wait for a value to be written by the system to the axis.N.joint-pos-fb pin (which must be netted to this resolver pin) and will calculate the number of full turns that best matches the current resolver position. It will then pre-load the driver output with this offset. This should only be used on systems where axis movement in the unpowered state is unlikely. This feature will only work properly if the machine is initially homed to "index" and if the axis home positions are exactly zero.
- .index-enable (bool, io)
-
When this pin is set high the position and counts pins will be reset the next time the resolver passes through the zero position. At the same time the pin is driven low to indicate to connected modules that the index has been seen, and that the counters have been reset.
- .error (bool, out)
-
Indicates an error in the particular channel. If this value is "True" then the reported position and velocity are invalid.
Parameters:
- .scale (real, rw)
-
Die Positionsskala in Maschineneinheiten pro elektrischer Umdrehung des Resolvers.
- .velocity-scale (real, rw)
-
Der Umrechnungsfaktor zwischen Resolverdrehzahl und Maschinengeschwindigkeit. Ein Wert von 1 ergibt typischerweise die Motordrehzahl in U/min, ein Wert von 0,01666667 ergibt die (ungefähre) U/min.
- .index-divisor (default 1) (uint, rw)
-
The resolver component emulates an index at a fixed point in the sin/cos cycle. Some resolvers have multiple cycles per rev (often related to the number of pole-pairs on the attached motor). LinuxCNC requires an index once per revolution for proper threading etc. This parameter should be set to the number of cycles per rev of the resolver. CAUTION: Which pseudo-index is used will not necessarily be consistent between LinuxCNC runs. Do not expect to re-start a thread after restarting LinuxCNC. It is not appropriate to use this parameter for index-homing of axis drives.
- .excitation-khz (real, rw)
-
This pin sets the excitation frequency for the resolver. This pin is module-level rather than instance-level as all resolvers share the same excitation frequency. Valid values are 10 (ca. 10 kHz), 5 (ca. 5 kHz) and 2.5 (ca. 2.5 kHz). The actual frequency depends on the FPGA frequency, and they correspond to CLOCK_LOW/5000, CLOCK_LOW/10000 and CLOCK_LOW/20000 respectively. The parameter will be set to the closest available of the three frequencies. A value of -1 (the default) indicates that the current setting should be retained.
- .use-position-file (bool, rw)
-
In conjunction with joint-pos-fb (qv) emulate absolute encoders.
pwmgen
pwmgens have names like hm2_<BoardType>.<BoardNum>.pwmgen.<Instance>. <Instance> is a two-digit number that corresponds to the HostMot2 pwmgen instance number. There are "num_pwmgens"-many instances, starting with 00.
Der HAL-Pin, der die Ausgabe des vierten pwmgen auf der ersten 7I43-Karte aktiviert, lautet beispielsweise: hm2_7i43.0.pwmgen.03.enable (dies setzt voraus, dass die Firmware auf dieser Karte so konfiguriert ist, dass dieses HAL-Objekt verfügbar ist).
In HM2 nutzt jeder pwmgen drei Ausgabe I/O Pins: Not-Enable, Out0, and Out1. Die Funktion der I/O-Pins Out0 und Out1 variiert je nach Ausgangstyp-Parameter (siehe unten).
Die hm2 pwmgen-Darstellung ist der Softwarekomponente pwmgen ähnlich. Jede pwmgen-Instanz hat die folgenden Pins und Parameter:
Pins:
- .enable (bool, in)
-
If True, the pwmgen will set its Not-Enable pin False and output its pulses. If "enable" is False, pwmgen will set its Not-Enable pin True and not output any signals.
- .value (real, in)
-
The current pwmgen command value, in arbitrary units.
Parameters:
- .scale (real, rw)
-
Scaling factor to convert "value" from arbitrary units to duty cycle: dc = value / scale. Duty cycle has an effective range of -1.0 to +1.0 inclusive, anything outside that range gets clipped. The default scale is 1.0.
- .output-type (sint, rw)
-
This emulates the output_type load-time argument to the software pwmgen component. This parameter may be changed at runtime, but most of the time you probably want to set it at startup and then leave it alone. Accepted values are 1 (PWM on Out0 and Direction on Out1), 2 (Up on Out0 and Down on Out1), 3 (PDM mode, PDM on Out0 and Dir on Out1), and 4 (Direction on Out0 and PWM on Out1, "for locked antiphase").
- .offset-mode (bool, rw)
-
When True, offset-mode modifies the PWM behavior so that a PWM value of 0 results in a 50% duty cycle PWM output, a -1 value results in a 0% duty cycle and +1 results in a 100% duty cycle (with default scaling). This mode is used by some PWM motor drives and PWM to analog converters. Typically the direction signal is not used in this mode.
- .dither (bool, rw)
-
When True, dither causes the PWM output to dither between two adjacent PWM register values at the PWM frequency. This increases the PWM resolution when used for analog output purposes, increasing the maximum resolution from 12 to 16 bits. Dither is only supported with PWMGen firmware version 1 or greater and only affects PWM outputs, not PDM outputs.
Zusätzlich zu den oben aufgeführten HAL-Parametern pro Instanz gibt es eine Reihe von HAL-Parametern, die alle pwmgen-Instanzen betreffen:
- .pwm_frequency (uint, rw)
-
This specifies the PWM frequency, in Hz, of all the pwmgen instances running in the PWM modes (modes 1 and 2). This is the frequency of the variable-duty-cycle wave. Its effective range is from 1 Hz up to 386 kHz. Note that the max frequency is determined by the ClockHigh frequency of the Anything IO board; the 5I25 and 7I92 both have a 200 MHz clock, resulting in a 386 kHz max PWM frequency. Other boards may have different clocks, resulting in different max PWM frequencies. If the user attempts to set the frequency too high, it will be clipped to the max supported frequency of the board. Frequencies below about 5 Hz are not terribly accurate, but above 5 Hz they’re pretty close. The default pwm_frequency is 20,000 Hz (20 kHz).
- .pdm_frequency (uint, rw)
-
This specifies the PDM frequency, in Hz, of all the pwmgen instances running in PDM mode (mode 3). This is the "pulse slot frequency"; the frequency at which the pdm generator in the AnyIO board chooses whether to emit a pulse or a space. Each pulse (and space) in the PDM pulse train has a duration of 1/pdm_frequency seconds. For example, setting the pdm_frequency to 2e6 (2 MHz) and the duty cycle to 50% results in a 1 MHz square wave, identical to a 1 MHz PWM signal with 50% duty cycle. The effective range of this parameter is from about 1525 Hz up to just under 200 MHz. Note that the max frequency is determined by the ClockHigh frequency of the Anything IO board; the 5I25 and 7I92 both have a 100 MHz clock, resulting in a 100 MHz max PDM frequency. Other boards may have different clocks, resulting in different max PDM frequencies. If the user attempts to set the frequency too high, it will be clipped to the max supported frequency of the board. The default pdm_frequency is 20,000 Hz (20 kHz).
3ppwmgen
Three-Phase PWM generators (3pwmgens) are intended for controlling the high-side and low-side gates in a 3-phase motor driver. The function is included to support the Mesa motor controller daughter-cards but can be used to control an IGBT or similar driver directly. 3pwmgens have names like hm2_<BoardType>.<BoardNum>.3pwmgen.<Instance> where <Instance> is a 2-digit number. There will be num_3pwmgens instances, starting at 00. Each instance allocates 7 output and one input pins on the Mesa card connectors. Outputs are: PWM A, PWM B, PWM C, /PWM A, /PWM B, /PWM C, Enable. The first three pins are the high side drivers, the second three are their complementary low-side drivers. The enable bit is intended to control the servo amplifier. The input bit is a fault bit, typically wired to over-current detection. When set, the PWM generator is disabled. The three phase duty-cycles are individually controllable from -Scale to +Scale. Note that 0 corresponds to a 50% duty cycle and this is the initialization value.
Pins:
- .A-value, .B-value, .C-value (real, in)
-
The PWM command value for each phase, limited to +/- "scale". Defaults to zero which is 50% duty cycle on high-side and low-sidepins (but see the "deadtime" parameter).
- .enable (bool, in)
-
When high the PWM is enabled as long as the fault bit is not set by the external fault input pin. When low the PWM is disabled, with both high- side and low-side drivers low. This is not the same as 0 output (50% duty cycle on both sets of pins) or negative full scale (where the low side drivers are "on" 100% of the time).
- .fault (bool, out)
-
Indicates the status of the fault bit. This output latches high once set by the physical fault pin until the "enable" pin is set to high.
Parameters:
- .deadtime (uint, rw)
-
Sets the dead-time between the high-side driver turning off and the low-side driver turning on and vice-versa. Deadtime is subtracted from on time and added to off time symmetrically. For example with 20 kHz PWM (50 µs period), 50% duty cycle and zero dead time, the PWM and NPWM outputs would be square waves (NPWM being inverted from PWM) with high times of 25 µs. With the same settings but 1 µs of deadtime, the PWM and NPWM outputs would both have high times of 23 µs (25 - (2X 1 µs), 1 µs per edge). The value is specified in nanoseconds (ns) and defaults to a rather conservative 5000 ns. Setting this parameter to too low a value could be both expensive and dangerous as if both gates are open at the same time there is effectively a short circuit across the supply.
- .scale (real, rw)
-
Sets the half-scale of the specified 3-phase PWM generator. PWM values from -scale to +scale are valid. Default is +/- 1.0
- .fault-invert (bool, rw)
-
Sets the polarity of the fault input pin. A value of 1 means that a fault is triggered with the pin high, and 0 means that a fault it triggered when the pin is pulled low. Default 0, fault = low so that the PWM works with the fault pin unconnected.
- .sample-time (real, rw)
-
Sets the time during the cycle when an ADC pulse is generated. 0 = start of PWM cycle and 1 = end. Not currently useful to LinuxCNC. Default is 0.5.
Zusätzlich zu den oben genannten Parametern pro Instanz gibt es den folgenden Parameter, der alle Instanzen betrifft:
- .frequency (uint, rw)
-
Stellt die Master-PWM-Frequenz ein. Das Maximum liegt bei ca. 48 kHz, das Minimum bei 1 kHz. Die Standardeinstellung ist 20 kHz.
oneshot
The oneshot is a hardware one-shot device suitable for various timing, delay, signal conditioning, PWM generation, and watchdog functions. The oneshot module includes 2 timers to allow variable pulse delays for applications like phase control. Trigger sources can be software, external inputs, the DPLL timer, a built in rate generator or the other timer. Oneshots have names like hm2_<BoardType>.<BoardNum>.oneshot.<Instance> where <Instance> is a 2-digit number. There will be num_oneshots instances, starting at 00. Each instance allocates up to two input and two output pins.
Pins:
- .width1 (real, in)
-
Sets the pulse width of timer1 in ms. Default is 1 ms (1/1000 s).
- .width2 (real, in)
-
Sets the pulse width of timer2 in ms. Default is 1 ms (1/1000 s).
- .filter1 (real, in)
-
Sets digital filter time constant for timer1’s external trigger input Filter time is in ms. Default filter time constant time is 0.1 ms. External trigger response will be delayed by the filter time setting.
- .filter2 (real, in)
-
Sets digital filter time constant for timer2’s external trigger input Filter time is in ms. Default filter time constant time is 0.1 ms. External trigger response will be delayed by the filter time setting.
- .rate (real, in)
-
Sets the frequency of the built in rate generator (in Hz)
- .trigger_select1, .trigger_select2 (uint, in)
-
Sets the trigger source for timer1,timer2 respectively. Trigger sources are:
0 Trigger deaktiviert 1 Software-Trigger: wird ausgelöst, wenn der Hal-Pin swtrigger1 wahr ist 2 Externe Hardware: Trigger 3 DPLL-Trigger: ausgelöst durch den ausgewählten DPLL-Timer 4 Raten-Trigger: ausgelöst durch den eingebauten Ratengenerator. 5 Timer1-Trigger: ausgelöst durch den Timer1-Ausgang 6 Timer2-Trigger: ausgelöst durch den Timer2-Ausgang
- .trigger_on_rise1, .trigger_on_rise2 (bool, in)
-
When true, triggers timer1, timer2 respectively on the rising edge of the trigger source.
- .trigger_on_fall1, .trigger_on_fall2 (bool, in)
-
When true, triggers timer1, timer2 respectively on the falling edge of the trigger source.
- .retriggerable1, .retriggerable2 (bool, in)
-
When true, the associated timer is retriggerable, meaning the timer will reset to full time on a trigger event even during the output pulse period. When false the timer is not retriggerable, meaning it will ignore trigger events during the output pulse period.
- .enable1, .enable2 (bool, in)
-
Trigger enable for timer1 and timer2 respectively True to enable.
- .reset1, .reset2 (bool, in)
-
If true, resets timer1 and timer2 respectively, aborting any pulse in progress.
- .out1, .out2 (bool, out)
-
Pulse output status bits for timer1 and timer2.
- .exttrigger1, .exttrigger2 (bool, out)
-
External trigger input status bits for timer1 and timer2. These monitor the filtered inputs.
- .swtrigger1, .swtrigger2 (bool, in)
-
Software trigger inputs to trigger timer1 and timer2.
periodm
Das periodm ist ein Modul zur Messung von Periode/Breite/Tastverhältnis. Es kann Periode, Frequenz, Impulsbreite und Tastverhältnis messen. Es kann auch den Mittelwert der Messwerte für die Rauschfilterung ermitteln.
Pins:
- .period_us (real, out)
-
Input period in microseconds.
- .width_us (real, out)
-
Input pulse width in microseconds.
- .duty_cycle (real, out)
-
Input duty cycle (width/period) scaling and offset are changeable.
- .duty_cycle_scale (real, in)
-
Sets the scale of the duty cycle value, default is 100.
- .duty_cycle_offset (real, in)
-
Sets an offset to the duty cycle value, added after scaling. Default is 0.
- .averages (uint, io)
-
Anzahl der zu mittelnden Perioden/Breiten. Von 1 bis 4095. Die Aktualisierungsrate von Periode, Breite, Tastverhältnis und Frequenz entspricht der Eingangsfrequenz/dem Durchschnitt.
- .frequency (real, out)
-
Eingangsfrequenz in Hz.
- .minimum_frequency (real, in)
-
Minimum input frequency in Hz, if input frequency is lower than this threshold, the valid bit will be cleared. .filtertc_us (real, in):: The periodm input in conditioned with a digital filter for noise rejection. The time constant of this filter is settable via this pin in units of microseconds. Pulses shorter than this time constant will not be recognized. .valid (bool, out):: The valid output bit is true when the input signal is present and the input frequency exceeds the minimum frequency setting. .invert (bool, io):: The invert bit sets the input polarity, when false, the input is direct which means the input high time determines the width. When set true, the input is inverted so the input low time determines the width. .input_status (bool, out):: The input_status bit reads the real time filtered input status (affected by invert pin).
rcpwmgen
The rcpwmgen is a simple PWM generator optimized for use with standard RC servos that use pulse width to determine position. rcpwmgens have names like hm2_<BoardType>.<BoardNum>.rcpwmgen.<Instance> where <Instance> is a 2-digit number. There will be num_rcpwmgens-many instances, starting at 00. Each instance allocates a single output pin. Unlike the standard PWM generator, the rcpwmgen output is specified in width rather than duty cycle so the pulse width is independent of the operating frequency. Resolution is approximately 1/2000 for standard 1 to 2 ms range RC servos.
Pins:
- .rate (real, in)
-
Stellt die Master-RC-PWM-Frequenz ein. Maximum ist 1 kHz, Minimum ist 0,01 Hz. Die Voreinstellung ist 50 Hz.
- .width (real, in)
-
Einstellung der Impulsbreite pro Kanal in (ms/Skala).
- .offset (real, in)
-
Legt den Impulsbreiten-Offset pro Kanal in ms fest. Bei 1-2 ms-Servos für eine 0-Mittelstellung würde dieser Wert auf 1,5 ms gesetzt werden.
- .scale (real, in)
-
Legt die Skalierung der Impulsbreite pro Kanal fest. Z. B. würde die Einstellung der Skala auf 90 und der Offset auf 1,5 ms zu einem Positionsbereich von +-45 Grad führen und skalieren in Grad für 1-2 ms-Servos mit einem vollen Bewegungsbereich von 90 Grad.
stepgen
stepgens have names like hm2_<BoardType>.<BoardNum>.stepgen.<Instance>. <Instance> is a two-digit number that corresponds to the HostMot2 stepgen instance number. There are "num_stepgens"-many instances, starting with 00.
So ist zum Beispiel der HAL-Pin, der die aktuelle Position Rückmeldung vom ersten Stepgen der zweiten 5I22-Karte hat, ist: hm2_5i22.1.stepgen.00.position-fb (dies setzt voraus, dass die Firmware in dieser Karte so konfiguriert ist, dass dieses HAL-Objekt verfügbar ist).
Jedes stepgen verwendet zwischen 2 und 8 I/O-Pins. Die Signale an diesen Pins hängen vom dem Parameter step_type ab (siehe unten).
Die stepgen-Darstellung wird durch die stepgen-Softwarekomponente modelliert. Jede stepgen-Instanz hat die folgenden Pins und Parameter:
Pins:
- .position-cmd (real, in)
-
Target position of stepper motion, in arbitrary position units. This pin is only used when the stepgen is in position control mode (control-type=0). .velocity-cmd (real, in):: Target velocity of stepper motion, in arbitrary position units per second. This pin is only used when the stepgen is in velocity control mode (control-type=1).
- .counts (sint, out)
-
Rückmeldeposition in Zählungen (Anzahl der Schritte).
- .position-fb (real, out)
-
Rückmeldung der Position in skalierten Positionseinheiten. Dies ist ähnlich wie "counts/position_scale", hat aber eine feinere Auflösung als Schrittauflösung.
- .position-latch (real, out)
-
Rückmeldung der verriegelten Position in skalierten Positionseinheiten. Dies ist ähnlich wie "counts/position_scale", hat aber eine feinere Auflösung als Schrittauflösung.
- .velocity-fb (real, out)
-
Feedback-Geschwindigkeit in beliebigen Positions-Einheiten pro Sekunde.
- .enable (bool, in)
-
Dieser Pin aktiviert die Schrittgeneratorinstanz. Bei True funktioniert die stepgen-Instanz wie erwartet. Wenn False, werden keine Schritte generiert und velocity-fb geht sofort auf 0. Wenn sich der Schritt bewegt, wenn enable auf False gesetzt wird, stoppt er sofort, ohne das maxaccel limit einzuhalten.
- .position-reset (bool, in)
-
Resets position to 0 when True. Useful for step/dir controlled spindles when switching between spindle and joint modes. .control-type (bool, in):: Switches between position control mode (0) and velocity control mode (1). Defaults to position control (0). .index-enable (bool, io):: When this pin is set to True, the step count (and therefore also position) are reset to zero on the next stepgen index pulse. At the same time, index-enable is reset to zero to indicate that the pulse has occurred. .index-invert (bool, in):: If set to True, the rising edge of the index input pin triggers the position clear event (if index-enable is True). If set to False, the falling edge triggers. .probe-enable (bool, io):: When this pin is set to True, the step count (and therefore also position) are latched on the the next stepgen probe active edge. At the same time, probe-enable is reset to zero to indicate that a latch event has occurred. .probe-invert (bool, in):: If set to True, the rising edge of the probe input pin triggers the latch event (if probe-enable is True). If set to False, the falling edge triggers.
Parameters:
- .position-scale (real, rw)
-
Converts from counts to position units. position = counts / position_scale
- .maxvel (real, rw)
-
Maximum speed, in position units per second. If set to 0, the driver will always use the maximum possible velocity based on the current step timings and position-scale. The max velocity will change if the step timings or position-scale changes. Defaults to 0.
- .maxaccel (real, rw)
-
Maximum acceleration, in position units per second per second. Defaults to 1.0. If set to 0, the driver will not limit its acceleration at all. This requires that the position-cmd or velocity-cmd pin is driven in a way that does not exceed the machine’s capabilities. This is probably what you want if you are going to be using the LinuxCNC trajectory planner to jog or run G-code.
- .steplen (uint, rw)
-
Duration of the step signal, in nanoseconds.
- .stepspace (uint, rw)
-
Minimum interval between step signals, in nanoseconds.
- .dirsetup (uint, rw)
-
Minimum duration of stable Direction signal before a step begins, in nanoseconds.
- .dirhold (uint, rw)
-
Minimum duration of stable Direction signal after a step ends, in nanoseconds.
- .step_type (uint, rw)
-
Output format, like the step_type modparam to the software stepgen(9) component: 0 = Step/Dir, 1 = Up/Down, 2 = Quadrature, 3+ = table-lookup mode. In this mode the step_type parameter determines how long the step sequence is. Additionally the stepgen_width parameter in the loadrt config string must be set to suit the number of pins per stepgen required. Any stepgen pins above this number will be available for GPIO. This mask defaults to 2. The maximum length is 16. Note that Table mode is not enabled in all firmwares but if you see GPIO pins between the stepgen instances in the dmesg/log hardware pin list then the option may be available.
Im Quadraturmodus (step_type=2) gibt der Schritt ein komplettes Gray aus Zyklus (00 → 01 → 11 → 10 → 00) für jeden "Schritt", den es braucht, die Skala muss daher durch 4 relativ zum Standardschritt/-verzeichnis geteilt werden. Im Tabellenmodus werden bis zu 6 I/O-Pins einzeln in beliebiger Reihenfolge bis zu 16 Phasen lang angesteuert.
- .swap_step_dir (bool, rw)
-
This swaps the step and direction outputs on the selected stepgen. This parameter is only available if the firmware supports this option.
- .table-data-N (uint, rw)
-
There are 4 table-data-N parameters, table-data-0 to table-data-3. These each contain 4 bytes corresponding to 4 stages in the step sequence. For example table-data-0 = 0x00000001 would set stepgen pin 0 (always called "Step" in the dmesg output) on the first phase of the step sequence, and table-data-4 = 0x20000000 would set stepgen pin 6 ("Table5Pin" in the dmesg output) on the 16th stage of the step sequence.
- .timer-number (default: -1) (sint, in)
-
Sets the hm2dpll timer instance to be used to latch stepgen counts. This pin is global to the stepgen module and has no instance number in the name. A setting of -1 does not latch stepgen counts. A setting of 0 latches at the same time as the main hostmot2 read. A setting of 1..4 uses a time offset from the main hostmot2 read according to the dpll’s timer-us setting.
Normalerweise sollte timer-us eine negative Zahl sein, deren Betrag größer ist als die größte Latenz (z. B. -100 für ein System mit mittelmäßiger Latenz, -50 für ein System mit guter Latenz). Eine negative Zahl gibt an, dass die angegebene Zeit vor der nominalen hostmot2-Lesezeit verriegelt wird.
Wenn in der FPGA-Firmware kein DPLL-Modul vorhanden ist oder wenn das Stepgen-Modul DPLL nicht unterstützt, wird dieser Pin nicht angelegt.
Wenn verfügbar, sollte diese Funktion in der Regel aktiviert sein. Dadurch werden im Allgemeinen folgende Fehler reduziert.
Smart Serial Interface
Das Smart Serial Interface ermöglicht den Anschluss von bis zu 32 verschiedenen Geräten wie dem Mesa 8i20 2,2 kW 3-Phasen-Antrieb oder 7I64 48-Wege-I/O-Karten an eine einzige FPGA-Karte. Der Treiber erkennt automatisch den angeschlossenen Hardware-Port, Kanal und Gerätetyp. Geräte können in beliebiger Reihenfolge an jeden aktiven Kanal eines aktiven Ports angeschlossen werden (siehe die config modparam Definition oben).
For full details of the smart-serial devices see sserial(9).
BSPI
Der BSPI-Treiber (Buffered SPI) ist insofern ungewöhnlich, als dass er keine HAL Pins erzeugt. Stattdessen exportiert der Treiber eine Reihe von Funktionen, die von einem Subtreiber für die angeschlossene Hardware verwendet werden können. Typischerweise würden diese in der "comp" geschrieben werden.
Vorverarbeitungssprache: siehe https://linuxcnc.org/docs/html/hal/comp.html oder man halcompile für weitere Details. Siehe mesa_7i65(9) und den Quelltext von mesa_7i65.comp für Details eines typischen Subtreibers. Siehe hm2_bspi_setup_chan(3), hm2_bspi_write_chan(3), hm2_tram_add_bspi_frame(3), hm2_allocate_bspi_tram(3), hm2_bspi_set_read_function(3) und hm2_bspi_set_write_function(3) für die exportierten Funktionen.
Die Namen der verfügbaren Kanäle werden beim Laden des Treibers auf die Standardausgabe ausgegeben. Treiberladevorgangs ausgegeben und haben die Form hm2_<board name>.<board index>.bspi.index, z.B. hm2_5i23.0.bspi.0.
UART
Der UART-Treiber erstellt auch keine HAL-Pins, sondern deklariert zwei einfache Lese-/Schreibfunktionen und eine Setup-Funktion, die von benutzergeschriebenem Code verwendet werden können. Typischerweise würde dieser in der Vorverarbeitungssprache "comp" geschrieben werden: Siehe https://linuxcnc.org/docs/html/hal/comp.html oder man halcompile für weitere Details. Siehe mesa_uart(9) und den Quelltext von mesa_uart.comp für Details eines typischen Subtreibers. Siehe hm2_uart_setup_chan(3), hm2_uart_send(3hm2), hm2_uart_read(3) und hm2_uart_setup(3).
Die Namen der verfügbaren uart-Kanäle werden beim Laden des Treibers auf die Standardausgabe Treiber-Ladevorgangs auf die Standardausgabe ausgegeben und haben die Form hm2_<board name>.<board index>.uart.<index>, z.B., hm2_5i23.0.uart.0.
Allzweck-E/A (engl. und Fachsprache: General Purpose I/O)
I/O-Pins auf der Platine, wenn nicht von einer Modulinstanz verwendet, werden als "volle" GPIO-Pins nach HAL exportiert. Vollständige (engl. full) GPIO-Pins können zur Laufzeit als Eingänge, Ausgänge oder offene Abflüsse konfiguriert werden und verfügen über eine HAL-Schnittstelle, die diese Flexibilität ermöglicht. I/O-Pins, die einer aktiven Modulinstanz gehören, sind durch die Anforderungen des besitzenden Moduls eingeschränkt und verfügen über eine eingeschränkte HAL-Schnittstelle.
GPIOs have names like hm2_<BoardType>.<BoardNum>.gpio.<IONum>. <IONum> is a three-digit number. The mapping from <IONum> to connector and pin-on-that-connector is written to the syslog when the driver loads, and it is documented in Mesa’s manual for the Anything I/O boards.
So, for example, the HAL pin that has the current inverted input value read from GPIO 012 of the second 7I43 board is: hm2_7i43.1.gpio.012.in_not (this assumes that the firmware in that board is configured so that this HAL object is available).
Der HAL-Parameter, der steuert, ob der letzte GPIO des ersten 5i22 ein Eingang oder ein Ausgang ist: hm2_5i22.0.gpio.095.is_output (dies setzt voraus dass die Firmware auf dieser Karte so konfiguriert ist, dass dieses HAL-Objekt verfügbar ist).
Die hm2 GPIO-Darstellung ist modelliert entsprechend den digitalen Eingängen und digitale Ausgängen, die im Canonical Device Interface (Teil des HAL-Referenzdokuments) beschrieben sind. Jeder GPIO kann die folgenden HAL-Pins haben:
- .in, .in_not (bool, out)
-
State (normal and inverted) of the hardware input pin. Both full GPIO pins and I/O pins used as inputs by active module instances have these pins.
- .out (bool, in)
-
Value to be written (possibly inverted) to the hardware output pin. Only full GPIO pins have this pin.
Jeder GPIO kann die folgenden Parameter haben:
- .is_output (bool, rw)
-
If set to 0, the GPIO is an input. The I/O pin is put in a high-impedance state (weakly pulled high), to be driven by other devices. The logic value on the I/O pin is available in the "in" and "in_not" HAL pins. Writes to the "out" HAL pin have no effect. If this parameter is set to 1, the GPIO is an output; its behavior then depends on the "is_opendrain" parameter. Only full GPIO pins have this parameter.
- .is_opendrain (bool, rw)
-
This parameter only has an effect if the "is_output" parameter is True. If this parameter is False, the GPIO behaves as a normal output pin: The I/O pin on the connector is driven to the value specified by the "out" HAL pin (possibly inverted), and the value of the "in" and "in_not" HAL pins is undefined. If this parameter is True, the GPIO behaves as an open-drain pin. Writing 0 to the "out" HAL pin drives the I/O pin low, writing 1 to the "out" HAL pin puts the I/O pin in a high-impedance state. In this high-impedance state the I/O pin floats (weakly pulled high), and other devices can drive the value; the resulting value on the I/O pin is available on the "in" and "in_not" pins. Only full GPIO pins and I/O pins used as outputs by active module instances have this parameter.
- .invert_output (bool, rw)
-
This parameter only has an effect if the "is_output" parameter is True. If this parameter is True, the output value of the GPIO will be the inverse of the value on the "out" HAL pin. Only full GPIO pins and I/O pins used as outputs by active module instances have this parameter.
Wenn ein physischer E/A-Pin von einer speziellen Funktion verwendet wird, werden die zugehörigen HAL-Parameter is_output und is_opendrain auf die spezielle Funktion verlagert. Wenn beispielsweise gpio 1 vom ersten Ausgang von pwmgen 0 übernommen wird, werden automatisch Aliase wie hm2_7i92.0.pwmgen.00.out0.invert_output (mit Bezug auf hm2_7i92.0.gpio.001.invert_output) erstellt. Wenn mehr als ein GPIO mit der gleichen Sonderfunktion verbunden ist, wird ein zusätzliches .#. eingefügt, so dass die Einstellungen für jeden zugehörigen GPIO separat festgelegt werden können. Bei der Firmware SV12IM_2X7I48_72 zum Beispiel werden der Alias hm2_5i20.0.pwmgen.00.0.enable.invert_output (bezogen auf hm2_5i20.0.gpio.000.invert_output) und hm2_5i20.0.pwmgen.00.1.enable.invert_output (mit Bezug auf hm2_5i20.0.gpio.023.invert_output) beide erstellt.
inm und inmux
inm/inmuxs are input debouncing modules that support hardware digital filtering of input pins. In addition to the input filtering function, the inm/inmux modules support up to 4 simple quadrature counters for MPG use. The quadrature inputs for MPG encoders 0 through 3 are inm/inmux pins 0 through 7. MPG A,B inputs use the filter time constants programmed for inputs 0..7. Each inm/inmux input pin can have a slow or fast filter constant. Filter time constants are specified in units of scan times. inms have names like hm2_<BoardType>.<BoardNum>.inm.<Instance>. inmuxes have names like hm2_<BoardType>.<BoardNum>.inmux.<Instance>. "Instance" is a two-digit number that corresponds to the HostMot2 inm or inmux instance number. There are "num_inms" or numx_inmuxs" instances, starting with 00.
Jede Instanz liest zwischen 8 und 32 Eingangs-Pins. inm und inmux sind bis auf den Pin-Namen und der physikalischen Schnittstelle identisch.
Pins:
- .input-MM (bool, out)
-
Filtered input state.
- .input-MM-not (bool, out)
-
Inverted filtered input state.
- .raw-input-MM (bool, out)
-
Unfiltered input state.
- .raw-input-MM-not (bool, out)
-
Inverted unfiltered input state. .input-MM-slow (bool, in):: If True, selects the long time constant filter for the corresponding input, if False the short time constant is used.
- .enc0-count, .enc1-count, .enc2-count, .enc3-count (sint, out)
-
MPG counters 0 through 3. .enc0-reset, .enc1-reset, .enc2-reset, .enc3-reset (bool, in):: Reset for MPG counters 0 through 3, count is forced to 0 if true.
Parameters:
- .scan_rate (uint, rw)
-
This sets the input scan rate in Hz. Default scan rate is 20 kHz (50 µs scan period).
- .fast_scans (uint, rw)
-
This sets the fast time constant for all input pins. This is the time constant used when the .input-MM-slow pin for the corresponding input is False. The range is 0 to 63 scan periods and the default value is 5 = 250 µs at the default 20 kHz scan_rate.
- .slow_scans (uint, rw)
-
This sets the slow time constant for all input pins. This is the time constant used when the .input-MM-slow pin for the corresponding input is True. The range is 0 to 1023 scan periods and the default value is 500 = 25 ms at the default 20 kHz scan_rate.
- .enc0_4xmode, .enc1_4xmode, .enc2_4xmode, and .enc3_4xmode (bool, rw)
-
These set the MPG encoder operating modes to 4X when True and 1X when False.
- .scan_width (uint, ro)
-
This read only parameter specifies the number of inputs scanned by the module.
led
Erzeugt HAL-Pins für die LEDs auf dem FPGA-Board.
Pins:
- .CR<NN> (bool, in)
-
The pins are numbered from CR01 upwards with the name corresponding to the PCB silkscreen. Setting the bit to "True" or 1 lights the LED.
Solid State Relay
SSRs have names like hm2_<BoardType>.<BoardNum>.ssr.<Instance>. Instance is a two-digit number that corresponds to the HostMot2 SSR instance number. There are num_ssrs instances, starting with 00.
Jede Instanz verfügt über einen Ratensteuerungs-Pin und zwischen 1 und 32 Ausgangspins.
Pins:
- .rate (uint, in)
-
Set the internal frequency of the SSR instance, in Hz (approximate). The valid range is 25 kHz to 25 MHz. Values below the minimum will use the minimum, and values above the max will use the max. 1 MHz is a typical value, and appropriate for all Mesa cards, and is the default. Set to 0 to disable this SSR instance.
- .out-NN (bool, in)
-
The state of this SSR instance’s NNth output. Set to 0 to make the output pins act like an open switch (no connection), set to 1 to make them act like a closed switch.
- .invert-NN (bool, in)
-
Inverts the state of this SSR instance’s NNth output, defaults to 0. When invert-NN is set to 1, SSR output NN is closed when the out-NN pin is 0 and open when the out-NN pin is 1.
OutM Einfaches Ausgangsmodul
OutMs have names like hm2_<BoardType>.<BoardNum>.outm.<Instance>. Instance is a two-digit number that corresponds to the HostMot2 OutM instance number. There are num_outms instances, starting with 00.
Jede Instanz verfügt über 1 bis 32 Ausgangspins.
Pins:
- .out-NN (bool, in)
-
The sets the state of this OutM instance’s NNth output. Normally the output pin follows the state of this pin but may be inverted by the invert-nn HAL pin.
- .invert-NN (bool, in)
-
Inverts the state of the this OutM instance’s NNth output, defaults to 0. When invert-NN is set to 1, OutM output NN is high when the out-NN pin is 0 and low when the out-NN pin is 1.
xy2mod
The xy2mod is a xy2-100 galvanometer interface. It supports 16 and 18 bit data modes and includes parabolic interpolation to provide position updates between servo thread invocations. xy2mod pins use the prefix hm2_<BoardType>.<BoardNum>.xy2mod.<Instance>.
Pins:
- .posx-cmd, .posy-cmd (real, in)
-
X and Y position commands. Full scale is +-posn_scale default full scale (set by posx-scale and posy-scale) is +- 1
- .posx-fb, .posy-fb (real, out)
-
X- und Y-Positionsrückmeldung. Der Skalenendwert ist +-posN_scale, der Standardwert ist +- 1. Dies ist eine Rückmeldung des Interpolators, nicht des Galvanometers.
- .velx-cmd, .vely-cmd (real, in)
-
X- und Y-Geschwindigkeitsbefehle in Einheiten von fullscale_position/sec
- .velx-fb, .vely-fb (real, out)
-
X- und Y-Geschwindigkeitsrückkopplung in Einheiten von fullscale_position/Sekunde
- .accx-cmd, .accy-cmd (real, in)
-
X- und Y-Beschleunigungsbefehle in Einheiten von fullscale_position/second2
- .posx-scale, .posy-scale (real, in)
-
This sets the full scale range of the position command and feedback, default is +- 1.0. .enable (bool, in):: When False, output data is 0, all interpolator values are set to 0 and overflow flags are cleared. Must be True for normal operation.
- .controlx, .controly (uint, in)
-
These set the galvanometer control bits. There 3 bits per channel in 16 bit mode but just 1 control bit in 18 bit mode, so values from 0..7 are valid in 16 bit mode but only 0 and 4 are valid in 18 bit mode. .commandx, .commandy (uint, in):: These set the raw 16 bit data sent to the galvanometer in command mode. .commandmodex, .commandmodey (bool, in):: When set, these enable the command mode where 16 bit command data is sent to the galvanometer. .18bitmodex, .18bitmodey (bool, in):: When True, these enable the 18 bit data mode for the respective channel. .posx-overflow, .posy-overflow (bool, out):: When true, these indicate an attempted position move beyond the full scale value. .velx-overflow, .vely-overflow (bool, out):: When True, these indicate an attempted velocity update move beyond the full scale value.
- .status (uint, out)
-
Roher 16-Bit-Rückgabestatus vom Galvanometer.
- .read-timer-number (sint, in)
-
Selects the DPLL timer number for pre-read sampling of the position and velocity registers. If set to -1, pre-read sampling is disabled. .write-timer-number (sint, in):: Selects the DPLL timer number for post write update of the position and velocity registers. If set to -1, post write update is disabled.
Watchdog
The HostMot2 firmware may include a watchdog Module; if it does, the hostmot2 driver will use it. The HAL representation of the watchdog is named hm2_<BoardType>.<BoardNum>.watchdog.
Der Watchdog ist zunächst schlafend und inaktiv. Sobald Sie das erste Mal auf die Karte zugreifen, indem Sie die HAL-Funktion hm2 write() ausführen (siehe unten), wacht der Watchdog auf. Von da an muss er regelmäßig gestreichelt werden, sonst beißt er. Streicheln Sie den Watchdog, indem Sie die HAL-Funktion hm2 write() ausführen.
Wenn der Watchdog anspricht, werden alle E/A-Pins des Boards von ihren Modulinstanzen getrennt und zu hochohmigen Eingängen (hochgezogen), und die gesamte Kommunikation mit dem Board wird unterbrochen. Der Zustand der HostMot2-Firmwaremodule wird nicht verändert (mit Ausnahme der Konfiguration der I/O-Pins). Die Encoder-Instanzen zählen weiterhin die Quadraturimpulse, und die Pwm- und Step-Generatoren erzeugen weiterhin Signale (die nicht an die Motoren weitergeleitet werden, da die I/O-Pins zu Eingängen geworden sind).
Das Zurücksetzen des Watchdogs (durch Löschen des has_bit-Pins, siehe unten) nimmt die Kommunikation wieder auf und setzt die E/A-Pins auf die zum Zeitpunkt des Ladens gewählte Konfiguration zurück.
Wenn die Firmware einen Watchdog enthält, werden die folgenden HAL-Objekte exportiert:
Pins:
- .has_bit (bool, io)
-
True if the watchdog has bit, False if the watchdog has not bit. If the watchdog has bit and the has_bit bit is True, the user can reset it to False to resume operation.
Parameters:
- .timeout_ns (uint, rw)
-
Watchdog timeout, in nanoseconds. This is initialized to 5,000,000 (5 milliseconds) at module load time. If more than this amount of time passes between calls to the hm2 write() function, the watchdog will bite.
Raw-Modus
If the "enable_raw" config keyword is specified, some extra debugging pins are made available in HAL. The raw mode HAL pin names begin with hm2_<BoardType>.<BoardNum>.raw.
Wenn der Raw-Modus aktiviert ist, kann ein Benutzer die Firmware von der HAL aus beobachten und stöbern und den internen Status des hostmot2-Treibers in das Syslog schreiben.
Pins:
- .read_address (uint, in)
-
The bottom 16 bits of this is used as the address to read from.
- .read_data (uint, out)
-
Each time the hm2_read() function is called, this pin is updated with the value at .read_address.
- .write_address (uint, in)
-
The bottom 16 bits of this is used as the address to write to.
- .write_data (uint, in)
-
This is the value to write to .write_address.
- .write_strobe (bool, in)
-
Each time the hm2_write() function is called, this pin is examined. If it is True, then value in .write_data is written to the address in .write_address, and .write_strobe is set back to False.
- .dump_state (bool, io)
-
Dieser Pin ist normalerweise False. Wenn er auf True gesetzt wird, schreibt der hostmot2-Treiber seine Darstellung des internen Zustands der Karte in das Syslog und setzt den Pin zurück auf False.
Einrichten von Smart Serial-Geräten
Siehe setsserial(9) für die aktuelle Methode zum Setzen von smart-serial eeprom-Parametern.
FUNKTIONEN
- hm2_<BoardType>.<BoardNum>.read-request
-
Bei Karten mit langer Durchlaufzeit für Lesevorgänge (zum Zeitpunkt des Schreibens gilt dies nur für Ethernet-Karten) sendet diese Funktion eine Leseanforderung. Wenn mehrere Karten verwendet werden, kann dies die Ausführungszeit des Servo-Threads verringern. In diesem Fall wäre die geeignete Thread-Reihenfolge
addf hm2_7i80.0.read-request addf hm2_7i80.1.read-request addf hm2_7i80.0.read addf hm2_7i80.1.read
was dazu führt, dass die Leseanforderung an Karte 1 gesendet wird, bevor die Antwort auf die Leseanforderung von Karte 0 eintrifft.
- hm2_<BoardType>.<BoardNum>.read
-
Dies liest die Encoder-Zähler, Stepgen-Rückmeldungen und GPIO-Eingangs-Pins aus dem FPGA.
- hm2_<BoardType>.<BoardNum>.write
-
Dadurch werden die PWM-Tastverhältnisse, Stepgen-Raten und GPIO-Ausgänge auf dem FPGA aktualisiert. Alle Änderungen an den Konfigurationspins, wie z.B. Stepgen-Timing, GPIO-Invertierungen, usw., werden ebenfalls durch diese Funktion bewirkt.
- hm2_<BoardType>.<BoardNum>.read_gpio
-
Lesen der GPIO-Eingangsstifte. Beachten Sie, dass die Wirkung dieser Funktion eine Untermenge der Wirkung der oben beschriebenen Funktion .read() ist. Normalerweise wird nur .read() verwendet. Der einzige Grund, diese Funktion aufzurufen, ist, wenn Sie GPIO-Befehle in einem Thread ausführen wollen, der schneller ist als der Servo-Thread. (Diese Funktion ist auf der 7I43 aufgrund der Beschränkungen des EPP-Busses nicht verfügbar.)
- hm2_<BoardType>.<BoardNum>.write_gpio
-
Schreiben der GPIO-Steuerregister und Ausgangspins. Beachten Sie, dass die Wirkung dieser Funktion eine Untermenge der Wirkung der oben beschriebenen Funktion .write() ist. Normalerweise wird nur .write() verwendet. Der einzige Grund, diese Funktion aufzurufen, ist, wenn Sie GPIO-Befehle in einem Thread ausführen wollen, der schneller als der Servo-Thread ist. (Diese Funktion ist auf der 7I43 aufgrund der Beschränkungen des EPP-Busses nicht verfügbar.)
- hm2_<BoardType>.<BoardNum>.trigger-encoders
-
Diese Funktion erscheint nur, wenn die Firmware ein BiSS-, Fanuc- oder SSI-Drehgebermodul enthält und wenn die Firmware kein hm2dpll-Modul (qv) enthält oder wenn die modparam num_dplls=0 enthält. Diese Funktion sollte zuerst in den Thread eingefügt werden, damit die Drehgeberdaten bereit sind, wenn die Hauptfunktion hm2_XXXX.NN.read läuft. Eine Fehlermeldung wird ausgegeben, wenn das Lesen des Encoders nicht rechtzeitig abgeschlossen ist. Möglicherweise kann dies durch eine Erhöhung der Datenrate vermieden werden. Wenn das Problem weiterhin besteht und "veraltete" Daten akzeptabel sind, kann die Funktion später im Thread platziert werden, so dass ein voller Servozyklus für die Übertragung der Daten von den Geräten zur Verfügung steht. Falls verfügbar, ist es besser, die synchrone hm2dpll-Triggerfunktion zu verwenden.
SIEHE AUCH
Mesas Dokumentation für die Anything I/O-Karten, unter https://www.mesanet.com.
LIZENZ
GPL