• AVR Freaks

Hot!Compiling Error w/ ATTiny 402 using provided example listed on "Getting Started with TCA"

Author
Ankit.Patel
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/06/13 14:23:44
  • Location: 0
  • Status: offline
2019/07/03 06:22:41 (permalink)
0

Compiling Error w/ ATTiny 402 using provided example listed on "Getting Started with TCA"

Hi,
 
I'm relatively new to AVR programming, so I wanted to take existing examples that I found on through the Microchip website (document is called "Getting Started with TCA" - TB3217) & program the ATTiny 402 using the PIC Kit 4 so I could get familiar with the device and hardware programming (PK 4 works - verified it doing a simple blink test on one of the pins). Specifically I want to program two pins with separate frequencies and duty cycles using PWM, so I used the example provided in the sheet as reference.
 
However, I was getting a compiling error with example 7-3 ("Generating Two PWM Signals in Split Mode Full Code Example") when I copied it from the document into MPLAB (I tried Studio 7 as well & I had the same error). The error I was getting was with the "PORTMUX.TCAROUTEA = PORTMUX_TCA0_PORTA_gc;" line (I attached a screenshot for reference). I also provided the example code in the document below.
 
I'm sure it's something I'm missing, but any help would be much appreciated.
 
 
Thanks,
Ankit Patel
 
#define PERIOD_EXAMPLE_VALUE_L (0xCF)
#define PERIOD_EXAMPLE_VALUE_H (0x44)
#define DUTY_CYCLE_EXAMPLE_VALUE_L (0x68)
#define DUTY_CYCLE_EXAMPLE_VALUE_H (0x11)
#include <avr/io.h>
void TCA0_init(void);
void PIN_init(void);
void TCA0_hardRest(void);
void TCA0_init(void)
{
PORTMUX.TCAROUTEA = PORTMUX_TCA0_PORTA_gc;
TCA0.SPLIT.CTRLD = TCA_SPLIT_SPLITM_bm;
TCA0.SPLIT.CTRLB = TCA_SPLIT_HCMP0EN_bm
| TCA_SPLIT_LCMP0EN_bm;
TCA0.SPLIT.LPER = PERIOD_EXAMPLE_VALUE_L;
TCA0.SPLIT.LCMP0 = DUTY_CYCLE_EXAMPLE_VALUE_L;
TCA0.SPLIT.HPER = PERIOD_EXAMPLE_VALUE_H;
TCA0.SPLIT.HCMP0 = DUTY_CYCLE_EXAMPLE_VALUE_H;

TCA0.SPLIT.CTRLA = TCA_SPLIT_CLKSEL_DIV16_gc
| TCA_SPLIT_ENABLE_bm;
}
void PIN_init(void)
{
PORTA.DIR |= PIN0_bm
| PIN3_bm;
}
void TCA0_hardReset(void)
{
TCA0.SINGLE.CTRLA &= ~(TCA_SINGLE_ENABLE_bm);
TCA0.SINGLE.CTRLESET = TCA_SINGLE_CMD_RESET_gc;
}
int main(void)
{
PIN_init();
TCA0_init();

while (1)
{
;
}
}

Attached Image(s)

#1

1 Reply Related Threads

    Ankit.Patel
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2019/06/13 14:23:44
    • Location: 0
    • Status: offline
    Re: Compiling Error w/ ATTiny 402 using provided example listed on "Getting Started with T 2019/07/06 18:38:41 (permalink)
    0
    For those who stumble upon this, the tiny 402 uses CTRLC in PORTMUX to set the tca0x (PORTMUX.CTRLC |= PORTMUX_TCA00_bm;)
    #2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5