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.

TMS320F280039C: Sensored FOC_TMS320F280039C

Part Number: TMS320F280039C
Other Parts Discussed in Thread: CONTROLSUITE

Hi Luo,

This is the continuation for the below thread 


https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1118285/tms320f280039c-sensor-encoder-based-foc-for-pmsm?tisearch=e2e-sitesearch&keymatch=%252520user%25253A461371#

Hi thanks for the reply,

1. We followed the above document, and we successfully ported the code to 49c, and we spin the motor by using FAST and with Encoder (FYI: we spin the Estun_EMJ_04APB22_A motor with HV-kit).

2. As you already known that in HV-Kit there is only provision to connect Encoder A, B, R ( to Eqep).

And we observed that in the universal lab code rotor angle is calculated based on the pulse count (EQEP count).

3.We need to calculate the rotor position based on the encoder analog  signals (C, D)(sine and cos signals).
4. Is there any example code to calculate the rotor position from encoder analog signals ?

  • 2. As you already known that in HV-Kit there is only provision to connect Encoder A, B, R ( to Eqep).

    Incremental encoder with A/B/I(Z) connected to QEP of the C2000. The QEP in the universal lab is using the Quadrature Decoder Unit that need A, B & I input signals.

    3.We need to calculate the rotor position based on the encoder analog  signals (C, D)(sine and cos signals).
    4. Is there any example code to calculate the rotor position from encoder analog signals ?

    Currently, there is no such example in Universal Lab and motor control SDK. We plan to support such encoder in next version, may be early next year.

  • Hi Luo thanks for the reply,

    1.We have got the Example project from controlsuite in below path
    " C:\ti\controlSUITE\libs\app_libs\position_manager\v01_00_00_00\sincos\examples\PM_sincos_example "
    2.we referred the app notes given in below path 
    " C:\ti\controlSUITE\libs\app_libs\position_manager\v01_00_00_00\sincos\Doc"
    3.From the #1,#2 we decided to use that PM_sincos library.

    4. I have added that library to my project ( code is shown in below).

    a.Include files image

    b.

    #include "common.h"
    #include "F28x_Project.h"
    #include "main.h"
    void main(void)
    {
    
        Device_init();
        Device_initGPIO();
        enableInterrupts();
        init_gpio();
        init_ADCs();
        InitPWM();
        initADCSOC();
        uart0_init();
        sincos_init();      
        PM_sincos_initLib(&mySincos);  //library function 
        Interrupt_RegisterEnable();
        EINT;
        ERTM;
        while (1)
        {
    
        }
    }
    __interrupt void adcA1ISR(void)
    {
    
        Read_ADCdata();
        clear_ADCinterrupts();
    
    }
    void enableInterrupts(void)
    {
        Interrupt_initModule();
        Interrupt_initVectorTable();
    
    }
    void Interrupt_RegisterEnable(void)
    {
        Interrupt_register(INT_ADCA1, &adcA1ISR);
    
        Interrupt_enable(INT_ADCA1);
    
    }

    5.But I am getting the error shown in below 


    6.Is it possible to use that PM_sincos library for 39c controller ?

  • 6.Is it possible to use that PM_sincos library for 39c controller ?

    Yes, you can refer to the example code, and port it for F280039C.

    5.But I am getting the error shown in below 

    You may use the example in this folder that could be easily ported for F280039C. And you just need to use the "PM_sincos_lib.c" and "PM_sincos_lib.h" files.

  • Hi Luo thanks for the reply

    1.We successfully ported that PM_sincos code to 280039c controller

    2.Is there any reference document on PM_sincos library? (other than documents given in controlsuite)

    3.In that example code we didn't understand what is the reason for EQEP initialization ? and how the angle is calculated based on the sin and cos signals ADC readings ?

  • Hi,

    The subject expert is out of office today.  Please expect response by Monday.

    Thanks & Regards,

    Santosh

  • 2.Is there any reference document on PM_sincos library? (other than documents given in controlsuite)

    Not yet. But you can take a look at the TID as the link below.

    https://www.ti.com/tool/TIDA-00176 

    TI Designs Interface to Sin/Cos Encoders With High-Resolution Position Interpolation

    3.In that example code we didn't understand what is the reason for EQEP initialization ? and how the angle is calculated based on the sin and cos signals ADC readings ?

    Some of the Sin/Cos encoder output the incremental signals A and B and the zero signal R, and the one sine wave C and D period per revolution. The A, B and R can be converted to the signals connected to QEP as shown in the TID above.