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.

LAUNCHXL-F2800137: Peak current mode control questions

Part Number: LAUNCHXL-F2800137
Other Parts Discussed in Thread: TIDM-DC-DC-BUCK, TIDM-02000, POWERSUITE, SFRA

Hi,

I implemented a peak current mode control with slope compensation following the documents listed below:

  • Step-by-Step Design Guide for Digital Peak Current Mode Control: A Single-Chip Solution (Biricha Digital Power LTD)
  • SPRABE7A: Digital Peak Current Mode Control With Slope Compensation Using the TMS320F2803x.

But I have some doubts.

I have an ePWM with Fswitching = 100KHz and every 100KHz the ADC interrupt occurs to read the analog inputs and perform the calculation of maxRampValue and decrementValue. In particular:

1) I calculate the error as: error = VREF - analogValueReadByAdc. Where VREF is calculated as reported in the Biricha document with the Equation 19:   where ADCbits = 12 and VDAC = 3,3V.

The image below, shown our feedback signal where RB = 884k21 and R1 = 1k05; in to out gain of the IC in differential mode is x8. How do we insert this value in VREF calculation?

2) The error is the input for a 2p2z filter that give me an output called outputFilter.

3) I multiplied the outputFilter for K calculated as reported in the SPRABE7A (pag 3 equation (1) )   where

            - SamplingGain = 1.71

            - ADCmaxV = 3.3V

            - ADCbits = 12

            - DACbits = 12

            - DACmaxV = 3,3V

    I called Iref = K * outputFilter

4) I calculate VPP as reported in the SPRABE7A (pag 7, equation (20))   where D = is the duty cycle of the ePWM read by the eCAP, Ri = 200mOhm, Ts = 10us, Vin = Iref, L0 = 200uH.

    Ri = 200mOhm is the equivalent of the transformation factor of the current sensor CT425-HSN820MR (200mV/A) that we are using. 

5) I calculate the maxRampValue and the decrementValue for the ramp configuration with the equations reported below:

  •      is the equation used in SPRABE71 where 1023 is the DAC bits and 3.3 is the DACmax V. This equation is the same of the Biricha document without the factor 64:  In fact, in my calculation I set ramp value with this formula: Ramp = VPP * (4095/3.3) because my DAC is 12 bits and DAC range is 3.3V.
  •   is the equation used in Biricha document and in my application Fs = 100KHz and Fclk = 100MHz.

Are the steps reported above correct? Are the formulas correct? Do I need to perform other calculations for peak current mode control? 

I attached a schematic of my control.

Is there a way to monitor the ramp waveform? If I wont ramp value in volt, how can I do?

Thank you in advance.

Best Regards,

