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.

RM57L843: N2HET PWM Output frequency

Part Number: RM57L843
Other Parts Discussed in Thread: HALCOGEN

Hello,

We use a PWM function of the N2HET.

HALCOGEN computes LRP= 853.333F for VCLK2=75MHz, LR=64 (HET_REGS.PFR.LR=6), HR=1 (HET_REGS.PFR.HR=0).


The software uses LRP= 852.941F and PWM output measured with a scope are very close to one we want to. When I change to 853.333F (from HALCOGEN) the result is not so good.
Is there any explanation for this?


Could you please explain the fields “HR Clock” and “Loop Time” in HALCOGEN. Where they come from? Do they interfere in the LRP computation? 

Best regards,

Marcio

  • Hi Marcio,

     Yes, you are right, more loop resolution time can create more error in the output waveform generation.

    There could be max of one loop resolution period error would be possible. 

    I explained about this error in detail at below thread:

    (+) TMS570LS3137: PWM Capturing Code is working incorrectly - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    Please refer my last comment in above thread.

    --
    Thanks & regards,
    Jagadish.

  • Hello,

    Thanks for your response. It helped to a lot.

    I believe the problem is in the conversion from 'flow64' to 'uInt32' on these expressions in HL_het.c. It drops the fraction part of pwmPeriod.  

     hetRAM->Instruction[(pwm << 1U) + 41U].Data = ((((uint32)pwmPeriod * signal.duty) / 100U) << 7U ) + 128U;

    hetRAM->Instruction[(pwm << 1U) + 42U].Data = ((uint32)pwmPeriod << 7U) - 128U;

     Best regards,

    Marcio

  • Hi Marcio,

    I believe the problem is in the conversion from 'flow64' to 'uInt32' on these expressions in HL_het.c. It drops the fraction part of pwmPeriod.  

    You are right this is due to this conversion only.

    But this conversion is required because, the period will be generated using DJZ instruction.

    This instruction will contain the number of loop resolutions count as data value, and this value will get decremented for every loop resolution time, once this value becomes zero then PWM signal pin will get toggle. 

    So, this is a 25-bit integer value, and we can't move the fraction value to this. So, there will be a tradeoff here.

    --
    Thanks & regards,
    Jagadish.