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.

CCS/TMS320F28379S: C2000 Resolver Software Library - function resolver_algo_Float() has long timing

Part Number: TMS320F28379S


Tool/software: Code Composer Studio

Hello,

we are using the resolver interface software library like in the TI/IDDK_PM_Servo_F2837x example and have a problem with the timing of the library function resolver_algo_Float().

We are running with 200 MHz CPU clock frequency.

We call the resolver ISR with 160 kHz (6.25 µs) and thus also the resolver_algo_Float(), we have measured the timing of the ISR and have seen that it usually needs 1.6 µs, but every 16th is longer. Which means it needs up to 7 µs and this is longer than the timing from the ISR!

We also measured the timing from the functions:

resolver_algo_Float() ( 15x 500 ns and the 16th 5945 ns )

resolver_PostProcess() ( 700 ns which is also only every 16th active )

  • Hi Sterie,

    Thank you for your post. Your thread has been assigned to a C2000 expert and should be answered soon.

    Best regards,
    Chen
  • Hello.

    For controlling PMSM I use resolver libs.

    And I have same time  critical problems.

    I use DMA channel for getting adc data sin and cos signal.

    I have 160 kHz  conversion sample adc.

    I configure dma channel from adc to ram.

    buffer size for dma 16 word.

    After end of dma transmite I use resolver utilite:

    1 init dma transfer:

    void DMA_configure(void)
    {
    EALLOW;
    CpuSysRegs.SECMSEL.bit.PF1SEL = 1;
    EDIS;

    DMAInitialize();
    pointer_buf_dma_adc=0;
    DMADest = &buffer_dma_adc[0]; //Point DMA destination to the beginning of the array
    DMASource = &AdcaResultRegs.ADCRESULT0; //Point DMA source to ADC result register base
    DMACH1AddrConfig(DMADest,DMASource);
    DMACH1BurstConfig(16,1,1);
    DMACH1TransferConfig(15,0xFFF0,0);
    DMACH1WrapConfig(0xFFFF,800,0xFFFF,800);
    DMACH1ModeConfig(DMA_EPWM5A,PERINT_ENABLE,ONESHOT_DISABLE,CONT_DISABLE,SYNC_DISABLE,SYNC_SRC,OVRFLOW_DISABLE,SIXTEEN_BIT,CHINT_END,CHINT_ENABLE);
    StartDMACH1();

    }

    interrupt servise :   10 kHz

    __interrupt void local_DMACH1_ISR(void)
    {
    Led1_on
    proreg_can_log++;if(proreg_can_log>=2){proreg_can_log=0;}
    //----------------------------------------------------------------------------------
    // To receive more interrupts from this PIE group, acknowledge this interrupt
    pointer_buf_dma_adc++;
    if((pointer_buf_dma_adc&1)==0){DMADest=&buffer_dma_adc[0];}
    else{DMADest=&buffer_dma_adc1[0];}
    DMASource = &AdcaResultRegs.ADCRESULT0;
    DMACH1AddrConfig(DMADest,DMASource);
    EPwm5Regs.TBCTR=EPwm5Regs.TBPRD;
    EALLOW;DmaRegs.CH1.CONTROL.bit.RUN = 1;DmaRegs.CH2.CONTROL.bit.RUN = 1;EDIS;
    test_count2_low=EPwm1Regs.TBCTR;
    ServiceDog();
    // To receive more interrupts from this PIE group, acknowledge this interrupt
    EALLOW;PieCtrlRegs.PIEACK.all = PIEACK_GROUP7;EDIS;
    main_cicl();
    can_log_func();
    ena_i2c_read=1;
    if((proreg_can_log&1)==0){test_new_data();}
    if((proreg_can_log&1)==1){can_avto();}
    Led1_off
    test_count2_high=EPwm1Regs.TBCTR;
    }

    resolver conversion:

    i=0;
    while(i<16)
    {
    f_temp1=(int)(*(DMASource+(i<<4)+3));f_temp2=(int)(*(DMASource+(i<<4)+2));
    sensorSample+=(int)(*(DMASource+(i<<4)+13));
    rslvrOut.sineIndex = (rslvrOut.sineIndex-1) & (rslvrIn.TABLE_LENGTH-1);
    rslvrOut.sin_input=f_temp1-rslvrIn.offsetS;rslvrOut.cos_input=f_temp2-rslvrIn.offsetC;
    if(j!=0)
    {
    nakop_sine_offset+=f_temp1;nakop_cos_offset+=f_temp2;current_count_offset+=1.0;
    if(current_count_offset>=10000)
    {
    rslvrIn.offsetS=nakop_sine_offset*0.0001;rslvrIn.offsetC=nakop_cos_offset*0.0001;
    nakop_sine_offset=0;nakop_cos_offset=0;current_count_offset=0;
    }
    }
    if(bit3_test==0)
    {
    f_temp =(int)(*(DMASource+(i<<4)+0));
    current_pozit_write++;if(current_pozit_write>=size_buf_test){current_pozit_write=0;}
    test_sin_buf[current_pozit_write]=(int)(f_temp*0.1);//(rslvrOut.sin_input*0.5);
    test_cos_buf[current_pozit_write]=(int)(rslvrOut.cos_input*0.5);
    }
    resolver_algo_Float();
    i++;
    }