Software and hardware solution for digital signal processing algorithms testing

The article describes the microprocessor system for various digital signal processing algorithms testing. The development of electric drive control systems is carried out with the usage of modeling systems such as, MATLAB/Simulink. Modern digital control systems are based on specialized digital signal microcontrollers. The present market offers evaluation boards, for example STM32F4DISCOVERY, which enables to connect a microcontroller to a personal computer. It makes possible to use the microcontroller as a part of the mathematical model of the control system. However, the designing of the control system simulation model and the program for the microprocessor is carried out in different programming environments. Thus, the software and hardware solution for testing programs for the microprocessor, which is a part of the control system, is relevant. This article deals with the designing of the modeling method in which the prototype program for the microprocessor is debugged as a part of the electric drive control system simulation model.


Introduction
A microcontrollers flash memory, which is designed to store programs, has a limited number of overwriting cycles. For example, 10,000 cycles for the STM32 series of microcontrollers. Thus, it is advisable firstly to design a microcontroller program prototype on a personal computer and then to prepare the final program for the microcontroller on the basis of the debugged prototype in a specialized development environment [1], [2]. The paper proposes a hardware and software solution based on evaluation board STM32F4DISCOVERY with microcontroller STM32F407 that enables: to design and test the operation of microprocessor program prototypes; to integrate a microprocessor in the electric drive control system simulation model; to perform simulation of the electric drive control system; to process the control system simulation results. It is considered in the paper that a rotor speed estimation of an induction motor by the extended Kalman filter (EKF) tests the proposed solution.

The software and hardware solution structure
A microcontroller program prototype is a software implementation of the main data processing algorithm without additional initialization of the microcontroller periphery. MEX (Matlab Executable) files enable to call C subroutines from the MATLAB programs. Thus, it is possible to test source code fragments designed for the microcontroller. Once all the fragments are combined together with the initialization of the microcontroller auxiliary periphery into a single program, it can be loaded into the microcontroller memory and the developed solution enables to embed the microcontroller in the electric drive control system model in Simulink. The STM32F4DISCOVERY evaluation board enables to connect an auxiliary equipment to test different aspects of the electric drive control system mathematical model.
The functional diagram of the proposed solution is shown in figure 1. The developed C# form application enables to configure the operating mode of the control system model. The form is used to set the connection parameters to the microcontroller, if it is included in the mathematical model. When you select a MEX function with the required data processing program, the parameters of the selected algorithm are specified in the form. The results of data processing are recorded in the database during the modelling process. The graphical form uses the .NET component compiled in MATLAB to plot the data written to the database during the simulation.
The flow diagram of the suggested solution is shown in figure 2.
A Microsoft .NET Framework is a software platform which enables to combine a code written in different programming languages into a single software package. In this case, the programs for the microcontroller are made in C, and the graphical shell are made in C#. The C# language was created for programming in the .NET environment and supports all its capabilities. The C# language is an object-oriented programming language that enables to create web applications, graphic forms, to work with various database management systems. It is possible to use .NET Assemblies in a code in MATLAB.
In the proposed solution .NET Assembly includes a graphical form that designs objects to configure the solution and controls the operation of the Simulink model. It is possible to design function pointers in C language. It is possible to use this feature by passing some object method call to the MEX function. Next, we dereference the pointer to the passed function in the C program, and thus can control the objects designed in the C# program. The proposed approach will combine the capabilities of C, C#, MATLAB languages and expand the modelling capabilities through the use of various methods of object-oriented programming. Figure 3 shows the programming technologies used in the proposed software and hardware solution.

Test example
To test the proposed solution let's consider the mathematical model of the extended Kalman filter [3], [4], [5], which is used in the control system to determine the rotor speed estimation of an induction motor [6], [7].

The EKF implementation
Structure of the EKF is based on the mathematical model of the induction machine expressed in the stationary reference frame [8], [9].
means that it is a predicted value at the 1 + k t instant and it is calculated on the measurements up to the

Estimation results
The difference equations of the extended Kalman filter were used to write the MEX function. The parameters of the induction motor used in the EKF mathematical model are shown in table 1. The following operation mode of the induction motor was simulated in the Simulink. The induction motor was accelerated to a speed rref  = 120 rad/s and at the time t = 2 sec a load of 100 Nm was applied to the motor. The designed and tested program of the extended Kalman filter can be further used to design a microprocessor-based sensorless control system for an induction motor [10]- [15].

Conclusions
The paper proposed the software and hardware solution, which enables to test different algorithms of a data processing on the basis of the evaluation board STM32F4DISCOVERY. The considered modeling method makes it possible to use the advantages of such programming languages as C, C#, MATLAB in the modeling of electronic device mathematical models.