Design of a PCI bus motion control card using PCI9052
2026-04-06 03:50:08··#1
Motion control technology is increasingly widely used in automation in industry, offices, and homes. Control methods have evolved from simple start-stop control powered by machinery to precise control of position, speed, acceleration, and torque. The original "motor drive" and "electric transmission" have progressed to a new stage of " motion control." The PCI bus, a high-performance 32/64-bit address-data multiplexed local bus, can simultaneously support multiple peripheral devices. There are two main methods for implementing a PCI bus interface: one is to use a CPLD or FPGA to design the PCI interface, which is more flexible but more difficult and has a longer design cycle; the other is to use a dedicated PCI interface chip, which can greatly reduce the designer's workload, thereby shortening the development cycle and reducing development costs. This motion control card uses the PLX PCI9052 interface chip, which conforms to the PCI 2.1 specification. Compared to the ISA bus, the PCI bus supports three physical spaces: memory address space, I/O address space, and configuration space. The configuration space is unique to PCI, and all PCI devices must provide a configuration space. The PCI9052 includes a serial EEPROM interface for loading configuration information, specifically for loading adapter device information. The serial EEPROM stores important configuration information for the PCI9052, such as device number, manufacturer number, device type number, local space base address, and local space descriptor. The PCI9052 has strict requirements for the EEPROM model; compatible models include HolTek's HT93LC46 and Microchip's 93LC46B. In ISA mode, the use of the EEPROM is essential. To ensure the PCI9052 functions correctly in ISA mode, it is crucial to ensure that the EEPROM can be found and to connect pin 68 of the PCI9052 low. The contents of the EEPROM are critical, directly affecting the proper functioning of the entire board, and require careful attention during design. Motion Control Chips Traditional motion controllers often use embedded high-performance microcontrollers or DSPs, but these systems suffer from insufficient integration, complex circuitry, and long software and hardware development cycles. Using a dedicated motion controller can improve system integration, interpolation speed, and reliability, while simplifying circuitry and shortening development cycles. Currently, there are various motion controllers on the market, such as those from PMD in the US and NOVA, KYOPAL, and SEEK in Japan. This design uses NOVA's MCX312, a motion control chip capable of simultaneously controlling two independent servo motors or stepper motors. It outputs pulse trains and can perform position control, interpolation drive, and speed control on servo and stepper motors. ● Independent Two-Axis Drive: One chip can control the motion of two motor drive axes separately. Each axis can perform constant speed drive, linear acceleration/deceleration drive, S-curve drive, etc., with both axes exhibiting identical characteristics; the output drive pulse range is 1PPS to 4MPPS, and when using a 16MHz clock, the output pulse frequency accuracy is less than ±0.1%. ● Quantitative Drive and Continuous Drive: Quantitative drive outputs a predetermined number of pulses at a fixed speed or acceleration/deceleration to move to a specific position or perform a specific action. Continuous drive continuously outputs drive pulses until a high-order stop command or an external stop signal is valid, used for origin search, scanning operations, and motor rotation speed control. ● Interpolation Drive: Capable of 2-axis linear and circular interpolation within the current position range of -8,388,607 to +8,388,607, with an interpolation accuracy of ±0.5 LSB and a speed range of 1 PPS to 4 MPPS. It can continuously apply 2-axis linear and circular interpolation at each interpolation node, with a maximum speed of 2 MHz. ● Position Control: Each axis has two 32-bit position counters: one is an internal logic position counter managing the drive pulse output, and the other is an actual position counter managing pulses from an external encoder. An interrupt can be generated when the relationship between the position counter and the comparison register changes, through internal register settings. ● Real-time monitoring: During the drive process, information such as logical position, actual position, drive speed, acceleration, and acceleration/deceleration status (accelerating, constant speed, decelerating) can be obtained by reading the internal registers in real time. ● Other functions: The MCX312 also has many other important functions: quantitative drive and continuous drive controlled by external signals; hardware limitation; emergency stop; drive status output; pulse output mode selection; input signal filtering, etc. System Design: In the hardware system, the PCI9052 acts as a bridge connecting the CPU and the motion control chip, completing the transition from the PCI bus to the ISA bus. The CPU controls the motion control chip through programming to achieve control of two-axis motion. The hardware structure of this design is shown in the figure below. The PCI9052 is connected to the PCI bus. AD[31:0], CBE[3:0], PAR, TRDYN, IDSEL, STOPN, PERRN, SERRN, CLK, RST0, INTA0, and LOCKN are essential signals. EESK, EEDO, EEDI, and DDCS are connected to the serial EEPROM. The CPU controls the MCX312 with 16-bit data, causing it to emit X and Y direction pulse signals to control the movement on the two axes. The CNC system returns system position information, including nLMTP, nLMTM, nINPOS, and nALARM, through position sensors, thereby achieving left and right direction limit, servo positioning, and alarm functions. The encoder input signal causes changes in the actual position counter of the MCX312, allowing the actual movement position of the two axes relative to the origin to be obtained. General purpose inputs and outputs expand the system's functionality and can be used for different purposes depending on the application. The following points should be considered in circuit design: (1) According to the PCI protocol, the length of the CLK signal line of the PCI bus is 2500mil, and the length of other signal lines should be within 1500mil; (2) Since the system mainly uses switching inputs and outputs, interference from external signals should be avoided as much as possible in actual operation. To achieve this, optocouplers are used in the system. The input end is equipped with a light-emitting device, and the output end is a light receiver. Switching inputs are blocked outside the optocoupler when connected to the circuit, thus isolating the interference; (3) A large inrush current is generated during the signal level conversion of digital circuits, and a large voltage drop is generated on the transmission line and the internal resistance of the power supply, resulting in serious interference. In order to suppress this interference, a decoupling capacitor of about 0.1μF with good high-frequency characteristics is connected between the power supply and ground of the chip; (4) One of the PRSNT1# and PRSNT2# of the bus signal must be grounded. They indicate the existence of the board and provide information about the power requirements of the board. Function Library and Driver Design The motion control card provides users with a hardware and software platform, allowing them to select and use the functions they need. The development of a function library is essential for implementing these functions. The function library is used for secondary development of the motion control system. Programmers can use high-level languages to control the motion control system by calling library functions. The system's library functions include five categories. (1) Basic parameter settings, including card initialization and release, pulse output mode, hardware and software limit settings, pulse output mode and encoder input working mode, acceleration/deceleration mode settings and input signal filtering function settings, etc.; (2) Motion parameter settings and reading, including range settings, acceleration/deceleration settings and reading, drive speed settings and reading, initial speed settings and reading, logic/actual position counter settings and reading, COMP+/COMP- register settings, etc.; (3) Drive status checks, including obtaining the drive status of each axis and interpolation drive status; (4) Pulse drive output and settings, including two-axis linear interpolation, clockwise/counterclockwise circular interpolation, quantitative drive, continuous drive and drive deceleration stop and immediate stop; (5) Switch input and output, including all switch input and output and control of individual input and output. When developing applications under Windows, system limitations should be considered. Windows system divides user access permissions to protect the system. The user's level is shielded by the system from hardware resources, and the user cannot directly access hardware resources. In order to achieve the purpose of communicating with hardware, a driver program must be written. Tools for Windows driver development include Windriver, DriverStudio, and the DDK (Driver Develop Kit). Windriver is simple to use, requires no specialized knowledge of system drivers, and has a short development time, but is inefficient and difficult to deploy. DDK is efficient and reliable, but cumbersome to use and has a long development cycle. DriverStudio includes tools such as DriverWorks, SoftICE, and DriverAgent, offering powerful development and debugging capabilities. It encapsulates the DDK in the form of classes, making it easy to use. This article utilizes DriverStudio for driver development. DriverWorks provides the DriverWizard, which can be used to generate the driver framework. The most crucial step is adding the corresponding I/O ports, memory resources, DMA, interrupts, and other hardware resources, and adding code to the corresponding handlers. Conclusion This system uses a PCI bus interface and the MCX312 motion control chip, supports plug-and-play, can be used with multiple operating systems, and features high output pulse frequency, accurate control, and easy multi-axis expansion. It can be widely used in robots and PC-based CNC systems. Editor: He Shiping