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/SFRA: SFRA for PSFB control by using F28035

Part Number: SFRA
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Dear experts:

I have been porting the SFRA Library into my project recently, but there seems to be some problems with the results I got from the GUI when I did the open loop frequency sweep. Would you please be kindly enough to help me fix it.

My project is a DC/DC converter using the phase-shifted full bridge circuit, and the MCU is F28035 with 47kHz PWM frequency, and the program was modified from TI's example(HVPSFB).

I’m trying to use the SFRA tools to get the open loop with peak current mode control of converter.

The GUI can connected and start sweep. The problem is that when sweep is end, GUI  shows "Unhandled exception has occurred in your application".And the information in the CVS file is incomplete,

I have below code in my 47K ISR.

interrupt void DPL_ISR_wFRA(void)
{
    if(EPwm1Regs.TBSTS.bit.CTRDIR == 0)
    {
        Vout_Ref_wInj = SFRA_IQ_INJECT(Iref);
        DPL_Func();
        SFRA_IQ_COLLECT(&Vout_Ref_wInj,&Avg_Vout);
    }
    else
    {
        DPL_Func();
    }
    EPwm1Regs.ETCLR.bit.INT=1;
    PieCtrlRegs.PIEACK.bit.ACK3=0x1;
}

and DACDRV macro : DACDRV_RAMP_In1 = &Vout_Ref_wInj;