Debora

  • Hi Debora,

    Thank you for reaching out. I am not familiar with the specific document you sent published by Biricha. Biricha supports our DP training topics using our device but for specific questions relevant to the document, I think it would be best to reach out to them for that information.

    From C2000 perspective, have you investigated and looked into our DCL library? We have a 2p2z compensator (written in asm and c language so is very optimized) so you should be able to leverage that to simplify the control loop implementation. I mentioned this in our previous post but our TIDM-DC-DC-BUCK reference design features a closed loop implementation for PCMC and you should be able to leverage the similar implementation in your case as the control loop diagrams match closely. 

    From DCL perspective, you are right in that you should subtract the sensed Vout with your Vout reference to obtain the error constant. This error constant is fed into the tuned compensator to obtain a control effort, which is derived to a DAC value to be written to the CMPSS register. Unfortunately, the only way to view the CMPSS is to do something like output the CTRIPH/CTRIPL to output xbar which will tell you when the comparator gets tripped, but DAC RAMP is internal to the device and there is no way to route that to an external DAC (and F280013x family doesn't have buffered DAC module anyways).

    Regards,

    Peter

  • Hi Peter,

    thank you for the reply. The SPRABE7A is a Texas Instruments document. Is there any people that can help me with peak current mode?

    I will try to reopen the old project that you suggest to me in our old conversation TIDM-DC-DC-BUCK. 

    Thank you.

    best regards,

    Debora

  • Hi Debora,

    Yes, I was referring to reaching out to Biricha for support for anything detailed in the document "Step-by-Step Design Guide for Digital Peak Current Mode Control: A Single-Chip Solution". For SPRABE7A, the author is no longer with us and it is quite an old document. Design guidance can still be leveraged but example code is based on F2803x device family which is older generation of our C2000 MCU. Better to use content related to our newest generation of C2000 MCU. I can help support peak current control implementation, please let me know when you are able to refer to TIDM-DC-DC-BUCK and if there is any questions for that

    Regards,

    Peter

  • Hi Peter,

    thank you for your reply.

    I had some questions about Peak Current Mode Control:

    1) What is the formula that I need to use to set the value for the maximum ramp in CMPSS_setMaxRampValue function?

    2) What is the formula that I need to use to set the slope value in CMPSS_setRampDecValue function?

    In the TRM and in the datasheet these information aren't reported. How can I define these values? 

    Thank you.

    Best Regards,

    Debora

  • Hi Debora

    1) What is the formula that I need to use to set the value for the maximum ramp in CMPSS_setMaxRampValue function?

    The Max Ramp value can be thought of as the threshold where above this threshold, the comparator will output a high signal. Typically this is calculated by multiplying your control effort in PU terms (from 0 to 1.0) by the maximum register value for the RAMPMAX register, which is 16-bit = 65535. For example, if the output of our compensator computes a control effort of 0.5, that means we feed Max Ramp with 0.5 ^ 65535. When fed into CMPSS, the CMPSS threshold will trigger at 1.65V (if VREFHI is set to 3.3V). The PU value can be tuned depending on the maximum clamping of your sensing circuit. 

    2) What is the formula that I need to use to set the slope value in CMPSS_setRampDecValue function?

    You typically should not need to use CMPSS_setRampDecValue if implementing PCMC. In PCMC, you can simply update the MaxRamp value on every cycle of the control loop without needing to change the RampDecValue. I've only ever used the RampDecValue when needing to implement soft-start in a hysteretic control application. If needing to adjust the RampDecValue, this should be something that is gradually incremented/decremented on every control loop and cycle and shouldn't necessarily need an equation to calculate.

    Regards,

    Peter

  • Hi Peter,

    thank you for the reply. 

    1. What is the effort in PU terms? Have you got a practical example of PCMC in close loop? So I can better understand what are the steps that I need to perform? 

    2. If I use in every cycle the CMPSS_setMaxRampValue function to update the max ramp value, I loose the max threshold setting in the first place. How can I manage that? or am I missing something?

    Thank you,

    Best Regards

    Debora

  • Hi Debora,

    1. What is the effort in PU terms? Have you got a practical example of PCMC in close loop? So I can better understand what are the steps that I need to perform? 

    Effort in PU corresponds from 0.0 to 1.0. 0.0 should correspond to DAC max ramp value which generates 0V ILFB and 1.0 should correspond to DAC max ramp value which generates the max range of ILFB. Below code snippet taken from TIDM-DC-DC-BUCK can be leveraged for the code implementation.

        //
        // Record the most recent ADC conversion of Vout
        //
        BUCK_vOutSensed_pu = BUCK_HAL_readVout_pu();
        
        //
        // Determine the desired Vout setting and its associated error
        //
        BUCK_vOutSet_pu =
            BUCK_SFRA_INJECT(BUCK_vOutSlewed_pu);
    
        BUCK_ek_pu = BUCK_vOutSet_pu -
                                 BUCK_vOutSensed_pu;
                                 
        //
        // Calculate the required control effort (duty cycle)
        //
        BUCK_uk_pu =
                BUCK_DCL_RUN_IMMEDIATE(&BUCK_ctrl,
                                       BUCK_ek_pu); 
                                       
       //
        // Update CMPSS DAC MAXREF with the calculated level
        //
        BUCK_HAL_updateSyncBuckDac(BUCK_uk_pu);

    2. If I use in every cycle the CMPSS_setMaxRampValue function to update the max ramp value, I loose the max threshold setting in the first place. How can I manage that? or am I missing something?

    The max threshold setting is a #define which we are comparing the computed max ramp value against. It is a separate variable from the MaxRampValue register on the device. So when you update the value, you can still compare against the constant value that is predefined.

    Regards,

    Peter

  • Hi Peter,

    thank you for the reply and sorry for my late response. For me isn't clear the example that you told me. I see the entire source code but I have some questions:

    Could you tell me what are the steps to implement peak current mode? Please describes them to me in detailed mode with also formulas and registers that must to be set. I am new of Texas Instruments and I never have not implement Peak current mode.

    In your old message, you told me that when I update the maxRampValue, I don't change the maximum value of the ramp because it is a define. Could you tell me what are the define and how it works?

    The example, for me isn't clear because there is nothing that explain that! I found a document "Digital Peak Current Mode Control With Slope Compensation Using the TMS320F2803x.pdf" which explain the example but the variables described are different from the example! So it is difficult for me to understand how PCMC in close loop works.

    Thank you in advance and Best Regards.

    Debora

  • Hi Debora,

    Let me check with some other colleagues to see if we have any additional PCMC documentation which can help better explain the steps to implement on our C2000 devices.

    Could you tell me what are the define and how it works?

    The defines are in the user_settings.h and settings.h files. These control the overall configurations used in our reference design code. These are preprocessor directives so these need to be changed and configured at compile time.

    Regards,

    Peter

  • Hi Peter, thank you for the reply. I will wait your answer.

    Thank you in advance.

    Best Regards,

    Debora

  • Hi Debora,

    After discussing this with a colleague, we don't have any detailed theoretical PCMC application reports that are targeting our Generation 3 C2000 devices. Some brief theory is available in our design guides, such as for example the TIDM-DC-DC-BUCK or TIDM-02000 both have PCMC information. Otherwise, it's necessary to review the provided reference design code for guidance. Is there a specific aspect of the code which you are having difficulty understanding? Please also help to look at our powerSUITE GUI which can help provide some calculations given the parameters of the system

    Regards,

    Peter

  • Ok, if you don't have any document about Peak Current Mode, we can try to implement PCMC together. I need to implement PCMC in close loop.

    I am following the example TIDM-DC-DC-BUCK and the first step for PCMC is read the value from the ADC in the form of PU.

    So:

    BUCK_vOutSensed_pu = BUCK_HAL_readVout_pu(); where

    float32_t BUCK_vOutSensed_pu = BUCK_VOUT_ADC_FACTOR * ADC_ReadResult(....) where BUCK_VOUT_ADC_FACTOR = 1/4096.

    Then, in the example, I see this:

    #elif(BUCK_CTL_MODE == BUCK_CTL_MODE_PCMC)
        BUCK_dacSet_pu = BUCK_SFRA_INJECT(BUCK_dacSlewed_pu);
        BUCK_HAL_updateSyncBuckDac(BUCK_dacSet_pu);
    
        //
        // For informational purposes, calculate and record the amount of
        // time remaining before the CMPA shadow load takes place.
        //
        BUCK_logDutyUpdateMargin();
    #endif

    I don't know what are doing the example. The BUCK_SFRA_INJECT does not make anything and I am to able to understand how works BUCK_dutySlewed_pu. Could you explain in detailed mode (for now) the code listed above?

    Thank you in advance.

    Best Regards,

    Debora

  • Hi Debora,

    This BUCK_SFRA_INJECT function is to be used with our Software Frequency Response Analyzer tool (SFRA). If not using the SFRA, you can assume that BUCK_dacSet_pu is equivalent to BUCK_dacSlewed_pu. 

    When SFRA is enabled, the SFRA will add a small signal injection into the target DAC value for our 2p2z controller. This function is used in conjunction with the SFRA_COLLECT function, which will analyze data from the excitation and calculate the plant transfer function

    This primarily concerns tuning your control loop, so if you are just interested in developing the PCMC control code, you can choose to ignore this function for now

    Regards,

    Peter