Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE
Hi
I'm like to calc a sinus and a cosines value with the IQMath lib on a F28035.
But if I measure the run time of my calculation it needs twice as long as written in the documentation.
// optimization 4, Speed/Size 4: 365 ticks (running out of RAM) _iq29 iq29PosRad = _IQ29mpyI32(IQ29_INC_TO_RAD, u16Pos); // 4 _iq29 iq29Sin = _IQ29sin(iq29PosRad); // 46 _iq29 iq29Cos = _IQ29cos(iq29PosRad); // 44 _iq29 iq29Sinus = _IQ29mpy(iq29Sin, _IQ29(fAmpl)); // 6 _iq29 iq29Cosinus = _IQ29mpy(iq29Cos, _IQ29(fAmpl)); // 6 _iq29 iq29PwmA = _IQ29mpyI32int(iq29Sinus + _IQ29(1), PWM_PERIOD/2); // 22 _iq29 iq29PwmB = _IQ29mpyI32int(iq29Cosinus + _IQ29(1), PWM_PERIOD/2); // 22 => Summe 150 cycles set_pwm(iq29PwmA, iq29PwmB);
I measured the runtime with a timer and with a GPIO.
GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1; u32Start = CpuTimer0.RegsAddr->TIM.all; calc_sincos(fAmplTest, u16PosTest); u32Laufzeit = u32Start - CpuTimer0.RegsAddr->TIM.all; if(u32MaxLaufzeit < u32Laufzeit) u32MaxLaufzeit = u32Laufzeit; GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
The code is running inside the pwm ISR. This ISR copied into RAM for execution.
Kind regards
Rene