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.

TMS320F280049: calculate sector for 3 phase ac input power

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

Dear c2000 expert,

Currently I'm using F280049 to design a three phase buck PFC, and would like to determin the sector number as show belown picture.

Can you please recommend a way of calculating the sector number? I'd like to have a least if branch in code, because I want to have less CPU usage in isr. Thanks...

  • Due to holidays, you can expect a response in the first week of Jan 2020.

  • Hi Jack,

    I don't have any direct advice, but I can think of a few options that you may potentially consider.  However, you'd need to analyze to see if either of these is adequate for your need (or any are something that you feel sufficiently comfortable with).

    1. Conditionals:
      1. Use a relatively long conditional statement to determine the state.  It seems that this is what you're trying to avoid though.  However, before working too hard to come up with a different solution, it may be worthwhile to implement the conditional, enable compiler optimization and see how efficient/deterministic it really is.
      2. If you think enough about the conditional, you may be able to avoid some of the conditional statements and convert them into arithmetic.
        (for example, doing something like is done in challenge #1 at the following: https://medium.com/edge-coders/coding-tip-try-to-code-without-if-statements-d06799eed231)

    2. Use analog features instead of the ADC to make the conditions digital (this may not help directly but could be helpful to simplify the conditional in [1b] above or enable [3] below):
      1. Use several ADC Post Processing Blocks (PPBs) to do the comparisons digitally & immediately after the ADC conversion process is complete.  These PPB events (EVTs) can be used to generate interrupts or be read in your existing interrupts/code via flags. 
      2. Use the analog comparators. Note that one CMPSS contains two comparators.  This would mean that you could implement all comparisons for a specific phase would take 2 CMPSS blocks (1.5 blocks).  This would be faster than the PPB, as it wouldn't be dependent on the system clock - if that matters.

    3. Utilize the CLB:
      1. The Configurable Logic Block could take in the outputs of the PPB or CMPSS directly to create/hold the state in a CLB register.  This register could then be accessed by the CPU and/or generate an interrupt for the CPU when the state changes.  If desired, the CLB could further be used to block or enable PWM outputs directly based on the state (via PWM Output Enable, PWM[OE]).


    Hopefully this helps!  Most of the above can be used separately or combined together.


    Thank you,
    Brett

  • Hi Brett,

    Thanks for your suggestion. Your proposal of using PPB and CLB peripheral is very intresting, is there any example of using those blocks? Thanks...

  • Hi Jack,

    I'm not near my computer, but there should be examples of how to use both features separately inside C2000Ware.  

    However, I doubt there will be anything that uses these features/peripherals together.  So, you would need to build your own software/configuration to experiment with this.

    Hopefully this helps!

    Thank you,

    Brett

  • Thanks... Happy new year.