This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: fpu math lib and f28379D

Part Number: TMS320F28379D

Hi to all,

              Im trying to migrate PID controller code from fixed point to fpu on f28379D. On the fixed point processor the code is working as expected and the pwm3 register change output acorrding to the PID controller. If I use the softlib in the f28379D and working with IQmath the code works OK without problems. However if I change to fpu and using fpu32_lib (using the 2837x_RAM_IQMATH.cmd and using the IQmath_fpu32.lib) the EPwm3Regs.CMPA.bit.CMPA register is only update if I put a software breakpoint. If I choose "run free" the code is not working at all and I don't have any scope signals. I take some pics to show that I only have outputs If I have a soft breakpoint:

why I only get output if I put a breakpoint? I missing something for sure.

regards

Gastón

  • Gaston,

    Does the project build generate any warnings?

    Side question - When using IQMath with the fpu32 enabled, are you changing MATH_TYPE to FLOAT_MATH in IQMath.h? 

    I don't see a relationship between fpu32/IQMath and the issues you are observing. Perhaps we should look into the linker cmd file for clues.

    Thanks,

    Sira

  • Hi Sira thanks for your quick reply,

                                                            the code is a PID controller (pwm3 -----> adc conversion----->update pwm3.cmpa ). I already tested with IQmath on fixed processor and it works great. But changing to fpu (with libs and woking with RAM) the pwm3.bit.cmpa is not update unless I put a breakpoint in the code. 

    the EPWM3.bit.cmpa is update on ISR only with a breakpoint.

    Gastón

  • I solve my problem adding this code inside the ISR:

    if(DutyCycle < 1)
    EPwm3Regs.CMPA.bit.CMPA = 3;
    else
    EPwm3Regs.CMPA.bit.CMPA = (Uint16)DutyCycle;

    I still don't know why adding the if the cmpa reg is update (maybe some cycles to update the register???). 

    Gastón

  • Gaston,

    Is the computation of DutyCycle inside the ADC ISR correct with the FPU32?

    Another question, I see you have included IQMath_fpu32.lib, but your code indicates you don't really need IQMath_fpu32.lib, since you aren't making any IQMath function calls.

    How are you running this code? From RAM with the emulator connected to CCS?

    Thanks,

    Sira

  • I included the fpu32lib because I was using the IQmat function like div and multiple IQ numbers and I forgot to remove it. The DutyCyle is calculated inside the ADC ISR (you're thinking that maybe I need to do this dutycyle update outside the ISR, but using fixed point processor I dont have any problems).

    Gastón

  • I am fine with where you are computing DutyCycle. My question is whether it is generating the same results/correct results as your previous method based on IQMath. 

    My next question was how you are running this code, using CCS?

  • Yes, now is working. I added the IF and its working correct now (I suppose it takes a few cycles to update the register). Yes Im running this on CCS 10.

    Gastón