Atmel Start PWM

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

Hi,

I'm trying to move to ASF 4 and I'm stacking in understanding PWM usage.

I've added the PWM driver for D21 Explained pro from Atmel Start and grabbing from example all i see is a function

 

void PWM_0_example(void)
{
    pwm_set_parameters(&PWM_0, 10000, 5000);
    pwm_enable(&PWM_0);
}

 

Can someone kindly explain the meaning of the two parameters "10000" and "5000"?

 

I need simply to move a motor back and forth (I've added WO/0 and WO/1 pins) via a BD6221F

Atmel Start docs totally useless for me.

 

Thanks indeed.

 

This topic has a solution.

Last Edited: Sun. Jun 11, 2017 - 10:53 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I've managed to understand the parameters and i've also managed to solve the issue of moving in the two directions inverting the output channels

 

    TC6->COUNT16.CTRLC.reg |= (1 << 0);
    TC6->COUNT16.CTRLC.reg |= (1 << 1);

 

Unfortunately access to registers is needed as the PWM implementation is really really basic. Not even apparently (in my understanding) allowing the usage different channels or 8 bit register option.

 

Filo

Last Edited: Sun. Jun 11, 2017 - 08:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I checked the PWM example in Atmel START, but i did not understand the values given to each configuration. i have SAMDA1 Xplained pro demo board.
Can you explain me the meaning of each configuration please ? in the datasheet device, there are no sufficient explanation to implement PWM driver.
Other question, in Atmel Start, how can i select the channel for each WO/x ? for example i want to generate 2 pwm output PB12 and PB13 (WO/6 and WO7), so i have to choose the channel for each  : CC2,CC3. how can i do it knowing that we have 1 CASE NAMED : TCC0 Waveform Channel Select ?????? if i want to use all WO/x signals, how can i choose the channel for the 8 ?

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

atmel_fan wrote:
in the datasheet device, there are no sufficient explanation to implement PWM driver.

If you want to write your own driver, then the data sheet holds the information. It will tell you how to set up a clock, route it to a TC or TCC module, and how to set that TC/TCC module up to generate a PWM waveform.

 

If you're not writing your own driver from scratch but instead rely on ASF/Start then: No, the SAM data sheet does not cover that. This is reasonable since there are many different SAM models supported by ASF/Start and it would be wrong to duplicate the ASF/Start documentation in every SAM data sheet. Instead ASF/Start has it's own documentation here. (That link might be quite volatile. One eway to find the ASF API reference doxcumentation is to point your web browser to start.atmel.com and then click Help and Support (top right) and on the following page click ASF4 API Reference Manual.)

 

As an example, take the original question that 'fcampanini' asked about the parameters to pwm_set_parameters. It is documented here. The ASF4 documentation might not make you jump with joy, but it exists. ;-)

 


 

atmel_fan wrote:
Other question, in Atmel Start, how can i select the channel for each WO/x ? for example i want to generate 2 pwm output PB12 and PB13 (WO/6 and WO7), so i have to choose the channel for each  : CC2,CC3. how can i do it knowing that we have 1 CASE NAMED : TCC0 Waveform Channel Select ??????

It's hard to understand what you're actually asking about here. Each TC can generate two PWM waveforms. The possible routings to pins are as given in data sheet Chapter 7 - I/O Multiplexing and Considerations, Table 7-1.

 

If you use ASF/Start to generate drivers then to get 8 PWM signals you will need to set up four TCs (not one!). For each of those you can set how it's respective WO[0] and WO[1] channels are routed to output pins.

 

[EDIT: The alternative might be to set up two TCCs - since they have four WOs each. Not entirely certain of this working, since I have not played with the TCCs yet..]

 

(I am assuming we're talking about SAM D21, since that is what this thread started out being about. You probably should have started a new thread rather than hijacking an old thread..)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Wed. Jan 17, 2018 - 10:08 PM