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.

TMS320F28069F: Instaspin - problem with fpu32 division

Part Number: TMS320F28069F


I started to develop my project on F28027F but because of lack of pins i moved to f28069F family with fpu. At the beginning the project was created using IQ but i decided to use floating point because it is available. 

In the properties i have enabled: --float_suport=fpu32, Runtimesupport library: rts2800_fpu32.lib and in the file search patch rts2800_fpu32.lib is inluded. Also changed to floating point both libs: 2806xRevB_FastSpinROMSymbols_fpu32.lib and IQmath_fpu32.lib

I use eeprom to save motor parameters so i declared two function based on original but without using almost everything from header user.h

void USER_checkForErrorsEEPROM(USER_Params *pUserParams);

void USER_setParamsFromEEPROM(USER_Params *pUserParams);

The problem is with fpu division because it returns always 0. The compiler is the newest.

motor_cfg.Ls_d.Float is floating point value, in the expression menu i can see the correct value.

temp0..3 are global vlolatile variables also ftoat_t

I get user error because the division operation is not working.

for example temp2 is set to 0. Why?


  if(motor_cfg.data.motors[motor_cfg.data.ActiveMotorSet].param.Ls_d.Float != 0.0)
    {

      temp = 1.0f/(0.5 * (motor_cfg.data.motors[motor_cfg.data.ActiveMotorSet].param.Ls_d.Float + 1e-9) * USER_IQ_FULL_SCALE_CURRENT_A);
      temp1 = (128.0 * USER_IQ_FULL_SCALE_VOLTAGE_V / (float_t)temp);
      temp2 = 1.0 / motor_cfg.data.motors[motor_cfg.data.ActiveMotorSet].param.Ls_d.Float;
      temp3 = 2.0 * motor_cfg.data.motors[motor_cfg.data.ActiveMotorSet].param.Ls_d.Float;
      //if(((float_t)USER_CTRL_FREQ_Hz >= (128.0 * USER_IQ_FULL_SCALE_VOLTAGE_V / (0.5 * (USER_MOTOR_Ls_d + 1e-9) * USER_IQ_FULL_SCALE_CURRENT_A))))
      if(((float_t)USER_CTRL_FREQ_Hz >= (128.0 * USER_IQ_FULL_SCALE_VOLTAGE_V / temp)))
        {
          USER_setErrorCode(pUserParams, USER_ErrorCode_ctrlFreq_Hz_High);
        }
    }