Selecting PWM with TCC1 using Atmel Studio - no output

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


I am using the SAMD51 processor and having trouble creating a PWM component.  I have created 5 successful PWM outputs (using TC2, TCC0, TC4, TCC4 and TC5).  When I go to create a new one on my "PA12" output, I get no output.  All the other PWM outputs work well.  I have to use PA12 because the board is complete.  If I try PA12 on another Clock like TCC0, it works, but because of the chip restrictions, there are only 3 clocks that PA12 uses (section 6.1 "Mulitplexed Signals"), and the other 2 (TC2 and TCC0) are already in use by other PWM outputs.

 

What am I missing in the TCC1 setup that would lead to no PWM output oscillation?  Thanks!

 

Here's my configuration:

This topic has a solution.
Last Edited: Thu. Apr 8, 2021 - 04:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The setting for Waveform Channel Select is what you are missing.

https://community.atmel.com/foru...

/Lars

 

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

Hi Lars,

 

Thanks so much for your quick response.

 

That seems to work for PA12 using TCC1, setting the Waveform Channel Select to 2 and the Capture Channel to 2.  Now I'm seeing PWM output.  Where do I find this information in the manual?

I have another channel now, PB30, that I want to enable.  If I use TCC0, and PB30 becomes WO/6, what Waveform Channel do I need?  How do I know WO/2 is channel 2 and WO/6 is channel 0?

 

Thanks so much.

 

-Peter

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well it's certainly not crystal clear in the datasheet, the default configuration in Table 49-4. "Output Matrix Channel Pin Routing Configuration" is what I find also is the default when not using the waveform extension.

So for your case on TCC0 which has  6 compare channels the 8 outputs will be from the channels 0, 1, 2, 3, 4, 5, 0 and 1.

Obviously it's important to know the number of channels and the number of outputs (since this is not the same for each TCC instance), check Table 6-9. "TCC Configuration Summary" for this information.

/Lars

 

 

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

Thanks for your help.  You've gotten me up and running with all my PWM devices now.  I'm marking this issue "resolved".

 

-Peter

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

Hello together,
I have built a "halfway" smart solution for the ASF4. Which is able to add (activate) another channel(s) to an already initialised PWM module. I am basing this on the ASF4 project code and adding to it. So that overwriting the project with the Atmel START configurator should not cause any problems.  The first attempt works perfectly. I looked at two outputs with a logic analyser.

 

You have to insert the modified/copied files into your project and can use the function

  • pwm_set_parameters_own(descr, periode, duty_cycle, channel);

to activate another channel and specify its duty_cacle separately. The whole code was tested with Atmel Studio 7.0.25.42. In a moment I will also implement it in IAR EWARM 9.20.

 

Attachment(s): 

ATSAMC21
ATSAME51
ATMEGA

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

Here is the modified example code:

 

/**
 * Example of using PWM_0.
 */
void PWM_0_example(void)
{
  pwm_set_parameters(&PWM_0, 299, 200);
  pwm_set_parameters_own(&PWM_0, 299, 100, 0x05); /* custom function -> built by myself */
  pwm_enable(&PWM_0);
}

 

ATSAMC21
ATSAME51
ATMEGA