What is the actual purpose of "pmc_enable_periph_clk() function"

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

Am looking for the actual function of

pmc_enable_periph_clk() function

used in ASF of SAM E70.

Comment says that it is to enable specified peripheral clock.

What does that really mean?

This topic has a solution.

Silly beans are always silly
:)

Last Edited: Tue. Nov 29, 2016 - 11:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it necessary to provide call this function to provide clock to every peripheral used?

Will the program work without this function?

 

Can anybody suggest any good tutorial for ASF, Please...

Silly beans are always silly
:)

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

If you try to access a peripheral without its clock being enabled, you will get a hard fault exception. Read the chip documentation carefully!

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

Harikrishnan911 wrote:
Comment says that it is to enable specified peripheral clock.

What does that really mean?

That description sounds perfectly clear, precise & unambiguous - it says exactly what it means!

 

Harikrishnan911 wrote:
Is it necessary to provide call this function to provide clock to every peripheral used?

It is necessary to enable the peripheral's clock before that peripheral can be used.

 

Will the program work without this function?

The hardware will not work without its clock!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you.

I do have a lot of query regarding asf.

Can you help me?

Silly beans are always silly
:)

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

i assume that we will have to enable peripheral clock for every peripherals to work.

but i could seem some programs work without that line, say a program to used user programmable switch to trigger an external interrupt. the program works w/ and w/o the peripheral clock function.

 

I wonder what is happening...surprise

Silly beans are always silly
:)

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

ASF drivers (in my experience which is not with SAM E70) will usually enable clocks as needed.

Edit: looks to be the case for SAME70 also, e.g., here in usart_serial_init:
 

# ifdef UART0
if (UART0 == (Uart*)p_usart) {
    sysclk_enable_peripheral_clock(ID_UART0);
    /* Configure UART */
    uart_init((Uart*)p_usart, &uart_settings);
}
# endif

sysclk_enable_peripheral_clock is simply:

static inline void sysclk_enable_peripheral_clock(uint32_t ul_id)
{
    pmc_enable_periph_clk(ul_id);
}

/Lars

Last Edited: Fri. Sep 30, 2016 - 09:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Lajon wrote:
ASF drivers (in my experience which is not with SAM E70) will usually enable clocks as needed.

Agree.

 

That is the whole point of ASF.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you guys.

yes

Silly beans are always silly
:)

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

Thanks a lot...

smileyyes

Silly beans are always silly
:)

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

Though it was tough initially, i am really getting understand how ASF works.

I do have miles to cover, but the bright side is I have started doing some coding using AFS.

By now, i have done some coding on SPI, TWI, Timer, pullups, usart, RTC & interrupts.

and the funniest past is that it works.winksmiley

Silly beans are always silly
:)