MFX-PCI Firmware Revision History Copyright 2002-2006 Precision MicroControl Corp. All Rights Reserved CONFIDENTIAL AND PROPRIETARY: This file contains confidential and proprietary information that is the sole property of Precision MicroControl Corp. This confidential information is not to be copied, disclosed or reproduced in whole or in part by any means (including photocopying or storage in an information storage/retrieval system) or transmitted in any form or by any means except as authorized by written contract with Precision MicroControl Corp. Software Notes: 1. Heart beat timer period is set in function Initialize_timer0 macros. These are found in source code file: rtems\rtems-X.X.X\c\src\lib\libbsp\mips\mfxpci1\clock\clockdrv.c. Also set CONFIGURE_MICROSECONDS_PER_TICK definition in SYSTEM.H file. Software "To Do" list: - Modify compare feature so an output can be triggered by multiple axes. - Create pool of memory for RAM based macros that is preserved during reset. Changes for Rev. 0.3a =============================================================================== 10/18/02 Implemented Output Mode command for steppers and servos. 10/21/02 Re-organized status words to accomodate host interrupts. Changes for Rev. 0.4a =============================================================================== 10/22/02 Implemented host communication interrupts. Changes for Rev. 0.5a =============================================================================== 10/22/02 Implemented host motor status interrupts. Changes for Rev. 0.6a =============================================================================== 10/24/02 Implemented closed loop stepper mode. 10/24/02 Connected encoder error inputs to motor status. 10/24/02 Readjusted stepper internal feedback loop gain to 0.0005. This matches FPGA 40 MHz clock rate. 10/25/02 Fixed stepper beakpoint. Previous code was setting breakpoint enable bit in the FPGA mode register instead of the control register. Changes for Rev. 0.7a =============================================================================== 10/28/02 Added code to enable watchdog circuit. Use DW command to disable. Changes for Rev. 0.8a =============================================================================== 10/29/02 Modified code to support 8 axes. 11/1/02 Modified code that updates target position after an axis is commanded to stop. New code updates target position and target count after profiler signals trajectory complete. For stepper motors, the target update occurs after pulses are actually turned off. See code in LINPATH.C and MODECMD.C - pm(). 11/1/02 Added code to RT command to reset DAC's and FPGA. Changes for Rev. 0.9a =============================================================================== 11/15/02 Modified DAC interface circuit in FPGA to generate a DAC clock signal of 10MHz. Running the DAC at 20 MHz resulted in unreliable writes to channel 2. 11/18/02 Fixed define for auxiliary encoder index enable in MOTIFC.H Correct value for AUXIDXENA is 0x1000 11/18/02 Corrected code for Abort (AB) command. 11/18/02 Corrected code for Output mode for Compare (OC) command 11/18/02 Changed stepper pulse generator circuit in FPGA to provide increased resolution. Maximum step rate from FPGA is now 10MHz. The range of the parameter to the Set Torque command for a stepper is 0 to 10. This produces a step frequency of 0 to 10 MHz. To match this, the stepper calibration value in MOTSVC.C is 50000, and the proportional gain setting is 0.001. Changes for Rev. 0.9b =============================================================================== 11/19/02 Implemented RT command to restart software on board. Added support for 3 different parameters. A parameter of 0 with the RT command will result in the kernel and motion control software being restarted. A parameter of -1 will restart the boot loader firmware. A parameter of -2 will generate a memory exception which will pass control to the debug monitor. 11/19/02 Added code to release I/O reset signal after initializing FPGA. This is required for DAC's to operate. Changes for Rev. 0.9c =============================================================================== 11/19/02 Modified code for Position Record command in tellcmd.c so that interrupts are disabled while recording is initiated on all selected axes. This insures recorded data is synchronized for all axes. 11/19/02 Implemented Display recorded motor status command (DD, code=256). 11/19/02 Implemented digital I/O channel commands. Changes for Rev. 0.9d =============================================================================== 11/20/02 Fixed Wait for Position commands. Macro load_primary_compare_register() in motifc.h was not defined. Cleaned up code in ccbcmd.c. Changes for Rev. 0.9e =============================================================================== 11/25/02 Implemented analog input commands. Changes for Rev. 0.9f =============================================================================== 11/25/02 Enabled synchronized reading of encoders in FPGA. Encoder and stepper counters latch position on rising edge of timer interrupt signal. Timer0 uses Pulse Generator mode as setup in CPU_ASM.S. 11/25/02 Corrected addresses of beginning and end of firmware in START.S. 12/3/02 Cleaned up initialization of stepper motor parameters. Set gain of pulse generator for stepper in open loop mode to 0.0001. Changes for Rev. 0.9g =============================================================================== 12/6/02 Optimized position counters in FPGA to allow for capture and compare feature on all servo and stepper axes. Capture function now uses index registers, so capture can't be performed while indexing a motor. 12/6/02 Modified pulse generator in FPGA to allow full 0 to 65535 input value. Changed value of STEPPER_MAX_OUTPUT_UNITS constant to 65535. Changes for Rev. 0.9h =============================================================================== 12/9/02 Enabled processing of Contour Path commands. Previous code had CP commands disabled in CMDEXE.C. 12/9/02 Modified contouring code so that motion table is the same size for all axes. In other PMC products, motion table has 256 blocks for axis 1, but only 16 blocks for all other axes. In order to simplify and enhance contouring mode, all axes now have 256 blocks in the motion table. 12/9/02 Increase number of supported RAM macros to 1000. Previous code only allowed macros 10 through 255 to be defined. New code allows macros 0 through 999 to be defined. These macros are placed in RAM and will be lost when the motion controller is reset. 12/10/02 Fixed Wait for Index command for open loop steppers. Previous code was incorrectly monitoring MTRAEI flag. When closed loop stepper mode is selected, encoder input is fed to primary counter in FPGA and MTRIDX flag indicates when index has occured. Also fixed setting of MTRAXF flag in MOTUPD.C. Previous code set flag in motor table status instead of local status variable that is written over motor table variable. 12/11/02 Modified code to clear Encoder Fault flags in status when motor on command is issued. 12/11/02 Modified axis I/O code so that outputs are numbered 33 through 64. This matches channel numbers used in digital I/O commands. 12/12/02 Added Model Number to board configuration data structure. Changed VE command code to include model number in dispaly. Changed product name to DC44-PCIXXXX-O where XXXX is model number, O is option designator. Changes for Rev. 1.0a =============================================================================== 12/13/02 Changed product name to MFX-PCI. Version command now displays name MFX-PCIXXXX-O where XXXX is model number, O is hardware option designator. 12/26/02 Included 2 different FPGA configuration data sets. The model number that is stored in the Firmware configuration data in the Flash memory determines which FPGA data is loaded. See init_registers() in INIT.C. 12/26/02 Increased value of constant that specifies the amount of memory available on the board. This value is used to locate the initial processor stack. In previous code HARD_CODED_MEM_SIZE was set to 0x100000 in START.S. New code has it set to 0x400000 which is safe for both MFX-PCI and DCX-PCI boards. Changes for Rev. 1.0b =============================================================================== 1/13/03 Inverted optically isolated inputs in FPGA circuits. Channel commands will report state of these inputs as 0 when configured as default active high and have no input current. 1/13/03 Corrected command table so Velocity Override command can accept real parameters. 1/13/03 Corrected code for Delay at Target command. Previous code multiplied command parameter by MOTOR_UPDATES_PER_SEC which is 4 times greater than delay timer is actually updated. 1/14/03 Added ability to read encoder fault word to Tell Status command. TS with a parameter value of 160 will display the encoder fault word as a 32 bit unsigned integer. Parameter values 161 to 191 will display the state of encoder fault bits 1 to 31 respectively. 1/14/03 Added code to record auxiliary encoder position for stepper axes. Implemented Display recorded Auxiliary position command (DA, code=219). 1/14/03 Implemented Reset of a specific axis with the RT command. If an axis is specified when the RT command is issued, only that axis will be reset. 1/15/03 Added Memory Allocate (ME), Free Memory (FM), and Memory Display (DE) commands. The ME command allocates the amount memory specified by the command parameter and places the address of the memory in user register 0. If the specified amount of memory can't be allocated, a value of 0 is placed in user register 0. The parameter to the FM command should be the address of the memory to be freed. This must be the address of memory that was allocated with the ME command. The parameter to the DE command is any valid physical address. If an axis is specified with the DE command, the entire motor table for that axis will be displayed. The DE command can only be issued to an ASCII interface. 1/15/03 Made Help command display consistent with MCCL reference manual list of commands. 1/15/03 Implemented command help. Typing HE"mm" where mm is a valid command mnemonic will display addition help information for that command. 1/15/03 Modified Set Velocity command code so that the minimum velocity for a stepper axis will always be equal to or less than the maximum velocity. 1/16/03 Implemented Information Display command (ID, code = 218). This command is only valid for the ASCII interface and generates formatted displays. The ID command must be issued to a specific axis and takes the following parameters: Parameter Return Value =========================================== 0 show status information 1 show auxiliary status information 2 show motor table information 3 show internal motor table information 4 show filter gains, command output 5 show encoder fault inputs and enable bits 6 show axis I/O assignments 1/16/03 Removed formatted displays form the Tell Status command. Changes for Rev. 1.0c =============================================================================== 1/17/03 Corrected which status bit is used to indicated when an open loop stepper axis is looking for edge (home). Previous code used bit 23 to indicated Looking for Edge. New code uses bit 17. 1/17/03 Modified operation of status bits related to indexing or homing a servo or stepper axis. For a servo axis (or stepper in closed loop mode), the following table shows the state of the motor status bits after each of the commands in an indexing operation: Index Arm (index occurs) Wait for Index Motor On ============================================================================= Encoder Index 0 1 1 ? Looking for Index 1 1 0 0 Index Found 0 1 1 0 Homed 0 0 0 1 Note that a homing sequence should test for the Index Found status bit to be set before issuing the Wait for Index command. For a stepper axis in open loop mode, the following table shows the state of the motor status bits after each of the commands in a homing operation: Edge Latch (home occurs) Wait for Edge Motor On ============================================================================= Stepper Home 0 1 1 ? Looking for Edge 1 1 0 0 Edge Found 0 1 1 0 Homed 0 0 0 1 1/17/03 Added code to Input Mode command to clear homing and indexing status bits when switching a stepper between open and closed loop modes. 1/20/03 Added inverter to CLR input of JK flip-flop in FPGA encoder capture circuits. In previous code, FPGA encoder capture circuits were permanently disabled. 1/20/03 Fixed capture and compare commands so they can be used for both open and closed loop steppers. In previous code they were disabled for closed loop steppers. 1/20/03 Modified code so that value returned by Auxiliary Tell and Display recorded Auxiliary commands takes into account current Auxiliary Index and Auxiliary Offset values. 1/20/03 Cleaned up operation of status bits for auxiliary encoder indexing. Corrected code so that Auxiliary Home and Auxiliary Find index commands can be issued without specifying an axis. Changes for Rev. 1.0d =============================================================================== 1/23/03 Moved Motor table and Point data to cached memory for faster motor update processing. 1/23/03 Modified hostint() function so that processor interrupts are only disabled if host interrupt needs to be generated. This will reduce the amount of time that interrupts are disabled. Changes for Rev. 1.0e =============================================================================== 1/29/03 Modified code for Tell Analog and Get Analog commands so that analog reading is correct. In previous code, command had to be issued 3 times to the same channel to get the current analog reading. Also changed "value" variable from short to integer so that replies over the binary interface are correct. Changes for Rev. 1.0f =============================================================================== 2/12/03 Changed Timer 0 output high duration to 50 microseconds. This makes the interrupt service time easier to measure with an oscilloscope. See init_timer0() in cpu_asm.S. 2/12/03 Added code to set initial floating point context for new tasks under RTEMS. New code sets FS bit in coprocessor control and status register. This prevents unwanted exceptions on underflow and inexact results. See _CPU_Initialize() in cpu.c. 2/12/03 Added code to lock first 4 kilobytes of PMON code into processor instruction cache. This includes interrupt service code that is running out of FLASH memory. In previous code, when a background task forced the interrupt service code out of cache, the interrupt service would execute out of slow flash memory and add an extra 60 microseconds to the interrupt service time. See start.S. Changes for Rev. 1.1a =============================================================================== 2/20/03 Implemented Position Compare feature in firmware. This feature provides the same funtionality as the implemention on the DCX-PCI300 product except that all axis compare outputs are or'd together and are connected to output channel 33. Also the Oneshot period accuracy is limited to +/-1 millisecond. 2/24/03 Fixed miss spelling of "variable" in Help command display. Added "ID" mnemonic to Help command display under reporting commands. 2/25/03 Increased maximum number of tasks in SYSTEM.H file to 13. This allows up to 10 background tasks to be created with the Generate Task command. 4/1/03 Modified code for point to point moves in trapezoidal mode. New code holds speed of stepper axis at minimum velocity until motor reaches target. In previous code, trajectory generator was disabled and velocity set to zero when optimal position was within one update of reaching target. This criteria for stopping should only be applied to servo axes. 4/2/03 Modifed stepper pulse generator circuit in FPGA. In new design, internal registers are cleared when pulses are first enabled. This results in immediate output of pulses. Also modified circuit to invert output of pulse divider so that output pulse is immediate. In previous design, pulse output could be delayed for up to one pulse period after they were enabled. 4/3/03 Modified code for Set Velocity and Minimum Velocity commands so that profile generator minveloc variable is set to the minimum of the max and min programmed velocities. This only applies to stepper axes and insures that the minimum velocity is a acceptable value (ie. less than maximum). Changes for Rev. 1.2a =============================================================================== 5/2/03 Set hard coded memory size to 16 megabytes. This is the available RAM on the MFX-PCI. See HARD_CODED_MEM_SIZE constant in START.S. 5/2/03 Increased heap size to 8 megabytes (see LIBC_HEAP_SIZE in BSPSTART.C). The code in bsp_start() sets the RTEMS Workspace memory to follow the heap. Enabled memory allocation statistics in MALLOC.C. The available heap memory will be displayed after the macros when the Tell Macro command is issued. 5/2/03 Switch on-board file system from MINI IMFS to IMFS to support network interface. See CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM in SYSTEM.H file. 5/2/03 Built in network interface support: TCP/IP through ethernet LAN. BSD network task priority is set to 50. This is only used when the MFX board is run standalone. 5/14/03 Created version of CONSOLE.C that perform serial I/O via direct access to TX49 serial port registers. This is only used when the MFX board is run standalone. 5/14/03 Built in RTEMS monitor. Initiated by issuing "RT-3" MCCL command. At "RTEMS>" prompt, type help for further instructions. Added stack address, stack size and register storage address to "TASK" command dump. 5/16/03 Cleaned up CPU_ASM.S. Added ".set noreorder/reorder" directives around all critical code in this module. Removed jump to _ISR_Handler_prom_exit when interrupt source can't be determined (this was incorrect code). 5/19/03 Added extra input buffering to telnet ASCII interface server. This allows telnet clients that send one character at a time to work correctly. 5/21/03 Changed MFXPCI application source code files from Windows style CR-LF termination to Unix style LF termination. Also did the same for compiler "specs" file (/usr/local/lib/mips-ecoff/2.95.2/specs). This was required to get RTEMS to build under CYGWIN on Windows XP. 5/21/03 Modified PATH statement in Build script to: PATH=/usr/local/bin/mips-ecoff:/usr/local/bin:/usr/bin:/bin This insures cross-development tools are used before native tools. 5/22/03 Added call to Untar_FromMemory() in init.c to create root filesystem. 5/22/03 Built in Web server. Modified distibution code to use RTEMS timer routines instead of POSIX. Declared "tp" variable in webmain.c to be "static" to prevent conflict with tp() function. 5/27/03 Copied newer Web server code from RTEMS 4.6.0. Note that new *.h files are copied into build directory. The makefiles in the build directory are modified to build the new modules. 5/28/03 Copied newer FTP server code from RTEMS 4.6.0. Note that new *.h files are copied into build directory. Defeated code that maintains a separate environment for each FTP login. This feature isn't supported by current libc code. Changed snprintf() calls in webmain.c to sprintf(). The safer snprintf() function isn't implemented in the newlib that is currently being used. 5/29/03 Added code to calculate the size of root file system image in call to Untar_FromMemory() in init.c. 5/30/03 Implemented Network Binary Command Interface Server. This server waits on port 9100 of the TCP/IP stack and processes packets containing binary formated MCCL commands. 6/3/03 Corrected code in start.S that flushes data and code caches after moving firmware from extra flash device (U38) into RAM. This is only used for stanalone operation. Changes for Rev. 2.0a =============================================================================== 6/5/03 Added use_PCI_interface, use_serial_interface and use_network_interface constants to board.h to allow selecting which interfaces are built into code. 6/5/03 Moved Interrupt_7_isr() function into init.c to prevent NE2000 driver code (and thus networking code) from being included in build if use_network_interface is undefined. 6/11/03 Added support for 1040 version of MFX-PCI product. This version has only stepper axes numbered 1 through 4. Changed motor update code to properly service stepper modules regardless of whether they are numbered 5 through 8, or 1 through 4. Added code to set num_of_motors variable from Flash configuration data. 6/12/03 Added code to determine "option" value for product number displayed by Version command. The option value is based on hardware present on the board and features supported in firmware. 6/16/03 Changed firmware link commands in LINKCMDS file to cause a copy of initialized data sections to be placed after text sections. Added code to initialize data sections from this copy in the startup code. 6/16/03 Corrected encoder error input masks for new MFX-PCI connector scheme. Odd numbered axes have encoder error detection on A, B and Z inputs individually, plus global detection for any of the inputs. Even numbered axes have only have global detection. 6/16/03 Corrected code in motor update that called set_cmd_out() instead of set_cmd_output() to set command output to 0 if maximum following error exceeded. The macro set_cmd_out() is only used for servos. The function set_cmd_output() determines which macro to call based on axis type (servo or stepper). Changes for Rev. 2.0b =============================================================================== 9/26/03 Corrected Wait command time period when executed in a background task. In previous code Wait command completed in one forth the specified period. New code defines CLOCK_UPDATES_PER_SEC as 4000 and MOTOR_UPDATES_PER_SEC as 1000. The latter being how often each motor is serviced (ie. checked for errors). Changes for Rev. 2.0c =============================================================================== 10/1/03 Changed FPGA configurations so that Capture Inputs and Compare Outputs of DCX-PCI1440 and DCX-PCI1040 match the connector pin assignments given in the User's Manual. Changes for Rev. 2.0d =============================================================================== 10/4/03 Changed profile generator code so that stepper motors in contour mode have their trajectory complete bit set when move is completed. 10/6/03 Added code to clear motor At Target bit for servos in contour mode moving with trapezoidal velocity profile. Removed code that caused steppers in contour mode to have their Motor At Target bit to be set during motor update. 10/7/03 Added code to disable following error 1 count deadband for stepper motors if motor is not moving. This deadband reduces frequency gitter of stepper motors, but caused motor to stall short of target in previous code. 10/8/03 Added code to linear path generator to zero feed-forward variable when a stepper motor completes a move. This corrects a problem with stepper motors when they are switched to contour mode. In previous code, residual feed-forward value would cause a stepper motor to move slightly when it was placed in contour mode. Changes for Rev. 2.1a =============================================================================== 1/20/04 Replaced FPGA configuration files for MFX-PCI1440 and MFX-PCI1040 products. New versions are implemented in Verilog hardware definition language (HDL). Previous FPGA designs were schematic based. The FPGA design in MFX-PCI1441 is still schematic based. Changes for Rev. 2.1b =============================================================================== 2/6/04 Modified the way profile 'stop' flag functions. In new code, if an axis is commanded to stop, the flag will be set and remain set until the start of the next motion. This was done to allow all contouring axes to recognize when they were commanded to stop (requiring them to update their target positions). In order to implement this, stop flag is cleared before starting motion in position, velocity and contouring modes. This fixes a problem in previous code where contouring axes could not be moved after being commanded to stop. Also removed code that cleared stop flag at the end of position mode moves. As a backup, added code to clear the stop flag when motor off command is executed. Added code to update the target position of motors in contour mode that are commanded to stop. Also changed motor on command so that it does not disable pulses for stepper axes that are in contouring mode (these axes need pulses enabled). Changes for Rev. 2.1c =============================================================================== 2/24/04 Added error checking in get_task_data() function to check for valid task data. Function will return 0 if task or dats is invalid. This will cause the Escape Task command to return and error code of -20 if task doesn't exist. 2/24/04 Added code to clear index and auxiliary index status flags in Index Arm (IA) and Auxiliary Find index (AF) commands. This enables status change detection in motor update service. In previous code, index found status would not be set if Index Arm command was issued and index input was already active. Similarly, for Auxiliary encoder index found status and Auxiliary Find index command. Code was correct for Find Index, Find Edge and Edge Latch commands. Changes for Rev. 2.2a =============================================================================== 4/14/04 Modified code so that the active level of amplifier enable outputs can be inverted with the Channel High and Channel Low commands. The Reset command for an axis will set the amplifier enable output to its' default inactive level and reset the digital output invert flag. Changes for Rev. 2.3a =============================================================================== 5/19/04 Increased the number of Global User Registers by 744. In the new firmware there are 990 global registers, numbered 10 - 999. There are still 10 Local User Registers, numbered 0 - 9, available for each foreground and background task. 5/19/04 Increased the number of macros that can be created by 976. In the new firmware 2000 macros numbered 0 to 1999 can be created. 5/19/04 Added a new option to the Information Display (ID) command to show the active background tasks. With a parameter of 7, the ID command will show a list of ID's for the currently running background tasks. The ID's will be in decimal or hexidecimal format based on the current mode. Changes for Rev. 2.3b =============================================================================== 8/13/04 Added code to disable breakpoint latch when stepper axes are placed in slave mode. Also added code in motor_update_service function to enable and disable pulses for steppers in slave mode. Added code in set_cmd_output function to set direction output for steppers in slave mode. In previous code, stepper motors had to be in contour mode prior to being placed in slave mode to work correctly. Changes for Rev. 2.4a =============================================================================== 8/17/04 Implemented crossover of position error and feed-forward terms between 2 axes. When the position error crossover is enabled for an axis, the position error of another axis will be subtracted or added from the axes' position error. The modified position error is then used as the input to the PID calculations. When the feed- forward crossover is enabled for an axis, the feed-forward terms of another axis will be added or subtracted from the axes' output command. This feature is only available for servo axes. For optimal operation, the axis for which crossovers are enabled should be the higher numbered axis. To enable position error crossover, use the Look Up (LU) command to determine the offset of the "crosserraxis" variable. Use the Write Word (WW) command to set this word variable (16 bit) for the target axis to the axis number of the crossover axis. To invert the sign of the crossover position error, set the variable to the negative axis number. To enable feed-forward crossover, use the Look Up (LU) command to determine the offset of the "crossffaxis" variable. Use the Write Word (WW) command to set this word variable (16 bit) for the target axis to the axis number of the crossover axis. To invert the sign of the crossover feed-forward terms, set the variable to the negative axis number. Example MCCL commands: Assume Y is axis 1, X is axis 2, X is mechanically linked so it moves when Y moves LU"crosserraxis",AR5 ; Lookup "crosserraxis" variable offset, move to user register 5 AL1,2WW@5 ; Write axis 1 specifier to axis 2 variable (variable offset in register 5) ; X axis error = X axis error - Y axis error or AL-1,2WW@5 ; Write negative axis 1 specifier to axis 2 variable (position error will be added) ; X axis error = X axis error + Y axis error LU"crossffaxis",AR5 ; Lookup "crossffaxis" variable offset, move to user register 5 AL1,2WW@5 ; Write axis 1 specifier to axis 2 variable (variable offset in register 5) ; X command output = X feed-forward terms + Y feed-forward terms or AL-1,2WW@5 ; Write negative axis 1 specifier to axis 2 variable (feed-forward will be subtracted) ; X command output = X feed-forward terms - Y feed-forward terms Note that if the axis for which crossovers are enable has the lower axis number, the position error and the feed-forward terms that is taken from the other axis will be from the previous motor update period. In this case, the position error readings and the feed-forward terms of the 2 axes will not be synchronized. This will result in less than optimal operation of the axis on which crossovers are enabled. Changes for Rev. 2.5a =============================================================================== 8/24/04 Removed implementation of feed-forward crossover feature and replaced it with command signal crossover feature. When the command signal crossover is enabled for an axis, the command signal (which incluides the PID and feed-forward terms) of another axis will be added or subtracted from the axes' output command. This feature is only available for servo axes. For optimal operation, the axis for which crossovers are enabled should be the higher numbered axis. To enable command signal crossover, use the Look Up (LU) command to determine the offset of the "crosscmdaxis" variable. Use the Write Word (WW) command to set this word variable (16 bit) for the target axis to the axis number of the crossover axis. To invert the sign of the crossover command signal, set the variable to the negative axis number. Example MCCL commands: Assume Y is axis 1, X is axis 2, X is mechanically linked so it moves when Y moves LU"crosscmdaxis",AR5 ; Lookup "crosscmdaxis" variable offset, move to user register 5 AL1,2WW@5 ; Write axis 1 specifier to axis 2 variable (variable offset in register 5) ; X command output = X PID terms + X feed-forward terms + Y command output or AL-1,2WW@5 ; Write negative axis 1 specifier to axis 2 variable (command signal will be subtracted) ; X command output = X PID terms + X feed-forward terms - Y command output Changes for Rev. 2.6a =============================================================================== 9/7/04 Added PWM output capability for servo axes. This feature is enabled by issuing the Output Mode (OM, code=216) command with a parameter of 2 or 3 to a servo axis. This switches the Unipolar Direction output signal for that axis to a PWM output. These outputs have open collector drivers and may require pull-up resistors to be compatible with external circuitry. The frequency of the PWM outputs can be changed with the Set PWM Time Konstant command (PK, code=204). This command sets the PWM frequency for all 4 axes, so no axis number is specified with the command. The integer command parameter should be calculated as the desired frequency divided by 610 Hz. The default PWM frequency is 19.53 KHz. Issuing the Output Mode command with a parameter of 2 places a servo axis in bipolar PWM output mode. When the motor is at its' target position, the PWM output will have a 50% duty cycle. The duty cycle will increase or decrease in order to drive the motor in either direction. The limits of the duty cycly can be set with the Set torQue (SQ) command. This command has a parameter range of 0 to 10, which translates to a 0 to 100% duty cycle. Issuing the Output Mode command with a parameter of 3 places a servo axis in unipolar PWM output mode. When the motor is at its' target position, the PWM output will be off. The duty cycle will increase from 0 to 100% to drive the motor. The direction of the motor is controlled by a separate signal which is configurable. When a servo axis is configured to have PWM outputs, the axis may be placed in Torque Mode with the QM command. The output duty cycle can then be set with the Set torQue command. This mode of operation can be used to facillitate testing of the output driver circuits. Changes for Rev. 2.7a =============================================================================== 9/9/04 Added New Priority (NP, code=252) command to allow the priority of foreground and packground tasks to be adjusted. The parameter to this command can be an integer from 11 to 255. Setting a tasks prioroity to 11 will give it the highest priority; setting it to 255 will give it the lowest priority. This command will only change the priority of the task that executes the command. The 2 foreground tasks that process commands from the ASCII and Binary interfaces have a default priority of 100. All new background tasks created with the Generate Task command also have a default priority of 100. With the current firmware, setting a tasks priority below either of the foreground tasks priorities, will prevent it from getting any run time. 9/23/04 Reduced timeout period for ADC reading in TA and GA commands. New counter constant results in a timeout period of approximately 100 microseconds. Previous code timed out in 1 millisecond. If ADC does fail to complete conversion, motor update will still have sufficient time to run. Also changed code so that if ADC times out, a value of -1 will be placed in the user register instead of the bad ADC reading. 10/4/04 Modified FPGA stepper circuit so that the position counter increments at the midpoint of each step cycle. This is where the stepper output goes inactive (high). This change insures that the stepper output goes to the inactive level after the last step of a move. In the previous stepper circuit implementation, the pulse counter would increment at the start of the step cycle. If the pulse period was sufficiently long, the code would set the At Target flag when the motor finished a move, and then stop the stepper pulse timer. This would cause the stepper output to remain active (low). 10/4/04 Added code to enable the breakpoint circuit when a move is initiated on a stepper axis. This insures that the breakpoint circuit disables pulses when the target is reached. In previous code, the breakpoint circuit was enabled in the motor update code after pulses were first enabled. If the move was very short, and the pulse rate very high, the target could be passed before the breakpoint was enable. See the code in stepper_pos_move_start() function. 10/6/04 Corrected tst_output macro in motifc.h file. This macro is not currently used, but it incorrectly read the output register of the FPGA that is write only. New version of macro reads the RAM based variable that shadows the output register contents. Changes for Rev. 2.7b =============================================================================== 10/22/04 Fixed code in timer0_isr routine which test for timer interrupt status bits being cleared. The way it works, after writing a 0 to the timer interrupt status register, the processor waits for the interrupt status bits to be cleared. This is done to prevent the timer from generating another interrupt immediately. In the previous code, all 3 interrupt status bits were being tested, not just the one for the timer mode being used. If one of the unused status bits became set after the write, the processor became stuck in the loop. In the new code, only the interrupt status bit for the timer mode being used is tested. There is also a new loop counter that will cause the processor to write the register again, if the status bits have not cleared after 10 reads. Changes for Rev. 2.8a =============================================================================== 11/1/04 Changed code for RT-3 command (Reset) so that motor update task is left running while RTEMS monitor is started. This will freeze the command interpreters and background tasks but allow motors to hold their current position or complete any current motion. The RTEMS monitor can be used to determine the current state of all tasks. Issuing the GO command to the RTEMS monitor will allow the command interpreters and background tasks to resume operation. Changed RTEMS monitor task priority to 11 so that motor update task will run properly when the RT-3 command is executed. 11/1/04 Fixed variable name for posdband. Prior code used "dband" as name. New code uses "posdband" as described in Help listing. 11/1/04 Added utgtdelay to list of motor table variables that can be accessed with the Look Up (LU) command. This is the variable that is set with the Delay at Target (DT) command. This variable is named "TGTDELAY" and is a double value in units of seconds. 11/1/04 Created uoutoffset variable in motor table to store output offset value in user units. Internally the controller uses outoffset variable that holds the value in controller units. Added uoutoffset to list of motor table variables that can be accessed with the Look Up (LU) command. This is the variable that is set with the Output Offset (OO) command. This variable is named "OUTOFFSET" and is a float value in user units (volts). 11/1/04 Added uoutdband to list of motor table variables that can be accessed with the Look Up (LU) command. This is the variable that is set with the Output Deadband (OB) command. This variable is named "OUTDBAND" and is a float value in user units (volts). 11/1/04 Added "PK" to the list of parameter commands displayed with the Help command. This refers to the new PWM time constant command. 11/1/04 Changed User Scale, User Zero, User Offset, and User Rate commands so that new value will be written to working variables in motor table if motor is off when command is issued. If the motor is on, the new value will only be written to a temporary variable and won't be used until after the motor on command is issued. Changed motor update code so that command count variables are not calculated when axis is off. This caused a problem when user scaling is changed and optimal position in old units is multiplied by new scaling factor. In worst case, calculated command count is larger that 2 billion and floating point exception (watchdog trip) occurs. This may have also been a problem in previous code after changing the user scaling, and issuing the motor on command. In new code, the code for the motor on command now calculates the initial command count values using the new scaling factor. These values are then used in succeeding motor updates. 11/1/04 Changed User Scale command so that a parameter of 0 will generate an error message and the scaling factor won't be changed. Did the same for User Rate command. Changes for Rev. 3.0a =============================================================================== 11/1/04 Upgraded to RTEMS release 4.6.2, GCC 3.4.1, Binutils 2.14, and Newlib 1.12.0. Code is now maintained as 2 patches to the generic RTEMS code. The first is a patch containing a Board Support Package (BSP) for the Toshiba RBTX4925 evaluation board and the TX4925 CPU. The second patch contains a BSP for the MFX-PCI1000. This BSP uses the TX4925 CPU components from the first patch. It is expected that this upgrade will not change the operation of the MFX board. 11/1/04 Set CPU_ALL_TASKS_ARE_FP true in mips cpu.h file. This causes all RTEMS tasks (except the idle task) to be created with the floating point attibute set. This was done to prevent FPU exceptions from occurring whenever the printf() function is called in a RTEMS task. Doing this was safer than trying to ensure that every task using printf was created with floating point enabled. Set CPU_INLINE_ENABLE_DISPATCH true in mips cpu.h file. This was done in the previous RTEMS 4.5.0 release to improve task switching times; and duplicated in RTEMS 4.6.2 in order to maintain performance level. Changed CONFIGURE_TEST_NEEDS_CLOCK_DRIVER definition in system.h to CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER. This was done to match its use as an application build switch. The same was done for CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER, it was changed to CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER. 11/1/04 Removed code from start.S that placed the processor in uncached instruction space before invalidating the instruction cache. This appears to be unnecessary, and left the processor running out of slow uncached memory for the kernel initialization. 11/1/04 Moved ASCII Mailbox Character I/O routines from init.c to console-io.c. This allows RTEMS to be built for the mfxpci1 BSP and not have link errors in the "sample" programs. Added code to bsp.h for the mfxpci1 BSP that provides a stub set_ascii_ci_busy() function for use with the sample programs. For this to work, also had to move the "#define CONFIGURE_INIT" statement in the init.c files of the Minimum and Loopback samples. 11/1/04 Move "packed" compiler attribute in data structure declarations so that they are compatible with latest GCC compiler. In previous code, attribute was placed after the "struct" keyword. In new code, attribute is placed after the structure member declarations. 11/1/04 Changed macros in motifc.h that read and write I/O registers in FPGA. Code generated by latest GCC compiler assumes data in "packed" structures is unaligned. This would result in code that incorrectly accessed the FPGA 16 bit registers one byte at a time. New macros cast the address of the FPGA registers as pointers to 16 bit words, and uses the pointers to directly access the registers as 16 bit targets. Also created macros in motifc.h for accessing the on-board Analog to Digital Converter (ADC) through the FPGA registers. Changed the code in anacmd.c to use the new macros. This code should operate identically to the previous implementation, it's just easier to read and maintain. 11/1/04 Changed get_task_ids() function to be compatible with RTEMS 4.6.2 code. This function is used by the Information Display command to fill an array with background task ID's. In the new version of RTEMS, the structure of the _Objects_Information_table has changed. The function code was changed accordingly. Also had to change the code in the function which compares object names. 11/1/04 Changed code for Reset command in misccmd.c. New code calls clock driver Clock_exit() function to disable clock interrupts. Previous code used disable_hbi() function which has been replaced by clock driver function. 11/1/04 Changed RTEMS make configuration file to build code with -O GCC optimization. This results in code that provides the highest speed performance and closely matches the performance of previous RTEMS code. Added "--srec-len=80" option to objcopy command line to force firmware S-record file to have a maximum string length of 80 characters. 11/1/04 Changed code for Shift Left and Shift Right commands in regcmd.c. Previous code will not work with new GCC compiler because "cast statements are no longer supported in lvalues". Same for code in rwcmd.c that implements Read Byte, Read Word, and Read Long commands. 11/1/04 Modified round() function so that it uses the Round instruction in the FPU if available. Otherwise, the rint() function in the math library is used. The rint() function rounds a double to the nearest integer value, and returns it in a double format. The double is then cast to an integer. The new code should run a bit faster. Moved round() function from tellcmd.c file to motupd.c file. Added call to round() function in motor update code when converting servo output command to integer DAC value. This should produce a more precise analog command output. The round() function is already used for the stepper output command. Replaced calls to rint() and rintf() in command executor with calls to round() function. Replaced calls to rint() in tell_prec_double() function with calls to round() function. This function is used by many of the reporting commands. Changes for Rev. 3.0a =============================================================================== 5/5/05 Implemented MCCL file commands: FO, LO, DL, TY, and RF . 5/5/05 Implemented G-code interpreter and supporting commands. Changes for Rev. 3.1a =============================================================================== 6/20/05 Added GRINDER machine type in G-code interpreter. This machine has tool compensation in the YZ plane. 6/24/05 Added support for A, B and C rotary axes. 6/24/05 Eliminated use of B word to cause Auxiliary function macro to be called. B word is now used for axis B dimension. Removed configuration variable AUXILIARYFUNCMACRO. Changes for Rev. 3.2a =============================================================================== 7/1/05 Corrected backlash compensation code so that target count is now correctly calculated when move commands are executed. Previous code used direction of previous move and incorrectly calculated the target count. 7/1/05 Enabled Backlash Compensation commands (BD, BN, BF) for stepper axes. 7/6/05 Modified motor update code for open loop stepper motors. In new code, the contribution from the PID to the output command is limited to the current set torque value. The feed-forward component of the output command is not limited to the set torque value. This allows the Set Torque command to limit how fast the stepper motor changes position when compensating for backlash. When used for an open loop stepper axis, the units of the Set Torque command parameter are as follows: Speed Range SQ units ========================================= High 1000000 Steps/Sec/Unit Medium 125000 Steps/Sec/Unit Low 15625 Steps/Sec/Unit Note: The Set Torque command will only work for an open loop stepper axis if the PID parameters have been unlocked. This is done by issueing the Input Mode (IM) command to the axis with a parameter of 128. Changes for Rev. 3.3a =============================================================================== 7/11/05 Added code to cause a wait for motors to stop when a Dwell (G04) preparatory code appears in a part program. 7/11/05 Added code to motor update function to calculate current velocity in user units and store it in ucurvel variable. Changed code for Tell Velocity and Information Display commands so that they use ucurvel variable instead of calculating current velocity from curvel variable on the fly. Note that Look Up command for "CURVEL" variable returns offset of ucurvel variable which is now updated properly. 7/19/05 Implemented the following CNC variables: Variable read/write Description ==================================================== 1 - 33 r/w Local variables 100 - 999 r/w Common variables 1000 r All 32 digital input channels (bit 0 = channel 1, bit 1 = channel 2, ...) 1001 - 1032 r Individual digital input channels (1001 = channel 1, 1002 = channel 2, ...) 1100 r All 32 digital output channels (bit 0 = channel 33, bit 1 = channel 34, ...) 1101 - 1132 r/w Individual digital output channels (1101 = channel 33, 1102 = channel 34, ...) 2000 - 2999 r D & H Tool compensation values (2001 = H geom. 1, 2201 = H wear 1, 2401 = G geom. 1, 2601 = G wear 1, 2002 = H geom. 2, ...) 5001 - 5015 r Block end position (X=5001, Y=5002, Z=5003, A=5004, B=5005, C=5006, U=5007, V=5008, W=5009) 5021 - 5035 r Machine coordinates (X=5021, Y=5022, Z=5023, A=5024, B=5025, C=5026, U=5027, V=5028, W=5029) 5041 - 5055 r Work coordinates (X=5041, Y=5042, Z=5043, A=5044, B=5045, C=5046, U=5047, V=5048, W=5049) 5081 - 5095 r Tool length compensation value (X=5081, Y=5082, Z=5083, A=5084, B=5085, C=5086, U=5087, V=5088, W=5089) 5201 - 5215 r Work offset current values (X=5201, Y=5202, Z=5203, A=5204, B=5205, C=5206, U=5207, V=5208, W=5209) 5221 - 5235 r Work offset 1 values (X=5221, Y=5222, Z=5223, A=5224, B=5225, C=5226, U=5227, V=5228, W=5229) 5241 - 5255 r Work offset 2 values 5261 - 5275 r Work offset 3 values 5281 - 5295 r Work offset 4 values 5301 - 5315 r Work offset 5 values 5321 - 5335 r Work offset 6 values Note: variables #1 - 33 and #100 - #999 are located so they can also be accessed as MCCL user registers 1001 - 1033 and 1100 - 1999 respectively. In other words, if a G-code part program stores something in variable 100, it is available to an MCCL macro in user register 1100. If the MCCL macro stores something in register 1101, the part program can access it in variable 101. Changes for Rev. 3.4a =============================================================================== 7/21/05 Fixed tool compensation so that finish position of a line followed by an arc is correctly calculated for lathes and grinders. In previous code, the compensation algorithms were using the start position of the line that included the tool offset values. To work properly, the algoritms needed to use the start position without the tool offsets. In order to accomplish this, created a new set of variables that hold the "compensated and offseted" positions: coxstart, coystart, cozstart, coxfinish, coyfinish, cozfinish. The compensation algorithms use just the compensated positions without the offsets. Changes for Rev. 3.5a =============================================================================== 7/25/05 Changed wait_stop function in G-code interpreter so that it only waits for axes that are in position or contour mode. This allows auxiliary axes to be run in velocity mode and not stall G-code execution. 7/25/05 Added code to reset motor positions in the block queue after a M-code causes a MCCL macro to be called. In previous code, if the MCCL macro moved a motor, the G-code interpreter might not initiate a succeeding motor move. 7/25/05 Added run_abort and run_active flags to run status variable. These flags will be accessible with the Tell Run Status and Get Run Status commands. The run_abort and run_active flags will be bits 24 and 23 respectively. 7/25/05 Changed GRS command to place run status value in accumulator (user register 0). Previous code placed address of runstatus variable in accumulator. 7/25/05 Modified code for Run Terminate (RUT) command to accept a parameter of -1. In previous code, issuing the command with no parameter caused the run_abort flag to be set, and the command to wait until the G-code interpreter terminated (run_active flag cleared). In the new code, issuing the command with a parameter of -1 will set the run_abort flag and the command will return immediately without waiting for the G-code interpreter to terminate. Changes for Rev. 3.6a =============================================================================== 7/27/05 Fixed code so that B axis will perform linear interpolated (G01) moves. Previous code set vword flag instead of bword. 7/27/05 Crested post blocks to support improved tool compensation implementation. Current code does not use them. Reduced number of possible pre-blocks from 3 to 2. Tool compensation will not use more than 2. 7/27/05 Added code to print end positions of pre-blocks and post-blocks that are executed. Changes for Rev. 3.7a =============================================================================== 7/28/05 Modified Escape Task command so that a parameter of 0 will cancel all background tasks. 7/28/05 Added new system variables for G-code interpreter: Variable read/write Description ==================================================== 6001 w Tool compensation type (0 = Type A, 1 = Type B (default)) 6002 w Display pre-block text (1 enables, 0 disables (default)) 6003 w Display post-block text (1 enables, 0 disables (default)) 6101 - 6115 w Disable wait stop checking (1 disables, 0 enables (default)) (X=6101, Y=6102, Z=6103, A=6104, B=6105, C=6106, U=6107, V=6108, W=6109) Added code to initialize these system variables at the start of a part program. 8/2/05 Improved implementation of tool radius compensation in G-code Interpreter. New code will generate path that avoids clipping corner of block following compensation startup block. This is also done for corner of block that precedes compensation cancel block. This implements Type B tool radius compensation for startup and cancel blocks. Previous code only supported Type A. Changes for Rev. 3.8a =============================================================================== 8/15/05 Fixed arc moves in G-code interpreter. Code changes in revision 3.4a caused arc center position to not be set correctly. 8/15/05 Added 2 system variables to G-code interpreter to control filling of motion buffer: Variable read/write Description ==================================================== 6004 w Enable increment test (1 = enables, 0 disables (default)) 6005 w Motion buffer fill count (integer between 2 and 250) When enabled, the G-code Intepreter will check the change of direction between successive motions. If it is less than the specified Increment value, the motions will be combined in the motion table. The Motion Buffer Fill Count sets the maximum number of motions that will be placed in the buffer. Changes for Rev. 3.9a =============================================================================== 8/18/05 Modified G-code Interpreter operation so that display of block text is in sync with block execution. Also created global variables to hold the status of the block currently executing. These variables are used by the status reporting commands. In the previous code, the status values came from the block structure that was modified as soon as the block executed (before finishing motion). Changes for Rev. 4.0a =============================================================================== 8/24/05 Added new variable PIDTRQ to the motor tables. This value is used to limit the contribution of the PID term to the output torque. Created Torque Limit command (QL, code=199) to set the value of the variable. Remove code from pid_calc() function that applied torque limits differently for open loop steppers. New code treats all motor types the same. Note: The Torque Limit command will only work for an open loop stepper axis if the PID parameters have been unlocked. This is done by issueing the Input Mode (IM) command to the axis with a parameter of 128. Changes for Rev. 4.1a =============================================================================== 9/26/05 Migrated code to latest release of RTEMS, 4.6.4 9/28/05 Changed build to implement the Timer_initialize() and Read_timer() functions. These functions are used by the RTEMS Timing Test Suite. All BSP's that use the Toshiba TX49 family of MIPS processors will now use the timer code that is included in the MIPS libcpu directory. This code uses the timer that is part of the System Control Coprocessor. The clock rate of this timer is 1/2 of the CPU clock rate. 9/29/05 Corrected code in mips_vector_isr_handlers() function that determines proper interrupt vector number. In previous code, depending on what interrupt mask bits were set in the Status register, the wrong interrupt service routine could be called. 9/30/05 Modified contouring operation so that the target position is updated with the optimal position whan the controlling axis is commanded to stop. In previous code, target and optimal positions were updated with the current true position. This allowed the target and optimal positions of the axes to shift after they stopped. 9/30/05 Added "confidential and propietary" notice to all PMC source files. Changes for Rev. 4.1b =============================================================================== 10/7/05 Fixed calculation of feed-forward term for slave axes. This required adding a new variable called Current Speed (curspd) to motor table. In previous code, sign of feed-forward term was not correct for slave axes in contour mode. Current velocity is now a signed value that indicates current direction of travel. 10/7/05 Added code to zero Curacc motor table variable in Motor On command. This was done for consistancy in code. Changes for Rev. 4.2a =============================================================================== 10/12/05 Implemented fast timer to record the amount of time spent performing the motor update. Latest value, maximum value, and minimum value can be read by issuing the Information Display (ID) command with a paramter of 8. Values are displayed in microsecond units. Each time the ID8 command is executed, the maximum and minimum values are reset. 10/14/05 Migrated code to latest release of RTEMS, 4.6.5 Changes for Rev. 4.3a =============================================================================== 11/11/05 Added support for MFX-PCI1802 version of the controller. This is an 8 axis servo controller. All 8 axes use PWM outputs for the command signal. While this product is specified to not have the 4 channels of analog output, if the DAC is present the software can use the analog output to command the first 4 axes. Changes for Rev. 4.4a =============================================================================== 7/20/06 Added code to initialize variables used in PID calculations during execution of Motor On command. This elliminates glitch in servo command output when motor is turned on after a following error. Changes for Rev. 4.5a =============================================================================== 7/31/06 Added support for MFX-PCI1262 version of the controller. This is a 2 axis servo, 6 axis stepper controller. Axes 1 and 3 are configured as servos, 2, 4, and 5 through 8 are configured as steppers. 7/31/06 Corrected macro used to read capture register in FPGA. The read_capposition() macro in previous code read the Idxcapbp element from the motor interface structure. New code reads the Poscmp element. In all previous FPGA configurations, reading Idxcapbp produced same results as reading Poscmp. In the FPGA configuration for the MFX-PCI1262, this is not the case and the macro needed to be corrected. Renamed structure elements from idxcapbp and poscmp, to idxbp and capcmp repectively. This reflects register functions accurately. 7/31/06 Added code to record and display the motor update period. This is the time between motor updates. This value can be displayed along with the time to perform the update, with the Information Display command (ID8). Changes added from Custom Version LA1 to PM1 Rev. 4.5a =============================================================================== 8/1/06 Increased timer interrupt rate to 8 Khz. Servo High Speed rate will be 8 Khz, Medium 4 KHz, Low 2 KHz. Trajectory generators and stepper axes will be at 1 KHz rate. Changes for Rev. 4.6a =============================================================================== 05/27/07 Added new parameter to Input Mode (IM) command to allow changing default polarity of home sensor input edge detection during execution of Latch Edge (LE) controller command. Default was rising edge for normally-open switches. Asserting bit 4 (i.e. IM(8)) in the mode register has the effect of changing the polarity to falling edge for normally-closed switches. 11/15/07 Added support for MFX-PCI1442 version of the controller. This is a 4 axis PWM servo, 4 axis stepper controller. Axes 1 thru 4 are configured as servos, 5 thru 8 are configured as steppers. The distinction to this board is the distribution of axes on each connector: J1: Axis 7 J2: Axis 8 J3: Axes 1 2 5 J4: Axes 3 4 6 This architecture was proposed by David who noticed that a 1440-type board could be created from lower-cost 1040-2 hardware by using the stepper encoder inputs for the servo axes. In addition, the customer can have 6 axes on only two connectors in this configuration. Changes for Rev. 4.6b =============================================================================== 01/08/08 Added support for hardware high-speed strobe function for MFX-PCI1440 (stepper axes only) and MFX-PCI1040 versions of the controller. This feature extends the capability of the compare circuit by providing a new OC mode 5 that produces a set of strobe pulses starting at the axis compare position. Rather than a firmware-mediated set of pulses, the fpga now produces a train of strobe pulses at regular encoder count intervals. The MCConfigureCompare() and MCEnableCompare() functions, as well as the corresponding MCCL calls were expanded to support the additional fpga registers required for this function. The following sequence of commands illustrates the revision: 1OC5 // set output compare mode to 5 for hardware strobe function 1LC1000 // set compare start position to 1000 counts 1NC400 // set PW = 10 uS (25E-9 * 400) 1OP10 // set strobe period to 10 encoder counts 1BC100 // start compare and issue 100 strobe pulses 04/01/08 Modifications to strobe circuit - function will only exist on 1040 and 1440 stepper axes - logic modified to drive strobe circuit from encoder inputs only, for both open and closed loop modes Changes for Rev. 4.6c =============================================================================== 02/23/08 More modifications to strobe circuit driven by customers who want high-speed strobe output on servo axes - 1040 has strobe logic on axes 1-4 - 1440 has strobe logic on axes 1-2-5-6 Changes for Rev. 4.7a =============================================================================== 03/12/09 Implemented new 1622 board architecture. This board type has the following axis configuration axis type 1-4 PWM servo 5-6 Step/Direction pulse 7-8 PWM servo A single configuration file was created that is based on the 1802 board type containing 8 encoder channels, by definition. The only available configuration will be 1622_2_e with ADC. 03/30/09 Implemented a 1400 board configuration which has 4 servos only. The two configuration types (-0 and -2) have axes 5-8 disabled. The o/s loads a 1440 fpga image for this configuration. Changes for Rev. 4.8a =============================================================================== 05/18/10 Added support for 8 kHz interrupt (PID) rate, providing partial compatability with 16 kHz version of MFX-ETH. The 200 MIPS 4925 processor cannot support the higher interrupt rate. The following commands are now supported by the MFX-PCI: YL low interrput rate (4 kHz) default YM medium interrupt rate (8 kHz) 07/26/10 Problem was reported on pulse axes in s-curve profile mode where axis was stalling one count short of target without assertion of At Target and Trajectory Complete. The PID code was modified to remove the one count pulse axis deadband for open-loop steppers in s-curve mode only to resolve the problem. 07/28/10 Modified logic in micwcc.v to address problem in gantry mode on pulse axes. The slave axis pulse count was found to be incorrect in almost all position moves. This was traced to the lack of implementation of the breakpoint latch, relying instead on position error and velocity to terminate the move. The fix involved adding muxes to all stepper interfaces that allowed the slave axis step and direction outputs to be identical to those of the master axis. The SM command was modified to write a 2-bit mux select to a new fpga register in the slave axis which switches in the signals from the master axis. Changes for Rev. 4.8b =============================================================================== 10/15/10 Added new command to specify fixed min/max velocity ratio for pulse axes. aVRn Velocity Ratio = n (double) (function 309) mtr->velratio motor table variable (added to lookup) The ratio defaults to 0 in which case the MV and SV commands work as always. If mtr->velratio is set to a non-zero value, MV returns without changing the minimum velocity. The minimum will instead be set based on the min/max ratio and will track changes to the SV and VR commands. When the ratio is set back to zero, the previously programmed value for minimum will be restored. 10/18/10 Added parameter checking to SM and SS commands that will only allow hardware muxing of pulse output on slave axis (07/28/10) if the slave ratio is 1. This provides accurate gantry operation but still allows gearing for other applications. 10/23/10 Fixed bug that was preventing pulses from being re-enabled when an axis changed from a slave ratio of 1 to any other value. This was a result of the recent changes to the SS command to support the pulse axis gantry multiplexing, Changes for Rev. 4.8c =============================================================================== 07/22/11 Bug fix for spline contouring when using synchronized motion. It was found that a zero-length move resulted in divide-by-zero fpu exception and a crash. This was fixed in pre_process_spline() in ctrcmd.c Changes for Rev. 4.8d =============================================================================== 09/22/11 Bug fix for servo axis high-speed strobe compare function. The direction of motion was not being considered in the encoder count logic resulting in incorrect strobe output position. This was fixed in strobe.vhd (motifc_lib). 09/27/11 Deleted support for all higher-speed loop rates. Apparently the interrupt timer overhead was an issue for some high performance systems and produced noticable perturbation. Everything reverts back to 4 kHz PID rate. 10/04/11 Beta release of enhancement to high-speed strobe logic that supports bi-directional position moves (previously only + motion). Also modified the state machine to eliminate a spurious 25 nS pulse at the end of the programmed strobe output. 10/13/11 Management of the beta release caused the incorporation of the older revision of clock interrupt driver and associated 16 kHz PID loop rate support (deleted on 09/27). The source trees were resolved and correct versions of libbsp functions and init() functions now insure that the controller supports only 4 kHz PID rates, as intended Changes for Rev. 4.8e =============================================================================== 11/30/11 Implemented a 4-channel PWM controller for the 1040 platform. The outputs are placed on general-purpose digital outputs as follows: PWM channel Digital Out (channel) 1 10 (42) 2 11 (43) 3 14 (46) 4 15 (47) The digital outputs are still available for use if the PWM circuit is disabled. The duty cycle of each channel is independent but there is a common clock and prescaler used by all 4 channels. The two command mnemonics that are used to control these circuits are: PKn - set PWM frequency (f = n * 50 Hz) aPGn - set duty cycle of channel a (function 183) (duty cycle = n / 65535) Notes: 1. To disable the PWM circuit, command a duty cycle of zero to the desired channel (aPG0). 2. The base frequency of 50 Hz is approximate (50.86 Hz) 12/05/11 The Spartan2 DLL allows fewer frequency synthesis options so in order to maintain compatability between PCI and ETH versions, the base frequency of the PWM circuits had to be changed. The new value is PKn - set PWM frequency (f = n * 38 Hz) It was also noted that a frequency scaler value that is an exact power of 2 (8, 32, 1024,...) results in a more jitter-free pulse train. At other values and high frequencies, the jitter can be as great as 500 nS. This will be addressed and fixed in a future release. 12/08/11 Implemented Position Following Error Limit feature to allow user to specify an allowable interval during which the axis exceeds the programmed following error. This is useful for excursions outside the limit during accel and decel that may not be as of much interest as constant-velocity error. The new function is aFXn - sets axis a to a following error time (function 169) limit to n mSec before asserting the error The motor variables that can be looked up are: poserrcnt (int) PID loop error counter poserrlim (int) position error limit (loop counts) poserrtime (long) position error limit (mSec) Changed function number of VR command to eliminate conflict with piezo mode functions that will likely be merged into the PM1 code 01/24/12 Implemented OEM customizable version string reported by VE command. This required the following addition to the fwconfig structure and generation of new configuration files for the boot rom typedef struct { unsigned short modelnumber; unsigned short sspare1; unsigned short maxaxisnum; unsigned short sspare2; char oemmodel[64]; /* OEM model number string */ char oemname[64]; /* OEM company name string */ int ispare[30]; MFX_AXIS_CONFIG axisconfig[8]; } PACKED MFX_FIRMWARE_CONFIG; The new string fields are populated with the default PMC information during boot rom creation, but at controller startup, the strings can be re-written with OEM-specific data. Also, the VE command was modified to report these strings instead of the previous hard-coded data. 01/27/12 Implemented a 32-bit counter register that can be used by applications as a semi-realtime clock. This was implemented on the 1040 platform only but may migrate to others if there is a demand. The offset of the register that returns the integer clock count is: 0xb8000140 Changes for Rev. 4.8f =============================================================================== 04/12/12 Implemented Data Logging function on MFX-PCI to allow improved visibility into real time events, failures, etc. The first iteration of this feature will have fixed debug events coded into the embedded system but subsequent versions will have a more dynamic mechanism for identifying log data. An additional MCCL function was required to control the data logging. aEGn (function 254) - enable/disable data logging per axis a = axis (0 => all axes) n = 0 disable logging -1 reset log buffer to initial values 1 enable logging Comprehensive status information can be logged by setting flags contained in the higher-order bits of the n parameter to the EG command above. The flag bits and their significance are as follows: n |= 0x8000 - log all Move commands in position mode log all position move completion events n |= 0x4000 - log all Move commands in contour mode log all contour move completion events n |= 0x2000 - log all Move commands in slave mode log all slave move completion events n |= 0x1000 - log each point from profiler The function call to insert an event in the status log is void log_stat(char *stat_str, int cnt, int axis) stat_str status log message (\n termination) cnt message length axis axis number The message will be logged with a time stamp followed by the axis identifier and the message string. Following is a description of the data structure related to event logging. #define STATLOGSIZE 0x1000 #define STATLOGNUM 2 typedef struct { int stat_log_num; /* number of buffers */ int stat_log_size; /* size of buffers */ char *stat_log_addr; /* base address of buffer space */ char *stat_log_start[STATLOGNUM]; /* pointers to start of buffer data */ char *stat_log_end[STATLOGNUM]; /* pointers to end of buffer data */ int stat_log_cnt[STATLOGNUM]; /* byte count written to current buffer */ int stat_log_flg[STATLOGNUM]; /* buffer status flag (full,...) */ int stat_log_en; /* individual axis log enables */ int stat_log_rst; /* reset from external app */ char stat_log[STATLOGNUM][STATLOGSIZE]; /* array of log buffers */ } PACKED STATUSLOG; The data log is statically linked to allow a fixed address in PCI user space to allow applications to pull data from the controller without the API opening a controller handle. The offset of the structure is 0xA0021000 (uncached). The offset can be verified by issuing a lookup command for the variable "statuslog". statuslog (char *) offset to STATUSLOG structure Changes for Rev. 4.8g =============================================================================== 07/18/12 Corrected defect in OEM version string mechanism from 4.8e. Without a newer configuration file containing the string data, the VE command produced blank lines. A field was added to the config data as follows: typedef struct { unsigned short modelnumber; unsigned short sspare1; unsigned short maxaxisnum; unsigned short oemid; /* non-null for new config data */ char oemmodel[64]; /* OEM model number string */ char oemname[64]; /* OEM company name string */ int ispare[30]; MFX_AXIS_CONFIG axisconfig[8]; } PACKED MFX_FIRMWARE_CONFIG; The oemid field is now checked and if null, a default string is generated by within the VE command. If not, the oem data is taken from the config data and displayed. 11/28/12 Corrected defect in PG command that caused controller to hang due to incorrect interrupt enable/disable 02/21/12 Implemented the 32-bit counter register and 4-channel PWM controller from rev 4.8e on the 1262 platform. These features are added to various controller types on an as-needed (customer request) basis. The configuration data (mfxconfig) was modified to add the 1262-3 board configuration. =============================================================================== End of Revision History ===============================================================================