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/TMS320F28035: SFRA library and its GUI usage

Part Number: TMS320F28035
Other Parts Discussed in Thread: SFRA, CONTROLSUITE

Tool/software: Code Composer Studio

hello sir/madam,

recently, i work on 2 smps projects and i try to sfra lib to get the plant and open loop function.

it works on one, but failed on the other,

i have the following questions need your help to figure out.

1. there are 2 versions in the controlsuite, v1_10_00_00 and v1_20_00_00. What's the difference?

2. I import the SciCommsGui_32bit.c of v1_10_00_00 in my project and use the SFRA_GUI.exe in the same project to connect.

it always have the following alarm: "please  load a valid .a00 file". how to solve it?

and i tried SFRA_GUI.exe of v1_20_00_00, it connected perfectly.

3. i tried to import the SciCommsGui_32bit.c of v1_20_00_00 in my project, but there are some defines of header files, macros, function(like SCI_setConfig, SCIA_BASE, SCI_isTransmitterBusy) cannot be found.

and then i imported the example project in C:\ti\controlSUITE\libs\app_libs\SFRA\v1_20_00_00\examples\DPSWrkShpKit_SFRA_F28035, it fails to compile: 

>> Compilation failure
subdir_rules.mk:65: recipe for target 'SciCommsGui_32bit.obj' failed
"C:/ti/controlSUITE/libs/app_libs/SFRA/v1_20_00_00/GUI/SciCommsGui_32bit.c", line 15: fatal error: cannot open source file "driverlib.h"
1 catastrophic error detected in the compilation of "C:/ti/controlSUITE/libs/app_libs/SFRA/v1_20_00_00/GUI/SciCommsGui_32bit.c".
Compilation terminated.
gmake: *** [SciCommsGui_32bit.obj] Error 1
gmake: Target 'all' not remade because of errors.

i think you can have a try and guide me to a successful build.

4. i also have doubts on the data types of parameters for SFRA_IQ_INJECT() and  SFRA_IQ_COLLECT( , ).

do they use _IQ26 or something else? because i notice that "SFRA1.amplitude=_IQ26(0.01);" use the _IQ26.

but in some examples, _IQ24 is used.

do you have more information on this?

