XMEGA32E5 – timer TCC4 in byte mode

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have read the XMEGA E5 manual many times, but not everything is clearly explained there. I try to use TCC4 in byte mode, to double the number of PWM channels. Everything seems to be ok, except I cannot get any waveform on PC4. On PC0-PC3 the waveform is as expected. Maybe I have missed something? Here is my code:

void PWM_OUT_Init()
{
    PORTC.DIRSET=0b00011111;        //PWM outputs
    TCC4.CTRLB=TC_BYTEM_BYTEMODE_gc | TC_WGMODE_SINGLESLOPE_gc;        //8-bit mode, single slope
    TCC4.PERL=255;
    TCC4.CTRLE=TC_LCCAMODE_COMP_gc | TC_LCCBMODE_COMP_gc | TC_LCCCMODE_COMP_gc | TC_LCCDMODE_COMP_gc;    //Compare for all channels (should be only 0-4, the rest is enabled for testing
    TCC4.CTRLF=TC_HCCAMODE_COMP_gc | TC_HCCBMODE_COMP_gc | TC_HCCCMODE_COMP_gc | TC_HCCDMODE_COMP_gc;
    
    TCC4.CCAL=0xc020;
    TCC4.CCBL=64;
    TCC4.CCCL=128;
    TCC4.CCDL=192;
    //TCC4.CCAH=224;

    TCC4.CCBH=224;
    TCC4.CCCH=224;
    TCC4.CCDH=224;

    TCC4.CTRLA=TC_CLKSEL_DIV4_gc;    //f=2kHz
}

 

I've noticed, that higher 8-bits of CCx registers are cleared every timer overflow.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anybody know how to solve the above problem?

Can timer in E5 work in 8-bit mode to double PWM channels? Any experience?

Last Edited: Sat. Feb 15, 2020 - 04:11 PM