AT SAMR21 G18 TCC0

Discussions around product based on ARM Cortex M0+ core.
This forum will be discontinued soon.

Moderator: nferre

AbdelZ1
Posts: 1
Joined: Thu Feb 11, 2016 4:19 pm

AT SAMR21 G18 TCC0

Fri Feb 12, 2016 11:08 am

Hi all,

I'm trying to use the TCC0 on my atmel board SAMR21 XPLAINED pro but I faced many issues, specially with the configuration. :roll: :|

First I found that the Library I downloaded(BitCloud) On atmel is not complete and contains some mistakes(samr21.h)

Here is the Amel website where I downloaded the library BitCloud:
http://www.atmel.com/tools/ATSAMR21-XPRO.aspx

So I corrected the incomplete file but my TCC0 is still not working.

I would use the TCC0 simply as a counter, so I used the following configuration:

Code: Select all

  

  PM_APBCMASK_s.tcc0 = 1;

  GCLK_CLKCTRL_s.id = 0x1A;  // enabling clock for TCC0
  GCLK_CLKCTRL_s.gen = 3;
  GCLK_CLKCTRL_s.clken = 1;

  TCC0_32_CTRLA_s.enable = 0;
  while(TCC0_32_SYNCBUSY_s.enable);

  TCC0_32_CTRLA_s.swrst = 1;
  while(TCC0_32_SYNCBUSY_s.swrst);
 
  TCC0_32_CTRLA_s.cpten0 = 0;
 
  TCC0_32_CTRLA_s.runstdby = 0;
 
  TCC0_32_CTRLA_s.prescsync = 0x01;
 
  TCC0_32_CTRLA_s.prescaler = 0x03;
 
  TCC0_32_WAVE = 0x01;
 
  TCC0_32_CTRLA_s.enable = 1;
  while(TCC0_32_SYNCBUSY_s.enable);
 
  TCC0_32_CTRLBCLR_s.oneshot = 1; // clearing one shot mode
  while(TCC0_32_SYNCBUSY_s.ctrlb);

  TCC0_32_CTRLBCLR_s.dir = 1;
  while(TCC0_32_SYNCBUSY_s.ctrlb);

  TCC0_32_COUNT_s.count = 0;
  while(TCC0_32_SYNCBUSY_s.count);
 
  TCC0_32_PER_s.per = 2710;
  while(TCC0_32_SYNCBUSY_s.per);
 
When I read my timer I always find 0

Could any help my please, if need any clarification, please never hesitate

Thank you

Return to “SAM D20 Cortex-M0+ MCU”

Who is online

Users browsing this forum: No registered users and 1 guest