ATtiny1616 TMRA 3x LED Flash Issues

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

Hi All,

I've three led's connected to pins PB2-4. I've verified the LED's work by outputting a high signal.

Next I've configured TMRA via MCC (which has lots of bugs but gets me started) to output a 1Hz 50% duty cycle on Channel 0-2.

As two of the pins are alternative positions I've PORTMUX'd them (MCC gets it wrong so overridden).
 

    PORTMUX.CTRLA = 0;
    PORTMUX.CTRLB = PORTMUX_TCA00_ALTERNATE_gc | PORTMUX_TCA01_ALTERNATE_gc;
    PORTMUX.CTRLC = 0;

Code generated by MCC -

 

int8_t TCA0_Initialize()
{
    //Compare 0
    TCA0.SINGLE.CMP0 = 0x4C4A;

    //Compare 1
    TCA0.SINGLE.CMP1 = 0x4C4A;

    //Compare 2
    TCA0.SINGLE.CMP2 = 0x4C4A;

    //Count
    TCA0.SINGLE.CNT = 0x00;

    //CMP2EN enabled; CMP1EN enabled; CMP0EN enabled; ALUPD disabled; WGMODE SINGLESLOPE; 
    TCA0.SINGLE.CTRLB = 0x73;

    //CMP2OV enabled; CMP1OV enabled; CMP0OV enabled; 
    TCA0.SINGLE.CTRLC = 0x07;

    //SPLITM disabled; 
    TCA0.SINGLE.CTRLD = 0x00;

    //CMD NONE; LUPD disabled; DIR disabled; 
    TCA0.SINGLE.CTRLECLR = 0x00;

    //CMD NONE; LUPD disabled; DIR UP; 
    TCA0.SINGLE.CTRLESET = 0x00;

    //CMP2BV disabled; CMP1BV disabled; CMP0BV disabled; PERBV disabled; 
    TCA0.SINGLE.CTRLFCLR = 0x00;

    //CMP2BV disabled; CMP1BV disabled; CMP0BV disabled; PERBV disabled; 
    TCA0.SINGLE.CTRLFSET = 0x00;

    //DBGRUN disabled; 
    TCA0.SINGLE.DBGCTRL = 0x00;

    //EVACT POSEDGE; CNTEI disabled; 
    TCA0.SINGLE.EVCTRL = 0x00;

    //CMP2 disabled; CMP1 disabled; CMP0 disabled; OVF disabled; 
    TCA0.SINGLE.INTCTRL = 0x00;

    //CMP2 disabled; CMP1 disabled; CMP0 disabled; OVF disabled; 
    TCA0.SINGLE.INTFLAGS = 0x00;

    //Period
    TCA0.SINGLE.PER = 0x9895;

    //Temporary data for 16-bit Access
    TCA0.SINGLE.TEMP = 0x00;

    //CLKSEL DIV256; ENABLE enabled; 
    TCA0.SINGLE.CTRLA = 0x0D;

    return 0;
}

Despite this I can only get Channel 2 (the non-PORTMUX) to output the signal. Any ideas?

Regards,

Andrew

 

Attachment(s): 

This topic has a solution.
Last Edited: Tue. Sep 29, 2020 - 09:41 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

PORTMUX.CTRLC is concerned for the TCA0 waveform output multiplexing.

The truth is more important than the facts.

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

How do you make that, PB2,3,4 are in CTRLB?

Edit - oh bugger!

Last Edited: Tue. Sep 29, 2020 - 10:01 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

n/a

Last Edited: Tue. Sep 29, 2020 - 09:41 PM