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.

Piccolo 28069 HRPWM and SFO()

Other Parts Discussed in Thread: CONTROLSUITE

Hi all,

Two questions/problems:

First I'm curious why I can't seem to write to the HRMSTEP register.  I set the HR registers as follows:

EALLOW;
pwmReg->HRCNFG.all         = 0x0;
pwmReg->HRCNFG.bit.EDGMODE = HR_BEP;
pwmReg->HRCNFG.bit.CTLMODE = HR_CMP;
pwmReg->HRCNFG.bit.HRLOAD  = HR_CTR_ZERO_PRD;
pwmReg->HRCNFG.bit.SELOUTB = HR_NORM_B;
pwmReg->HRPCTL.bit.HRPE    = 1;
pwmReg->HRMSTEP            = 69;            // good starting point as per datasheet
pwmReg->HRPCTL.bit.TBPHSHRLOADE = 1;
EDIS;

After stopping the system with the debugger and setting a watch on EPwm1Regs, it seems that the HRMSTEP = 0.  The datasheet seems to indicate that it is R/W - is this wrong?

Second, I would prefer to use the SFO() to populate the HRMSTEP but I can't seem to get that to work as either - it always sets MEP_ScaleFactor = 32767.

In "SFO_V6.h":

#define PWM_CH  7 

Elsewhere:

int MEP_ScaleFactor = 0;
volatile struct EPWM_REGS *ePWM[] = {0, &EPwm1Regs,&EPwm2Regs,&EPwm3Regs,&EPwm4Regs,&EPwm5Regs,&EPwm6Regs};


In "main", before while(1) stuff (I've tried this with and without the EALLOW/DIS):

EALLOW;
sfo_status = SFO_INCOMPLETE;
while (sfo_status == SFO_INCOMPLETE) {
    sfo_status = SFO();
}
sfo_status = SFO_INCOMPLETE;
EDIS;

I set a breakpoint just after this code and with the debugger reporting that MEP_ScaleFactor = 32767.

Any thoughts on either problem would be great.

  • Kevin,

    A few thoughts:
    1) On Piccolo, the fine step increment for all PWM is set by the HRMSTEP of EPwm1.  If I remember correctly, the other PWMs' HRMSTEP values are held at 0. So this may explain some of what you're seeing
    2) Check EPwm1Regs.HRMSTEP before and after running SFO(), this should tell you if everything is working correctly.

    Hopefully this helps some...

    PS: It sounds like you're not using real-time mode, which makes debugging in general much more pleasant IMO.  (see http://www.youtube.com/watch?v=gVDRo9m-4ng around 8:45)


    Thank you,
    Brett

  • Well, it turns out I wasn't setting the SysCtrlRegs.PCLKCR0.bit.HRPWMENCLK = 1.  To be fair there's only two references to the HRPWMENCLK in the entire datasheet (both in the same section).  I also don't see it in the "Figure 4-4. HRPWM System Interface" (page 372) nor is it referred to in "4.2.3.4.1 High-Resolution Period Configuration" (page 383)  - as far as I can tell, there doesn't seem to be any reference to this clock in the High-Resolution Pulse section at all.  That may be worth mentioning in the datasheet on how to setup the device.

    ~Kevin

  • Kevin,

    Yes, that would cause the issue too.  The clk is described in the System Control and Interrupts Portion along with the other clocks.  I'll submit your feedback on mentioning the clock in the HRPWM section

    If you haven't already, the following project should be helpful:
    \controlSUITE\device_support\f2806x\v135\F2806x_examples\hrpwm_prdup_sfo_v6


    Thank you,
    Brett

  • Indeed the example was of some help.  I discovered HRPWMENCLK through that example but only after digging into InitSysCtrl() -> InitPeripheralClocks().  The "main" file makes no mention of what peripheral clocks are actually used in the example.

    ~Kevin