Microcontroller(MCU)chip is the most commonly used hardware implementation scheme in the field of motor control,and it has certain advantages in performance and reliability.At present,most of the MCU products on the market are general-purpose MCUs,and dedicated MCUs for specific application scenarios are rare;and the mainstream 32-bit MCUs are all based on ARM cores and require high licensing fees.Therefore,to design a motor control dedicated MCU based on the open-source RISC-Ⅴ architecture can not only implement the required functions with the least circuit resources,thereby reducing the power consumption and area of the chip;but also avoid intellectual property risks and realize the autonomous controllability of the chip.On the basis of studying the theory of motor control,this paper has completed the following work:1.According to the defined functional requirements,the RTL-level code of the motor control MCU chip is designed by using Verilog HDL,which mainly includes circuit modules such as processor core,peripheral devices,system bus and interrupt control.Among them,the core is based on the RISC-Ⅴ instruction set architecture and adopts a three-stage pipeline structure,which is mainly used for instruction execution and data operation.Peripherals include PWM,TIMER,WATCHDOG,USI and GPIO modules to implement motor control functions.The system bus is used to implement communication between modules,and the interrupt control module is used to generate or receive interrupt requests and to arbitrate their priorities.2.The simulation verification platform is built by ModelSim software,and the functional simulation verification of the designed MCU is carried out.The simulation process is from circuit module level simulation to subsystem level simulation.The simulation results show that the performance of each module of the MCU is as expected,and it can correctly execute instructions,process data and generate motor control signals.3.FPGA-based prototype verification and system-level test were performed on the MCU.The designed code is transplanted to the FPGA development board and verified by Quartus Ⅱ software platform.Then,a complete motor drive control system was built by combining the power supply,motor driver and motor body,and the software and hardware collaborative test based on the actual motor control scenario is carried out.The test results show that the MCU can correctly execute the C language software code for motor control,and adjust the motor speed according to the positional PID algorithm.According to a series of simulation,verification and practical test results,it can be concluded that the designed MCU can correctly execute the software code written in the high-level language,and realize the software algorithm using the hardware circuit.Each submodule in the circuit can work normally,and can control the start and stop,position and speed of the motor,and all functions meet the design indicators. |