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.

TMS320F28388D: Using undefined motor in FCL library

Part Number: TMS320F28388D
Other Parts Discussed in Thread: TMDXIDDK379D, C2000WARE

Greetings,

I am running the FCL project using the 28388 MCU in my own experimental board.

I have a different spec motor that doesn't exist in the FCL code. (Not ESTUN_EMJ04APB222, TEKNIC_2310PLN04K !!)

I have 3phase AC Servo Motor with T-format Encoder. So I want to run this motor with your FCL code.

I have modified some codes in fcl_f2838x_tmdxiddk_settings_cpu1.h

//
// set the motor parameters to the one available
//
#define ESTUN_EMJ04APB222 1
#define TEKNIC_2310PLN04K 2
#define TSM3003_N7364_E600 3    // modified

// #define USER_MOTOR ESTUN_EMJ04APB222 //TEKNIC_2310PLN04K //
#define USER_MOTOR TSM3003_N7364_E600 // modified

//
// Define the electrical motor parameters (Tamagawa Servomotor) // modified
//
#if(USER_MOTOR == TSM3003_N7364_E600)
#define RS 2.35 // Stator resistance (ohm)
#define RR NULL // Rotor resistance (ohm)
#define LS 0.0065 // Stator inductance (H)
#define LR NULL // Rotor inductance (H)
#define LM NULL // Magnetizing inductance (H)
#define POLES 8 // Number of poles
#define ENC_SLOTS 2500 // Numer of slots in the encoder

#define M_ID_START 0.1 // alignment reference d-axis current
#define M_IQ_LI5 0.05 // reference q-axis current for level5
#define M_IQ_LN5 0.03 // ref q-axis current for no level5

/* Parameters are not exactly specified. */

But when rebuilding it, results in 29 errors in [sources --> fcl_f2838x_tmdxiddk_cpu1.c]

" C:/ti/c2000/C2000Ware_MotorControl_SDK_3_02_00_00/solutions/tmdxiddk379d/f2838x/include/fcl_f2838x_tmdxiddk_settings_cpu1.h", line 47: error #38: the #endif for this directive is missing"

"C:/ti/c2000/C2000Ware_MotorControl_SDK_3_02_00_00/solutions/tmdxiddk379d/f2838x/source/fcl_f2838x_tmdxiddk_cpu1.c", line 347: error #60: function call is not allowed in a constant expression"

"C:/ti/c2000/C2000Ware_MotorControl_SDK_3_02_00_00/solutions/tmdxiddk379d/f2838x/source/fcl_f2838x_tmdxiddk_cpu1.c", line 420: error #20: identifier "M_ID_START" is undefined"

" gmake : Target 'all' not remade because of errors."

and so on.....

I think I should modify some codes in [user.h] file but I couldn't find that file.... because of this code

#ifndef USER_MOTOR
#error Motor type is not defined in user.h
#endif

Tell me how to drive my motor with your code!

  • You might refer to the code below for adding your motor.

    //
    // set the motor parameters to the one available
    //
    #define ESTUN_EMJ04APB222        1
    #define TEKNIC_2310PLN04K        2
    #define TSM3003_N7364_E600       3
    
    #define USER_MOTOR               TSM3003_N7364_E600 //TEKNIC_2310PLN04K  // ESTUN_EMJ04APB222   //
    
    //
    // Define the electrical motor parameters (Estun Servomotor)
    //
    #if(USER_MOTOR == ESTUN_EMJ04APB222)
    #define RS          2.35                // Stator resistance (ohm)
    #define RR          NULL                // Rotor resistance (ohm)
    #define LS          0.0065              // Stator inductance (H)
    #define LR          NULL                // Rotor inductance (H)
    #define LM          NULL                // Magnetizing inductance (H)
    #define POLES       8                   // Number of poles
    #define ENC_SLOTS   2500                // Numer of slots in the encoder
    
    #define M_ID_START  0.1                 // alignment reference d-axis current
    #define M_IQ_LI5    0.05                // reference q-axis current for level5
    #define M_IQ_LN5    0.03                // ref q-axis current for no level5
    
    //
    // Define the electrical motor parameters (Teknic Servomotor)
    //
    #elif(USER_MOTOR == TEKNIC_2310PLN04K)
    #define RS          0.381334811         // Stator resistance (ohm)
    #define RR          NULL                // Rotor resistance (ohm)
    #define LS          0.000169791776      // Stator inductance (H)
    #define LR          NULL                // Rotor inductance (H)
    #define LM          NULL                // Magnetizing inductance (H)
    #define FLUX        0.0398557819        // BEMF constant (V/Hz)
    #define POLES       8                   // Number of poles
    #define ENC_SLOTS   1000                // Numer of slots in the encoder
    
    #define M_ID_START  0.2                 // alignment reference d-axis current
    #define M_IQ_LI5    0.10                // reference q-axis current for level5
    #define M_IQ_LN5    0.10                // ref q-axis current for no level5
    
    #elif(USER_MOTOR == TSM3003_N7364_E600)
    
    #define RS 2.35             // Stator resistance (ohm)
    #define RR NULL             // Rotor resistance (ohm)
    #define LS 0.0065           // Stator inductance (H)
    #define LR NULL             // Rotor inductance (H)
    #define LM NULL             // Magnetizing inductance (H)
    #define POLES 8             // Number of poles
    #define ENC_SLOTS 2500      // Numer of slots in the encoder
    
    #define M_ID_START 0.1      // alignment reference d-axis current
    #define M_IQ_LI5 0.05       // reference q-axis current for level5
    #define M_IQ_LN5 0.03       // ref q-axis current for no level5
    
    #else
    #error No motor type specified
    #endif
    
    #ifndef USER_MOTOR
    #error Motor type is not defined in user.h
    #endif