4809 / 0-series TCA CMPnEN pin-select documentation does not make sense

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

Hi All,

 

I'm hacking on my Curiosity Nano with atmega4809.   I'm trying to set up TCA0 to toggle pin 5 on port F (the user LED).

The 0-series datasheet indicates I can direct TCA0 output to PORTF via PORTMUX.TCAROUTEA = PORTMUX_TCA0_PORTF_gc;

The include file thinks the three bits for CMP[2:0]EN are independent pin bits, which does not make sense.

The 0-series datasheet (in TCA CTRLB section) is ambiguous IMO (see below).

I think that I should be able to set CtRLB.CMP[2:0]EN to 5 to select pin 5.

 

EDIT: That is, it makes more sense to me to have 3 bits indicate which single pin of a port should be output rather than independent control of only 3/8 pins of a port.

 

What do you think?

 

#define TCA_SINGLE_CMP0EN_bm  0x10  /* Compare 0 Enable bit mask. */
#define TCA_SINGLE_CMP0EN_bp  4  /* Compare 0 Enable bit position. */
#define TCA_SINGLE_CMP1EN_bm  0x20  /* Compare 1 Enable bit mask. */
#define TCA_SINGLE_CMP1EN_bp  5  /* Compare 1 Enable bit position. */
#define TCA_SINGLE_CMP2EN_bm  0x40  /* Compare 2 Enable bit mask. */
#define TCA_SINGLE_CMP2EN_bp  6  /* Compare 2 Enable bit position. */

Last Edited: Sun. Sep 8, 2019 - 07:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

>What do you think?

 

The datasheet describes correctly- the CMPEN0 bit controls WO0, CMPEN1 - WO1, CMPEN2 - WO2.

In split mode, you also control WO3/4/5.

 

Portmux controls what those WOn pins will be.

 

PF5 is WO5 and only works in split mode, so you would then set HCMP2EN to 1 (and portmux set accordingly). If using normal mode, choose a pin that can do WO0/1/2.

Last Edited: Sun. Sep 8, 2019 - 09:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Great!   Thanks for the help.

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

I remember that there was a bug within the PORTMUX...maybe you should take a look at the Errata:

 

http://ww1.microchip.com/downloa...

 

Regards,

Moe