AnsweredAssumed Answered

PID Speed impruvement

Question asked by Kilohercas on Apr 23, 2014
Latest reply on Jul 1, 2014 by Harshit.Gaharwar

Hello, i am working on fast PID system, and i need a bit help for code optimization. Main problem is that i don't want to use asm, i can program only in c;

Code is simple, first i make table of sin and cos inside memory, enabling PDAP interface so i can get data from FPGA, and when i enable DMA i track DMA status, and by knowing that simply making single point DFT, and after that i calculate phase, and send error correction signal to DAC connected to AMI interface (16b)


Can any one spot what can i do faster ? for starters, it looks that reading DMA status registers slows down my program, and when i added NOP to slow down checking, i get 22% speed boost. Optimization is for speed in compiler settings.


Also very strange that when i switched from unsigned int data[128] to int data[128] speed goes from 155kHz to 207kHz.
Maximum speed i can get is determinated by detector and FPGA , and it is 230kHz, if i could get 220KHz i would be very happy.