AG32: Industrial Servo Encoder Application
Encoder is an important component in the servo system, used to determine motor parameters in real-time. The encoder rotates together with the motor to accurately obtain motor parameters. Then, it is programmed, converted into signals for storage, communication, and transmission, and fed back to the controller to form closed-loop control. From the perspective of different physical media, encoders can be further divided into optoelectronic encoders and magnetic encoders.
In the architecture design of traditional encoders, many adopt the design scheme of MCU+CPLD (FPGA). CPLD/FPGA can replace the small and medium-sized circuits on the periphery of traditional microcontrollers, and logic functions can be reconfigured within the system without disassembly.
The following figure shows a photoelectric shaft angle encoder designed with a dual chip structure of MCU+CPLD, which functions as an A/D data acquisition, processing, and display system. MCU writes corresponding software programs according to the system requirements and algorithms to process the data transmitted by CPLD, and sends the processing results to the display cache constructed by CPLD. CPLD completes the dynamic scanning and display of the data.
The main function of the CPLD chip is to process encoder data and enable it to meet other functions, such as converting the binary data returned by the encoder into orthogonal phase pulses.
The principle of magnetoelectric detection has characteristics such as resistance to vibration and pollution, and can be applied in fields that traditional photoelectric encoders cannot adapt to. The main MCU collects signals (sine/cosine values) from the magnetic sensor for operation and processing; The auxiliary MCU collects motor rotor information through Hall, records multi turn data, and transmits it to the main MCU; The motor position and other data are stored in the EEPROM and can be directly read during startup.
In such an architecture, it is necessary for the MCU to have a high-resolution ADC to collect data transmitted by the magnetic sensor. At the same time, it is required that the AD conversion rate is fast and the system main frequency is high enough to quickly calculate the motor rotor angle value and transmit it to the servo driver.
In addition, in AC servo systems, accurate and reliable acquisition of encoder signals is the key to the entire closed-loop control; The encoder signal is often affected by external interference, which can generate error code pulses and bring deviation to servo control. CPLD can also be used to implement circuits with encoder differential signal input, error code filtering, and phase detection functions, improving the reliability of encoder signal inspection.
The CPLD completes signal conversion, error code filtering, frequency doubling, and equalization, ultimately converting the differential encoder signal into a pulse/direction signal. CPLD has the advantages of multiple available gate circuits, fast processing speed, high reliability, and cost-effectiveness; Moreover, the integration of error signal conversion, error filtering, and other circuits on the same chip improves the universality and flexibility of the system. At the same time, CPLD supports programmability, facilitating on-site circuit upgrades.
The AG32 series MCU products have built-in CPLD logic inside the chip, which can effectively meet the needs of servo encoders and reduce customer BOM costs.
Program features:
1. AG32 has a maximum clock frequency of 248MHz and a wide range of peripherals, including five UARTs, two I2Cs, and supports various peripheral modules such as USB, CAN, and SPI channels. With its high-speed instruction execution speed, convenient JTAG debugging method, and low power consumption, it provides a relatively complete platform for data collection and processing design.
2. AG32 has a 3x12 bit ADC with a maximum of 3M SPS (17 channels), 2 DACs, and provides two dual channel comparators.
3. AG32 is initially compatible with STM32 pins, but can be flexibly redefined through configuration files for use by MCU and CPLD in the kernel, thus providing more GPIO ports than STM32.
4. The MCU and CPLD of AG32 communicate at high speed through the internal AHB bus of the chip, which is much faster than traditional SPI.
5. AG32 built-in CPLD can achieve customized logic functions for customers.
6. Available in over 32/48/64/100 packages.