I use Matlab R2017a and Embedded Coder Support Package for Texas Instrument C2000 processors. I designed a validated Phase-Locked Loop (PLL) including a feed-back loop to estimate power grid frequency (50 Hz). The simulation results (the voltage frequency and amplitude) in double format and the results of implemented model on Raspberry Pi 3 including 64 bit processor are correct but when I changed data format to single (32 bit) the frequency and amplitude increased. This steady state error is also visible in the results of implemented model on Launchxl-F28377S that includes a 32 bit DSP, however we do not expect steady state errors in feed-back loops. I think this problem is resulted from numerical errors. The Simulation model and the results of double and single format simulations and implemented model on Launchpad have been attached as a zip file. Should I change the model design (For example using fixed-point design or code programming)? Is it require another (further) setting or special requirements? How can I modify the model to run on this DSP without such errors in the experimental results?
The double format simulation results:
The single format simulation results:
The results of implemented model on DSP: