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.

segmentation fault while processing function _smopos_calc file smopos.c line 46

Other Parts Discussed in Thread: CCSTUDIO

Hi

I am using source code PMSM3_2 (spcc128) for Sensorless Vector Control of PMSM motor and while compiling I am getting the following error:

-----------------------  pmsm3_2_281x_CCS3x.pjt - Debug  -----------------------
[smopos.c] "C:\CCStudio_v3.1\C2000\cgtools\bin\cl2000" -g -q -fr"../obj" -i"./include" -i"../include" -i"../../../../lib/dmclib/cIQmath/include" -i"../../../../lib/drvlib280x/include" -i"../../../../lib/drvlib281x/include" -i"../../../../../../../c28/dsp281x/v100/DSP281x_headers/cmd" -i"../../../../../../../c28/dsp281x/v100/DSP281x_headers/include" -i"../../../../../../../c28/dsp281x/v100/DSP281x_common/include" -i"../../../../../../../c28/dsp281x/v100/DSP281x_examples/include" -i"../../../../../../../c28/dsp280x/v110/DSP280x_common/include" -i"../../../../../../../c28/dsp280x/v110/DSP280x_examples/include" -i"../../DSP281x_headers/include" -d"_DEBUG" -d"LARGE_MODEL" -d"TARGET_IS_F2812" -ml -v28 -@"../build/Debug.lkf" "smopos.c"
 
INTERNAL ERROR: C:\CCStudio_v3.1\C2000\cgtools\bin\cg2000.exe experienced a segmentation fault while
                processing function _smopos_calc file smopos.c line 46
 
This is a serious problem.  Please contact Customer
Support with this message and a copy of the input file
and help us to continue to make the tools more robust.
 
 
>> Compilation failure
 
[Linking...] "C:\CCStudio_v3.1\C2000\cgtools\bin\cl2000" -@"Debug.lkf"
<Linking>
>> TI5203:   error: system error, can't open file
                    'C:\tidcs\DMC\c28\v32x\sys\pmsm3_2_281x\cIQmath\obj\smopos.obj' for input: No such file or directory
 
 
>> Compilation failure
 
Build Complete,
  2 Errors, 0 Warnings, 0 Remarks.

The code on line 46 in smopos.c is

    else if (v->IalphaError <= -E0)     ... Line 46
       v->Zalpha = -v->Kslide;             .... Line 47


I found no mistakes in the code as such but while compiling the whole program I am getting error TI5203. Even if I comment the section it gives error for other lines of the code. Somehow smopos.c file doesnt work.


Can you suggest steps to compile this code along with smopos.c ?.. I have attached the source file smopos.c for reference..

/*=====================================================================================
 File name:        SMOPOS.C  (IQ version)                  
                    
 Originator:	Digital Control Systems Group
			Texas Instruments

 Description:  Rotor Position Estimator of PMSM using Sliding-Mode Theory                 

=====================================================================================
 History:
-------------------------------------------------------------------------------------
 04-15-2005	Version 3.20
-------------------------------------------------------------------------------------*/

#include "IQmathLib.h"         // Include header for IQmath library 
// Don't forget to set a proper GLOBAL_Q in "IQmathLib.h" file 
#include "dmctype.h"
#include "smopos.h"

void smopos_calc(SMOPOS *v)
{	
    _iq E0;
    
    E0 = _IQ(0.5);
    
// Sliding mode current observer
    v->EstIalpha = _IQmpy(v->Fsmopos,v->EstIalpha) + _IQmpy(v->Gsmopos,(v->Valpha-v->Ealpha-v->Zalpha));
    v->EstIbeta = _IQmpy(v->Fsmopos,v->EstIbeta) + _IQmpy(v->Gsmopos,(v->Vbeta-v->Ebeta-v->Zbeta));

// Current errors
    v->IalphaError = v->EstIalpha - v->Ialpha;
    v->IbetaError = v->EstIbeta - v->Ibeta;

// Sliding control calculator
    if (_IQabs(v->IalphaError) < E0)
       v->Zalpha = _IQmpy(v->Kslide,_IQdiv(v->IalphaError,E0));  
    else if (v->IalphaError >= E0) 
       v->Zalpha = v->Kslide;
    else if (v->IalphaError <= -E0) 
       v->Zalpha = -v->Kslide;

    if (_IQabs(v->IbetaError) < E0)
       v->Zbeta = _IQmpy(v->Kslide,_IQdiv(v->IbetaError,E0));  
    else if (v->IbetaError >= E0) 
       v->Zbeta = v->Kslide;
    else if (v->IbetaError <= -E0) 
       v->Zbeta = -v->Kslide;

// Sliding control filter -> back EMF calculator
    v->Ealpha = v->Ealpha + _IQmpy(v->Kslf,(v->Zalpha-v->Ealpha));
    v->Ebeta = v->Ebeta + _IQmpy(v->Kslf,(v->Zbeta-v->Ebeta));

// Rotor angle calculator -> Theta = atan(-Ealpha,Ebeta)
    v->Theta = _IQatan2PU(-v->Ealpha,v->Ebeta); 
}



Thanks,

Hrishikesh Mehta