I’m wondering is there something wrong with my implement. Please help me. Thanks.

  • Ku,

    There are two components to the SFRA tool

    1. SFRA lib
    2. SFRA GUI

    The issue you have reported above is related to the SFRA GUI.

    As a first step towards the debug can you start by initiating a sweep through the watch window by writing a "1" to the SFRA start variable.

    The process is documented in the new SFRAlib UG, see section Using SFRA without SFRA GUI integration


    www.ti.com/.../spruik4.pdf
  • thank you Manish Bhardwaj,

    I use this way "Using SFRA without SFRA GUI integration" to run SFRA, and get some data at open loop status.

    But the data is not normal.

    I wonder if this is related to the warning which generated after the project is compiled. And my CCS version is 7.4.

    Do you think the two are related?  If no, how can I get the right data?

  • Ku, 

    The warning that you are getting is because of IQmath.lib was built with an older compiler and we added some additional settings in the new compiler, one will get that warning. It is not the root cause of the issue. 

    To understand the issue further, now that we have eliminated the GUI from the picture, there can be two sources of errors:

    1. SFRA integration into the project, pertaining to the SFRA Module usage -> these are issues that SFRA was not initialized properly etc

    2. The system interface with SFRA module -> these can be system level bugs like injection not at the right variable, or it not being the same type. 

    Let's first focus on 1. 

    For 1, we provide a software test bench example, you can also follow the same approach.

    Use the CNTL_PI_IQ module from the TI Solar lib inside controlSUITE , it is located at 

    C:\ti\controlSUITE\libs\app_libs\solar\v1.2\IQ\include

    Step 1 – Add library header file to {ProjectName}-Includes.h
    Link Solar Library: (Solar_Lib_IQ.lib) located in: controlSUITE\development\libs\app_libs\solar\v1.2\IQ\lib

    #include “Solar_IQ.h"

    Step 2 – Create and add module structure to {ProjectName}-Main.c

    CNTL_PI_IQ cntl_pi1;

    long stb_ref=_IQ(0.2);

    long stb_fdbk=0;

    Step 3 – Initialize module in {ProjectName}-Main.c

    CNTL_PI_IQ_init(&cntl_pi1);
    cntl_pi1.Ki = _IQ(0.0020000510);
    cntl_pi1.Kp = _IQ( 0.3496503407);

    Step 4 – Using the module

    interrupt void DPL_ISR_wFRA(void)
    {

    cntl_pi1.Ref = SFRA_IQ_INJECT(stb_ref);;
    cntl_pi1.Fbk = cntl_pi.Out;
    CNTL_PI_IQ_FUNC(&cntl_pi1);

    SFRA_IQ_COLLECT(cntl_pi.Out,cntl_pi.Fbk);

    cntl_pi.Fbk=cntl_pi.Out;


        EPwm1Regs.ETCLR.bit.INT=1;
        PieCtrlRegs.PIEACK.bit.ACK3=0x1;

    }

    This bypasses the PSFB code, and when you run it you can initaite a sweep  (you can use the GUI as well) and see if this works , this will help identify if there are issues with the SFRA lib integration into the project.

    One thing i noticed, is the below code for open loop??? 

        Vout_Ref_wInj = SFRA_IQ_INJECT(Iref);
            DPL_Func();
            SFRA_IQ_COLLECT(&Vout_Ref_wInj,&Avg_Vout);

    ..

    Next in the main function before calling the interrupts

     

    you can use 

    Now let's focus on the SFRA data that you got, as this is IQmath the data is in Q16,  

  • What i have provided you above is the STB example as described in www.ti.com/.../spruik4.pdf
    but as that documents applies to floating point devices , I have interpreted it for the fixed point devices above.
  • Dear Manish,

    Yes, I am test for open loop now.

    Iref is a command, and Vout_Ref_wInj  is input of DAC module used in DPL_Func().

    // DAC connections
    DACDRV_RAMP_In1 = &Vout_Ref_wInj;            // Controls the DAC reference voltage

    What does it mean about "Next in the main function before calling the interrupts"?

    Can you speak more in detail? Thanks.

  • Dear Manish,

    I'm done the bench test for 1(use the CNTL_PI_IQ module).

    The result like this:

      

    Frequency (Hz) OL Magnitude (dB) OL Phase (Deg) Plant Magnitude (dB) Plant Phase (Deg)
    100 -22475 0 -22475 0
    105.9254 -22475 0 -22475 0
    112.2019 -22475 0 -22475 0
    118.8503 -22475 0 -22475 0
    125.8927 -22475 0 -22475 0
    133.3524 -22475 0 -22475 0
    141.254 -22475 0 -22475 0
    149.6239 -22475 0 -22475 0
    158.4897 -22475 0 -22475 0
    167.8809 -22475 0 -22475 0

    Is it right?

  • I made a small mistake in the snippet i shared above, can you try with

    SFRA_IQ_COLLECT(&cntl_pi.Out,&cntl_pi.Fbk);

    Also make sure the IQmath table are correct for F28035 it should be

    /* IQ Math Tables in Boot ROM */ IQTABLES : origin = 0x3FE000, length = 0x000B50

  • Yes, I'm sure the IQmath table are correct for F28035

    The result of test:

  • Ku, with the above test, I can say SFRA lib is working. You can check the plant too, it will be similar to a PI.

    as shown in , the magnitude and location may be different because of different coefficients and ISR rate.

    Now this being said, the issue is now in how SFRA is interfacing with the application i.e. issue 2.  

    1. SFRA integration into the project, pertaining to the SFRA Module usage -> these are issues that SFRA was not initialized properly etc

    2. The system interface with SFRA module -> these can be system level bugs like injection not at the right variable, or it not being the same type.

    Some thing strange I saw in your ISR

      if(EPwm1Regs.TBSTS.bit.CTRDIR == 0)
        {
            Vout_Ref_wInj = SFRA_IQ_INJECT(Iref);
            DPL_Func();
            SFRA_IQ_COLLECT(&Vout_Ref_wInj,&Avg_Vout);
        }
        else
        {
            DPL_Func(); 
        }

    Why do you have a if for the same function execution.. ?

    can you change this to 

            Vout_Ref_wInj = SFRA_IQ_INJECT(Iref);
            DPL_Func();
            SFRA_IQ_COLLECT(&Vout_Ref_wInj,&Avg_Vout);
      

  • Hi Ku,

    I understand why you have the code in the ISR that Manish mentioned. The if - else part is present in the original code (asm file). The ISR runs twice in every switching cycle but the control code only executes once. The only thing here is to make sure that the SFRA inject is being called in the ISR instance that will run the control code and not the other instance where it won’t. 

    I hope this helps.

    Hrishi

  • Hi Hrishi & Manish,

    In the example code of PSFB, the ISR runs twice in every switching cycle but the control code only executes once.

    The control flow(HVPSFB_User's Guide_v1.1) like this:

    In the previous test, SFRA inject is being called in the "Counting Down mode".(EPwm1Regs.TBSTS.bit.CTRDIR == 0).

    I had try to call SFRA inject in the Counting Up mode when open loop, but it seems no effect.

    Do you have any Idea? If you need, I could provide you some more information.

  • Hi,

    When you have SFRA integrated in your project this way, does the converter still work properly in open loop? I ask this because there is quite a bit of time-critical code that is executed inside the ISR. I want to make sure that after integrating SFRA into this code the basic PCMC algorithm has not broken. If it has (broken), then the timing for ISR triggering will need to be adjusted along with some of the other parameters inside the ISR.

    The other thing I want to be sure of is that the Vout feedback is being correctly read by the ADC. If you already have a project with closed voltage loop working without SFRA, then you can ignore this comment.

    Hrishi

  • Hi Hrishi,

    After integrating SFRA into this code, I adjusted the time to enter the ISR.(only the value of trig_up&down variables)

    When SFRA start sweeping, the value of Vout_Ref_wInj is changing and Vout is ring but still have output.

    After a while, the value of Vout_Ref_wInj is static,  and Vout is stable but still have output.

    So I think the converter still working when SFRA sweeping, and PCMC algorithm has not broken.

    What does it mean when the state of SFRA structure is equal to 2 or 3?

  • Add the waveform of Vout and Vout_adc.

    SFRA starts sweeping:

    After a while, the value of Vout_Ref_wInj is static,  and Vout:

    For your reference, thanks.

  • Ku,

    Looks like SFRA is working correctly, as I see sinusoidal injection. Between frequency points there is a dwell time and hence the no disturbance period.

    Can you see the variables in the IQ24 format.

    Also can you also see PlantMagVect and Phase Vect in the watch window in IQ16 format ?

    I do know your GUI is crashing, but the GUI can crash if the frequency response data is not well formed. This is a known bug in the GUI. UNfortunately with no immediate fix.

    However the main issue at hand is of the response being plotted is correct or not. Hence can you watch it in IQ16 format and post your watch window expressions here.
  • Hi Manish,

    This is the beginning of sweep, and the variables is in the IQ24 format

    After a while, Vout_Ref_wInj will equal Iref and not change again(static). ,  Vout is stable but still have output.

    The result of each sweep is almost like this: (in IQ16 format)

    Frequency (Hz) OL Magnitude (dB) OL Phase (Deg) Plant Magnitude (dB) Plant Phase (Deg)
    100 3.77355957 -148.7202148 5.051864624 -36.95252991
    105.9254074 3.209213257 -133.2885742 1.229797363 19.82305908
    112.2019196 -6.080230713 -106.7231903 -9.456329346 -87.91339111
    118.8503342 1.19744873 -110.9082794 -1.17918396 -55.06291199
    125.8927002 5.928466797 -141.6281738 5.192626953 16.59963989
    133.352356 -0.297424316 -67.18458557 -1.758895874 -54.32591248
    141.2540283 -11.95210266 -105.8209381 -11.61865234 -91.19187927
    149.6239014 2.02116394 -141.5696106 3.026855469 -51.56761169
    158.4897308 -0.364746094 -149.9660339 -0.12789917 -36.54600525
    167.8808899 -12.42884827 -97.50930786 -12.14097595 -87.75427246
    177.8285065 -2.901351929 -104.9265747 -3.484909058 -64.62298584
    188.3655701 -0.096099854 -51.99511719 1.925079346 -53.24707031
    0 5.790756226 180.0004883 11.68954468 5.806854248
    0 -0.000137329 0 11.68954468 0
    0 0 0 11.73406982 5.807723999
    0 0 0 11.73406982 5.807723999
    0 0 180.0004883 6.020706177 0
    0 0 0 11.69842529 0
    0 -0.000137329 180.0004883 11.68914795 0
    0 0 180.0004883 11.68940735 0
    0 -0.000137329 180.0004883 11.73381042 5.807723999
    0 0 180.0004883 11.7336731 5.807723999
    0 0 180.0004883 11.68901062 0
    0 0 180.0004883 11.73406982 5.807723999
    0 -0.000137329 180.0004883 11.68887329 0
    0 0.026367188 180.0004883 -22475 0
    0 -0.000137329 180.0004883 11.66819763 0
    0 0 180.0004883 11.68980408 0
    0 0 180.0004883 11.68954468 0
    0 0 0 11.68954468 0
    0 0 180.0004883 11.73420715 5.806854248
    0 0 180.0004883 6.020706177 0
    0 0 0 11.69815063 0
    0 0 180.0004883 11.7336731 5.807723999
    0 -0.000137329 180.0004883 11.68914795 0
    0 -6.020721436 180.0004883 11.7336731 5.807723999
    0 0 0 11.69761658 0
    0 0 180.0004883 11.7336731 5.807723999
    0 0 180.0004883 11.7339325 5.807723999
    0 0 180.0004883 11.68940735 0
    0 -22475 0 11.73381042 5.807723999
    0 0 180.0004883 12.04129028 0
    0 0 180.0004883 11.7334137 5.807723999
    0 0 180.0004883 12.04129028 0
    0 0 180.0004883 11.68927002 5.807723999
    0 0 180.0004883 11.68927002 0
    0 0 180.0004883 11.68940735 0
    0 0 180.0004883 11.69006348 5.806854248
    0 0 180.0004883 11.73460388 5.806854248
    0 0 180.0004883 6.020706177 0
    0 0 0 11.69828796 0
    0 0 180.0004883 11.68927002 0
    0 -0.000137329 180.0004883 11.73381042 5.807723999
    0 0 180.0004883 11.73313904 5.807723999
    0 0 180.0004883 11.68861389 0
    0 0 180.0004883 11.68861389 0
    0 -0.000137329 180.0004883 11.68875122 0
    0 -0.000137329 180.0004883 11.68940735 0
    0 0 180.0004883 11.68901062 0
    0 0 180.0004883 11.68875122 0
    0 0 180.0004883 11.7336731 5.807723999
    0 0 180.0004883 11.68914795 0
    0 -6.020721436 180.0004883 11.73381042 5.807723999
    0 -0.000137329 180.0004883 11.73381042 5.807723999
    0 0 180.0004883 11.68887329 0
    0 0 180.0004883 11.68914795 0
    0 -0.000137329 0 11.73353577 5.807723999
    0 0 180.0004883 11.68914795 0
    0 -0.000137329 180.0004883 6.020706177 0
    0 0 180.0004883 11.73313904 5.807723999
    0 0 180.0004883 11.73313904 5.807723999
    0 0 180.0004883 11.7336731 5.807723999
    0 -0.000137329 0 11.7339325 5.807723999
    0 0 180.0004883 11.73353577 5.807723999
    0 -0.000137329 180.0004883 11.66819763 0
    0 -0.020812988 180.0004883 -22475 0
    0 0 180.0004883 11.73327637 5.807723999
    0 0 180.0004883 11.68847656 0
    0 0 180.0004883 11.68901062 0
    0 0 180.0004883 11.68901062 0

    I don't know why is broken when index of SFRA ran to around 10.

    By the way, it's test by open loop, and SFRA_FREQ_LENGTH is change to 80.

  • Based on what you have shown above the FreVect is set to 0 beyond index 12, why is that? 

    Is it the same at start ? looks like something else is writing to it?

    You did not have it zero when you ran the STB check?  

  • I think you are right, it might be written by something else.

    When power on(Vout ok) and SFRA is not start, the data of FreVect  is correct, after SFRA start sweep, the data of FreVect change like above.

    Then I found the data of FreVect was changed when the program running to SFRA_IQ_INIT(&SFRA1) in the judgment of initializationFlag, but I don't know why.

    Now I use the way "Using SFRA without SFRA GUI integration" to run SFRA, and get the data at open loop status.

    I change the data to IQ16 format and save as a CVS file. Open by the GUI, and it seems very unstable.

  • Ku,

    I will recommed lowering the coefficients and running the system at a point where there is stability.

    The noise on the measurement will be there, you can play with the injection amplitude to modulate that.

    Also let us know if you have any subsequent updates,

    Sorry, i missed the message about your last post.

    -Manish
  • Ku,

    Do you have any further updates on this?

    Regards
    Manish
  • Hi Manish,
    Sorry for the late reply.
    I have been doing other tests recently and my power supply has some problems.
    If there is any progress on SFRA test, I will update it to you. Thanks.
  • Ok in that case i will proceed to close this thread. Please start a new thread , using the related topic option when you have further questions.