⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hostmot2.9

📁 CNC 的开放码,EMC2 V2.2.8版
💻 9
📖 第 1 页 / 共 2 页
字号:
the pwmgen instances running in the PWM modes (modes 1 and 2).  This isthe frequency of the variable-duty-cycle wave.  Its effective range isfrom 1 Hz up to 193 KHz.  Note that the max frequency is determined by theClockHigh frequency of the Anything IO board; the 5i20 and 7i43 both havea 100 MHz clock, resulting in a 193 KHz max PWM frequency.  Other boardsmay have different clocks, resulting in different max PWM frequencies.If the user attempts to set the frequency too high, it will be clippedto the max supported frequency of the board.  Frequencies below about5 Hz are not terribly accurate, but above 5 Hz they're pretty close.(u32 rw) pdm_frequency: This specifies the PDM frequency, in Hz, ofall the pwmgen instances running in PDM mode (mode 3).  This is the"pulse slot frequency"; the frequency at which the pdm generator in theAnyIO board chooses whether to emit a pulse or a space.  Each pulse (andspace) 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 cycleto 50% results in a 1 MHz square wave, identical to a 1 MHz PWM signalwith 50% duty cycle.  The effective range of this parameter is fromabout 1525 Hz up to just under 100 MHz.  Note that the max frequencyis determined by the ClockHigh frequency of the Anything IO board; the5i20 and 7i43 both have a 100 MHz clock, resulting in a 100 Mhz max PDMfrequency.  Other boards may have different clocks, resulting in differentmax PDM frequencies.  If the user attempts to set the frequency too high,it will be clipped to the max supported frequency of the board..SH stepgenstepgens have names like "hm2_<BoardType>.<BoardNum>.stepgen.<Instance>"."Instance" is a two-digit number that corresponds to the HostMot2 stepgeninstance number.  There are 'num_stepgens' instances, starting with 00.Each stepgen allocates 2-6 IO pins (selected at firmware compile time),but currently only uses two: Step and Direction outputs.The stepgen representation is modeled on the stepgen software component.Each stepgen instance has the following pins and parameters:Pins:(float input) position-cmd: Target of stepper motion, in arbitraryposition units.(s32 output) counts: Feedback position in counts (number of steps).(float output) position-fb: Feedback position in arbitrary position units(counts / position_scale).(float output) velocity-fb: Feedback velocity in arbitrary positionunits per second.(bit input) enable: Enables output steps.  When false, no steps aregenerated.Parameters:(float r/w) position-scale: Converts from counts to position units.position = counts / position_scale(float r/w) maxvel: Maximum speed, in position units per second.  If setto 0, the driver will choose the maximum velocity based on the values ofsteplen and stepspace (at the time that maxvel was set to 0).(float r/w) maxaccel: Maximum acceleration, in position units per secondper second.  If set to 0, the driver will not limit its acceleration.(u32 r/w) steplen: Duration of the step signal, in nanoseconds.(u32 r/w) stepspace: Minimum interval between step signals, innanoseconds.(u32 r/w) dirsetup: Minimum duration of stable Direction signal beforea step begins, in nanoseconds.(u32 r/w) dirhold: Minimum duration of stable Direction signal after astep ends, in nanoseconds.(u32 r/w) step_type: Output format, like the step_type modparam to thesoftware stegen(9) component.  0 = Step/Dir, 1 = Up/Down, 2 = Quadrature.In Quadrature mode (step_type=2), the stepgen outputs one complete Graycycle (00 -> 01 -> 11 -> 10 -> 00) for each "step" it takes..SH General Purpose I/OI/O pins on the board which are not used by a module instance are exportedto HAL as full GPIO pins.  Full GPIO pins can be configured at run-timeto be inputs, outputs, or open drains, and have a HAL interface thatexposes this flexibility.  IO pins that are owned by an active moduleinstance are constrained by the requirements of the owning module,and have a restricted HAL interface.GPIOs have names like"hm2_<BoardType>.<BoardNum>.gpio.<PortName>.<PinNum>".  PinNum is athree-digit number.  PortName and PinNum correspond to the I/O Pin infoas given in Mesa Electronics' manual for the board.Each GPIO can have the following HAL Pins:(bit out) in & in_not: State (normal and inverted) of the hardwareinput pin.  This follows the Canonical Device Interface for Digital Input.Only full GPIO pins and IO pins used as inputs by active module instanceshave these pins.(bit in) out: Value to be written (possibly inverted) to the hardwareoutput pin.  This follows the Canonical Device Interface for DigitalOutput.  Only full GPIO pins have this pin.Each GPIO can have the following Parameters:(bit r/w) is_output: If set to 0, the GPIO is an input.  The IO pin isput in a high-impedance state (pulled up to 5V), to be driven by otherdevices.  The logic value on the IO pin is available in the "in" and"in_not" HAL pins.  Writes to the "out" HAL pin have no effect.  If thisparameter is set to 1, the GPIO is an output; its behavior then dependson the "is_opendrain" parameter.  Only full GPIO pins have this parameter.(bit r/w) is_opendrain: This parameter only has an effect if the"is_output" parameter is true.  If this parameter is false, the GPIObehaves as a normal output pin: the IO pin on the connector is drivento the value specified by the "out" HAL pin (possibly inverted), and thevalue of the "in" and "in_not" HAL pins is undefined.  If this parameteris true, the GPIO behaves as an open-drain pin.  Writing 0 to the "out"HAL pin drives the IO pin low, writing 1 to the "out" HAL pin puts theIO pin in a high-impedance state.  In this high-impedance state the IOpin floats (pulled up to 5V), and other devices can drive the value; theresulting value on the IO pin is available on the "in" and "in_not" pins.Only full GPIO pins and IO pins used as outputs by active module instanceshave this parameter.(bit r/w) invert_output: This parameter only has an effect if the"is_output" parameter is true.  If this parameter is true, the outputvalue of the GPIO will be the inverse of the value on the "out" HAL pin.This corresponds to the 'invert' parameter in the Canonical DeviceInterface for Digital Output.  Only full GPIO pins and IO pins used asoutputs by active module instances have this parameter..SH WatchdogThe HostMot2 firmware may include a watchdog Module; if it does, thehostmot2 driver will use it.The watchdog must be petted by EMC2 periodically or it will bite.When the watchdog bites, all the board's I/O pins are disconnected fromtheir Module instances and become high-impedance inputs (pulled high),and all communication with the board stops.  The state of the HostMot2firwmare modules is not disturbed (except for the configuration of theIO Pins).  Encoder instances keep counting quadrature pulses, and pwm-and step-generators keep generating signals (which are *not* relayed tothe motors, because the IO Pins have become inputs).Resetting the watchdog resumes communication and resets the I/O pins tothe configuration chosen at load-time.If the firmware includes a watchdog, the following HAL objects willbe exported:Pins:(bit in/out) has_bit: True if the watchdog has bit, False if the watchdog hasnot bit.  If the watchdog has bit and the has_bit bit is True, the usercan reset it to False to resume operation.Parameters:(u32 read/write) timeout_ns: Watchdog timeout, in nanoseconds.  This is initializedto 1,000,000,000 (1 second) at module load time.  If more than thisamount of time passes between calls to the pet_watchdog() function,the watchdog will bite.Functions:pet_watchdog(): Calling this function resets the watchdog timer andpostpones the watchdog biting until timeout_ns nanoseconds later..SH Raw ModeIf the "enable_raw" config keyword is specified, some extra debuggingoptions are made available to HAL.  With Raw mode enabled, a user maypeek and poke the firmware from HAL, and may dump the internal state ofthe hostmot2 driver to the syslog.Pins:(u32 in) read_address: The bottom 16 bits of this is used as the addressto read from.(u32 out) read_data: Each time the hm2_read() function is called, thispin is updated with the value at .read_address.(u32 in) write_address: The bottom 16 bits of this is used as the addressto write to.(u32 in) write_data: This is the value to write to .write_address.(bit in) write_strobe: Each time the hm2_write() function is called, thispin is examined.  If it is True, then value in .write_data is writtento the address in .write_address, and .write_strobe is set back to False.(bit in/out) dump_state: This pin is normally False.  If it gets set toTrue the hostmot2 driver will write its representation of the board'sinternal state to the syslog, and set the pin back to False..SH FUNCTIONS.TP\fBhm2_<BoardType>.<BoardNum>.read\fRRead all inputs, update input HAL pins..TP\fBhm2_<BoardType>.<BoardNum>.write\fRWrite all outputs..TP\fBhm2_<BoardType>.<BoardNum>.pet-watchdog\fRPet the watchdog to keep it from biting us for a while..TP\fBhm2_<BoardType>.<BoardNum>.read_gpio\fRRead the GPIO input pins. (This function is not available on the 7i43due to limitations of the EPP bus.).TP\fBhm2_<BoardType>.<BoardNum>.write_gpio\fRWrite the GPIO control registers and output pins.  (This function isnot available on the 7i43 due to limitations of the EPP bus.).SH SEE ALSOhm2_7i43(9).brhm2_pci(9).brMesa's documentation for the Anything I/O boards, at <http://www.mesanet.com>.br.SH LICENSEGPL

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -