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.

TMS320F28069: SOC on decrementing CMPB

Part Number: TMS320F28069

Hi,

I can generate SOCA and SOCB using all the available options in ETSEL except decrementing CMPB (EPwm1Regs.ETSEL.bit.SOCASEL = 0x7). Is there something different when using this value? CMPB incrementing (0x6) as well as CMPA inc/dec (0x4, 0x5) work fine. My PWM counter is set up as count up/down (EPwm1Regs.TBCTL.bit.CTRMODE = 0x2).

This does not work:

EPwm1Regs.ETSEL.bit.SOCAEN    = 1;                
EPwm1Regs.ETSEL.bit.SOCASEL    = 7;
EPwm1Regs.ETPS.bit.SOCAPRD     = 1;            

but this does:

EPwm1Regs.ETSEL.bit.SOCAEN    = 1;                
EPwm1Regs.ETSEL.bit.SOCASEL    = 6;
EPwm1Regs.ETPS.bit.SOCAPRD     = 1;           

I am having this problem with both PWM1 and PWM2 for both SOCA and SOCB.

Any help would be great.

Cheers

Benriah

  • Benriah,

    There's no difference. It's working fine on my testbench.

    Could you check the setting of the CTRMODE bit when the code is running (i.e. after initialization) please? I'm wondering if it's configured as 0x0 which would give the behaviour you describe.

    Regards,

    Richard
  • Hi Richard,

    Thanks for the reply.

    EPwm1Regs.TBCTL.bit.CTRMODE and EPwm2Regs.TBCTL.bit.CTRMODE are both configured (and stay) with the value 2.

    I am currently recreating the problem using the debugger in CCS by just changing the value of EPwm2Regs.ETSEL.SOCASEL and/or EPwm1Regs.ETSEL.SOCASEL

    I am measuring SOCA with an Oscilloscope connected to GPIO32 which is configured as SOCA.

    TBPRD = 529;

    CMPA.half.CMPA = 264

    CMPB = 264

    SOCAPRD = 1;

    SOCASEL = (1-6 work fine), 7 does not (no SOCA pulses at all).

    HRPCTL=0;

    I am using a Control Card v0.2 with a TMS320F28069UPZPS.

    Cheers

    Benriah

  • I have just found the problem...

    CMPCTL.bit.LOADBMODE was equal to 3 (Freeze (no loads possible))
    and
    CMPCTL.bit.SHDWAMODE=0;

    so even though I was changing CMPB it was only the shadow register.
    The strange thing still is that SOCASEL = 6 works ... I guess the default CMPB must be zero?

    Warning:
    Changing SHDWAMODE to CC_IMMEDIATE (1) overwrites the shadow register. If you write to CMPB then change SHDWAMODE to CC_IMMEDIATE CMPB will be overwritten.

    Cheers
    Benriah
  • Benriah,

    Yes, that's correct.  In immediate update mode there is no shadowing; writes to CMPB go straight into the active register.

    Glad to know you found the problem.

    Regards,

    Richard