# Design and Implementation of a System-on-Chip for Self-Calibration of an Angular Position Sensor
## 1 Introduction  
In some mechatronic systems, acquiring angle information is a prerequisite for implementing control strategies or performing information processing [1]. Resolvers [2] and Capacitive Angular Position Sensors (CAPS) can be used for angle acquisition [3]. These sensors detect angle information and output two related orthogonal sine and cosine signals through signal modulation and demodulation.  
In practical applications, output signals usually contain amplitude deviations, direct-current (DC) offsets, and a phase shift [3]. The output signals can be described by Equation (1):  
\[\begin{array}{l}U=a_{1}\cdot\sin\theta+b_{1},\\ V=a_{2}\cdot\cos(\theta+\beta)+b_{2}.\end{array} \tag{1}\]To improve sensor accuracy, error components need to be identified and the sine and cosine signals should be extracted according to the identification results. Parameter identification based on input and output signals [4; 5] of the sensor is an effective solution. In applications where the input signal is not directly available, self-calibration schemes are more widely applicable. Self-calibration based on a least mean square algorithm was first proposed in [6]. According to this scheme, an ellipse fitting method [7] and a parameter identification algorithm [1; 8] based on gradient descent were developed. On this basis, [PERSON] [9; 10] proposed iterative algorithms for self-calibration, while [PERSON] et al. [11] applied the technology detailed in [12] to design a two-step gradient estimator and realize online parameter self-calibration.  
Self-calibration in hardware eliminates the need for additional offline data processing, further simplifying the sensor calibration process. [PERSON] et al. [13] designed a code compensator to extract position information for magnetic encoders. [PERSON] et al. [14] proposed an interpolation technique to improve position information accuracy. These methods were more concerned with suppressing error sources. For the processing of error signals, [PERSON] et al. [15] proposed an adaptive digital demodulation method for a sinusoidal encoder signal, and [PERSON] et al. [16] developed a piecewise calibration technique that provided a good trade-off between microcontroller memory size and algorithm complexity. The scheme in [11] was also a self-calibration method implemented in hardware. Simpler signal processing algorithms generally consume fewer hardware resources, motivating the solution proposed in this study.  
This paper applies a Least Mean Square Error Demodulation (LMSED) algorithm for parameter identification and self-calibration. This algorithm uses simple mathematical operations and a coprocessor based on the algorithm is designed to handle the entire self-calibration process, including parameter identification and angle calculation. A System-on-Chip (SoC) with the coprocessor is also designed to implement parameter configuration and further signal processing. The SoC core is Arm Cortex-M3 [17], which is the industry-leading 32-bit low power processor for highly deterministic real-time applications. The coprocessor communicates with the core through Advanced Peripheral Bus (APB) for data and control information. The prototype verification is performed on a Field Programmable Gate Array (FPGA) development board, and the FPGA is used for self-calibration of the CAPS.  
This paper is organized as follows. Section 2 discusses the signal model and issues that need to be resolved. Section 3 presents the architecture of the SoC, as well as the theoretical analysis and implementation details of the coprocessor are presented. Section 4 details the algorithm simulation, Register-Transfer Level (RTL) simulation for the coprocessor, FGPA experiments, and the CAPS. Finally, Section 5 provides conclusions and future research plans.