i am looking forward to your relay, thank you very much

  • after some debug and investigation, i update my question as follows, 1-3 is ok for now,please check it is correct or not, and help solve the 4th and 5th.

    1. there are 2 versions in the controlsuite, v1_10_00_00 and v1_20_00_00. What's the difference?

    me: v1_20_00_00 is designed for Mcus with driverlib. Unfortunately, 28035 is not supported.


    2. I import the SciCommsGui_32bit.c of v1_10_00_00 in my project and use the SFRA_GUI.exe in the same project to connect.

    it always have the following alarm: "please load a valid .a00 file". how to solve it?

    and i tried SFRA_GUI.exe of v1_20_00_00, it connected perfectly.

    me: the option for bootrom file shall be cancelled.

    3. i tried to import the SciCommsGui_32bit.c of v1_20_00_00 in my project, but there are some defines of header files, macros, function(like SCI_setConfig, SCIA_BASE, SCI_isTransmitterBusy) cannot be found.

    and then i imported the example project in C:\ti\controlSUITE\libs\app_libs\SFRA\v1_20_00_00\examples\DPSWrkShpKit_SFRA_F28035, it fails to compile:

    >> Compilation failure
    subdir_rules.mk:65: recipe for target 'SciCommsGui_32bit.obj' failed
    "C:/ti/controlSUITE/libs/app_libs/SFRA/v1_20_00_00/GUI/SciCommsGui_32bit.c", line 15: fatal error: cannot open source file "driverlib.h"
    1 catastrophic error detected in the compilation of "C:/ti/controlSUITE/libs/app_libs/SFRA/v1_20_00_00/GUI/SciCommsGui_32bit.c".
    Compilation terminated.
    gmake: *** [SciCommsGui_32bit.obj] Error 1
    gmake: Target 'all' not remade because of errors.

    i think you can have a try and guide me to a successful build.

    me: refer to Q1.

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    4. i also have doubts on the data types of parameters for SFRA_IQ_INJECT() and SFRA_IQ_COLLECT( , ).

    do they use _IQ26 or something else? because i notice that "SFRA1.amplitude=_IQ26(0.01);" use the _IQ26.

    but in some examples, _IQ24 is used.



    5. when the GUI is connected and i click to start sweep, it start just for a very short time, and then stuck in sweeping status.

    my code as Duty = SFRA_IQ_INJECT(PFC_i32OpenLoopDuty);, where PFC_i32OpenLoopDuty = _IQ24(0.44444);
    and i found when start sweeping , the duty go beyond 1.0 with IQ24 format.

    but i set SFRA1.amplitude=_IQ26(0.01); in the SFRA settting.

    Could you tell me any cases that Duty will go begond 1.0 in such setting?

    thank you very much!
  • 4. i also have doubts on the data types of parameters for SFRA_IQ_INJECT() and SFRA_IQ_COLLECT( , ).

    do they use _IQ26 or something else? because i notice that "SFRA1.amplitude=_IQ26(0.01);" use the _IQ26.

    but in some examples, _IQ24 is used.

    Overall, IQ24 is used for all the variables that SFRA reads, i.e. duty, control output, adc feedback etc. It is not possible to change this Q value. The amplitude is indeed IQ26, this is because it provides additional resolution and saves a few cycles in the SFRA_INJECT routine. 


    5. when the GUI is connected and i click to start sweep, it start just for a very short time, and then stuck in sweeping status.

    my code as Duty = SFRA_IQ_INJECT(PFC_i32OpenLoopDuty);, where PFC_i32OpenLoopDuty = _IQ24(0.44444); 
    and i found when start sweeping , the duty go beyond 1.0 with IQ24 format.

    but i set SFRA1.amplitude=_IQ26(0.01); in the SFRA settting.

    Could you tell me any cases that Duty will go begond 1.0 in such setting?

    thank you very much!

    Stuck in sweeping status can be due to SCI GUI comms issue, we do know there to be bugs in it, however there is no timeline associated with those bugs to be fixed yet. 

    You can check sfra object in the watch windoe and see if freqIndex is incrementing or not ?? 

    Make sure your BootROM table location is set correctly you can refer to C:\ti\controlSUITE\libs\app_libs\SFRA\v1_20_00_00\examples\DPSWrkShpKit_SFRA_F28035 CMD file for the correct location. 

  • thank you Manish Bhardwaj,

    yes, freqIndex is not increase but 0 during sweeping.

    i have checked the CMD file, i think it is ok because the tool chain works for another project.

    are there any other possibilities cause the problem?
  • more information, when seeping, freqindex is not increasing,

    the  SFRA1.state = 4 at end,

  • 1. Do you have the continuous refresh on when you do so on the watch window?

    2. Also what is the frequency value? 2Hz , 5Hz???

  • thank you again Manish Bhardwaj,

    finally i solve the problem. but i want to make clear about all the details.

    the reason caused the SFRA failed was that, i called a function to read ADC results before SFRA_IQ_INJECTION.

    when i comment this code and use a common way to get the ADC result instead, SFRA works.

    this function is combined with ADCDRV_4ch driver Digital Power Library called "ADCMACRO_RUN();"

    as the run time code of ADCDRV_4ch is a macro written in assemble language, i enclose it by a assemble c-callable function.

    and finally run it in a ISR triggered by end of ADC conversion.

    there is no warning during compilation and seems works if i do not run the SFRA.

    in my opinion, there maybe some problems in stack push and pop when run ADCMACRO_RUN();

    could you please help me

    1. find a way to use the ADCDRV_4ch driver in an C-written ISR correctly?

    2. check what's the root cause of the problem.

    code is as follow,

                 .sect "IsrRamfuncs"
                 .def _ADCMACRO_RUN
    _ADCMACRO_RUN:
                 ADCDRV_4ch 0,1,2,3 ; Run ADCDRV_4ch
                  LRETR


                 .def _PWMDRV_1chHiResMACRO_RUN
    _PWMDRV_1chHiResMACRO_RUN:
                 ;”Call” the Run macro
                 PWMDRV_1chHiRes 1 ; Run PWMDRV_1ch (Note EPWM1 is used for instance#1)
                 LRETR

    extern void ADCMACRO_RUN(void);

    interrupt void ADC_ISR(void)
    {

    ADCMACRO_RUN();

    PFC_i32Vin = ADRlt_PH1 - ADRlt_PH2;
    PFC_i32VinABS = _IQabs(PFC_i32Vin);

    if(PFC_i32Enable == 1)
    {

    PFC_i32SFRAOpenLoopDuty = SFRA_IQ_INJECT(PFC_i32OpenLoopDuty);

    //PWMDRV_1chHiResMACRO_RUN();
    EPwm1Regs.CMPAM.all = _IQ16mpyI32(_IQtoIQ16(PFC_i32SFRAOpenLoopDuty), ISR_PERIOD);
    //CMPA

    SFRA_IQ_COLLECT(&PFC_i32SFRAOpenLoopDuty,&GVADRlt_VB);
    }

    Test_RunTimeElapse1 = EPwm1Regs.TBCTR - Test_RunTime1;
    AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge this int to receive more int from group 3
    }

    thank you very much in advance.

  • here is a example code for run-time assemble macro,
    some registers have to be protected.


    ; Digital Power library - Interrupt Service Routine

    ; label to DPL Func Run function
    .def _DPL_Func

    .sect "ramfuncs"


    _DPL_Func:
    ; context save - push any unprotected registers onto stack
    PUSH XAR1
    PUSH XAR2
    PUSH XAR3
    ;-----------------------------------------------------------------------------------------

    ; call DP library modules
    ;---------------------------------------------------------
    .if(INCR_BUILD = 1)
    ;ADCDRV_1ch 1 ; Ipfc
    ;ADCDRV_1ch 2 ; Vpfc
    ;ADCDRV_1ch 3 ; VL_fb
    ;ADCDRV_1ch 4 ; VN_fb

    ;ADCDRV_1ch 1 ; Ipfc
    ;ADCDRV_1ch 2 ; Ipfc
    ;ADCDRV_1ch 3 ; Ipfc
    ;ADCDRV_1ch 4 ; Ipfc
    ;ADCDRV_1ch 5 ; Vpfc
    ;ADCDRV_1ch 6 ; VL_fb
    ;ADCDRV_1ch 7 ; VN_fb

    ADCDRV_1ch 1 ; Ipfc
    ADCDRV_1ch 2 ; Ipfc
    ADCDRV_1ch 3 ; Ipfc
    ADCDRV_1ch 4 ; Ipfc
    ADCDRV_1ch 5 ; Ipfc
    ADCDRV_1ch 6 ; Ipfc
    ADCDRV_1ch 7 ; Ipfc
    ADCDRV_1ch 8 ; Ipfc
    ADCDRV_1ch 9 ; Vpfc
    ADCDRV_1ch 10 ; VL_fb
    ADCDRV_1ch 11 ; VN_fb

    ;Subtract Ipfc CS amplifier offset and calculate Ipfc filtered
    MOVW DP, #_AdcResult ; load Data Page to read ADC results
    ;MOV ACC, @_AdcResult.ADCRESULT1<<12 ; ACC = IL_raw
    ;Commented the above for testing oversampling

    ;Test code for oversampling***********
    ;MOV ACC, @_AdcResult.ADCRESULT1<<10 ; ACC = IL_raw, Q24/4
    ;ADD ACC, @_AdcResult.ADCRESULT2<<10 ;Q24/4
    ;ADD ACC, @_AdcResult.ADCRESULT3<<10 ;Q24/4
    ;ADD ACC, @_AdcResult.ADCRESULT4<<10 ;Q24/4, Add 4 samples of current,4*(Q24/4) = Q24

    MOV ACC, @_AdcResult.ADCRESULT1<<9 ; ACC = IL_raw, Q24/8
    ADD ACC, @_AdcResult.ADCRESULT2<<9 ;Q24/8
    ADD ACC, @_AdcResult.ADCRESULT3<<9 ;Q24/8
    ADD ACC, @_AdcResult.ADCRESULT4<<9 ;Q24/8
    ADD ACC, @_AdcResult.ADCRESULT5<<9 ;Q24/8
    ADD ACC, @_AdcResult.ADCRESULT6<<9 ;Q24/8
    ADD ACC, @_AdcResult.ADCRESULT7<<9 ;Q24/8
    ADD ACC, @_AdcResult.ADCRESULT8<<9 ;Q24/8, Add 8 samples of current,8*(Q24/8) = Q24



    ;-----------------------------------------------------------------------------------------
    ; full context restore
    ; SETC INTM ; set INTM to protect context restore
    POP XAR3
    POP XAR2
    POP XAR1
    LRETR ; return from function
    .end

    ; end of file