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.

TMS320F28377S: Using SFRA Without SFRA GUI Integration

Part Number: TMS320F28377S
Other Parts Discussed in Thread: SFRA

Hello,

I am trying to integrate SFRA library in my project and then use it to perform frequency response analysis without using SFRA GUI Integration.

I followed the instructions in the SFRA User Guide :www.ti.com/.../spruik4a.pdf and managed to import the library.

Since I want to use the SFRA without the GUI, I had to follow the steps at Chapter 7 (starting at page 33).

The issue that I encountered is at steps 5-7: when I set SFRA_OBJ.start to 1, I cannot observe the SFRA_OBJ.FreqIndex increment from 0 to to Vec_Length ( which in my case is 100). 

Can you please help me?

Best regards,

Evelyn Lovasz

  • Evelyn,

    there must be some challenge in intergrating the library, 

    1. Please make sure SFRA inject and collect are being called in the ISR 

    2. Are you using the TMU version of the library, if not i will recommend using TMU version of the library

    -Manish

  • Hello Manish,

     

    1. Yes, both inject and collect are called in the PWM Update ISR. Every time the ISR is run, the variable duty_pu (representing the perturbed duty cycle) is updated by SFRA_F32_inject. I guess that the collect function doesn't work as it should. 

     

    Fullscreen
    1
    2
    3
    4
    5
    6
    duty_pu_DC = 0.25; // for test purposes
    duty_pu = SFRA_F32_inject(duty_pu_DC);
    //DAC_vSetDacA((Uint32)&duty_pu_DC,4095,0);
    PWMEMU_stPWM_MasterSlaveControl.stDuty.PWMEMU_Duty_Cycle_Slave4 = duty_pu*100; // update PWM duty cycle Q1
    PWMEMU_stPWM_MasterSlaveControl.stDuty.PWMEMU_Duty_Cycle_Slave1 = duty_pu*100; // update PWM duty cycle Q2
    SFRA_F32_collect(&duty_pu , &ADC_stADCResult.fV12_U_OUT);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    2. I am using the TMU COFF version of the SFRA library, as shown below:

    Evelyn

  • evelyn, do you see the duty_pu change when the sweep is started? 

    I will also recommend typecasting 

    SFRA_F32_collect((float32_t*)&duty_pu, (float32_t*)&ADC_stADCResult.fV12_U_OUT)

  • Hello Manish,

    Yes, the duty_pu is changing every time when inject function is called. The state remains 2 (I have seen in another sample project using the SFRA library, that this state variable changes quite often between 1 and 5 when SFRA is performed). I used the typecasting you suggested, but the problem still remains.

  • Hello Manish,

    I made the SFRA work. I have made one big mistake: the background task was running faster than the PWM update ISR. 

    Thank you again for your help!