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/TMS320F28027: TMS320F28027 HVPSFB(PCMC) Kv caluclation

Part Number: TMS320F28027

Tool/software: Code Composer Studio

Dear Ti community

I'm developing PCMC on HVPSFB.

But I cannot understand the calculation of Kv.

For exemple about Vfbin.

  1. First, It's supposed that Vfbin =Vfbin [V]
  2. Then the input of ADC is lowered by gain Gfb . So  the input of ADC is Gfb * Vfbin[V].
  3. The output of ADC is Gfb * Vfbin *2^12/3.3 (Q12).
  4. After that,Q12 change Q15 at line 827 in main.c.   It means Q15 number is Gfb * Vfbin *2^12/3.3 * 2^3 = Gfb * Vfbin *2^15/3.3(Q15)
  5. Then,multipled Kv(Q15) and shift 15 at line 828 in main.c   .It means Gui_Vfbin(Q15) = Gfb * Vfbin *2^15/3.3(Q15) * Kv(Q15) / 2^15.
  6. To display Vfbin [V] in GUI, Gui_Vfbin(Q15) =  Vfbin * 2^15
  7. By 5. and 6.  ,  Kv(Q15) = 2^15*3.3/Gfb 

I want you to tell where it's wrong.

  • Hi user5277039,

    I think the difference between your answer and the answer in the excel is a q value in cell F11.
    Please take a look at the thread below which contains the explanation of why there is a q in the equation. Thanks.
    e2e.ti.com/.../788582

    Regards,
    Chen
  • I read the thread.

    I think the flow is below.(red point is changed)

    1. First, It's supposed that Vfbin =Vfbin [V]
    2. Then the input of ADC is lowered by gain Gfb . So  the input of ADC is Gfb * Vfbin[V].
    3. The output of ADC is Gfb * Vfbin *2^12/3.3 (Q12).
    4. After that,Q12 change Q15 at line 827 in main.c.   It means Q15 number is Gfb * Vfbin *2^12/3.3 * 2^3 = Gfb * Vfbin *2^15/3.3(Q15)
    5. Then,multipled Kv(Q15) and shift 15 at line 828 in main.c   .It means Gui_Vfbin(Q15) = Gfb * Vfbin *2^15/3.3(Q15) * Kv(Q15) / 2^15.
    6. But, Gui_Vfbin is Q5,so  Gui_Vfbin(Q5) = Vfbin(Q15) / 2^10 = Gfb * Vfin / 3.3 * Kv(Q15) / 2^10
    7. To display Vfbin [V] in GUI, Gui_Vfbin(Q5) =  Vfbin * 2^5
    8. By 6. and 7.  ,  Kv(Q15) = 2^15 * 3.3/Gfb 

    finally,same result.

    When I suppose that (5.)Gui_Vfbin(Q15) is equal (7.) Gui_Vfbin(Q5).

    The result is correct.

    So,I think this process is right.

    But I can't understand (5.)Gui_Vfbin(Q15) is equal (7.) Gui_Vfbin(Q5).

    Are Gui_Vfbin(Q15) and Gui_Vfbin(Q5) different number?


  • Hi user5277039,

    I will be back to office on 3/21 and will follow this thread at that time. Sorry for the inconvience.

    Regards,
    Chen
  • Hi user5277039,

    Gui_Vfbin(Q15) and Gui_Vfbin(Q5) should be different number. I am not sure why there will be a difference like this but it has to be some scaling factor missing in the calculation.

    Regards,
    Chen
    1. First, It's supposed that Vfbin =Vfbin [V]
    2. Then the input of ADC is lowered by gain Gfb . So  the input of ADC is Gfb * Vfbin[V].
    3. The output of ADC is Gfb * Vfbin *2^12/3.3 (Q12).
    4. After that,Q12 change Q15 at line 827 in main.c.   It means Q15 number is Gfb * Vfbin *2^12/3.3 * 2^3 = Gfb * Vfbin *2^15/3.3(Q15)
    5. Then,multipled Kv(Q15) and shift 15 at line 828 in main.c   .It means Gui_Vfbin(Q15) = Gfb * Vfbin *2^15/3.3(Q15) * Kv(Q15) / 2^15.
    6. But, Gui_Vfbin is defined Q5,so  Gui_Vfbin(Q5) = Vfbin(Q15) / 2^10 = Gfb * Vfin / 3.3 * Kv(Q15) / 2^10
    7. To display Vfbin [V] in GUI, Gui_Vfbin(Q5) has to be  Vfbin * 2^5
    8. By 6. and 7. Vfbin * 2^5 = Gfb * Vfin / 3.3 * Kv(Q15) / 2^10 . Kv(Q15) = 2^15 * 3.3/Gfb

    Because a procedure is being described by a number,

    please point out specifically which place of a described procedure is wrong in a number above-mentioned. 

  • Hi, user5277039,


    Your logic seems correct.

    Just want to let you know I am still looking at it and will point it out soon.

    Regards,
    Chen

  • Hi user5277039,

    So the Gui_Vfbin is a number that can be treated as Q15 or Q5 based on different conditions. The correponding Q15 value and Q5 value are different, but they are both come from a fixed point value which is the parameter in your equation.

    In line 1264, if (Gui_Vfbin > 11200 && Gui_Vfbin < 13440) // 350<Vfbin<420
    Here 11200 and 13440 are the real value of Gui_Vfbin. In the calculation, based on different Q value, Gui_Vfbin can be treated as different value with decimal point.

    In your calculation, the real value is the same and all the calculations are correct. Thanks.

    Regards,
    Chen