SAM4S use programmable clock for peripheral clock [SOLVED]

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

Posts: 68
Joined: Mon Jan 26, 2015 2:33 pm

SAM4S use programmable clock for peripheral clock [SOLVED]

Wed May 11, 2016 10:27 am

Greetings all

I see many examples for using various peripherals, all of which use the system clock (MCK) as their clock source. However, SAM4S supports 3 programmable clock sources (GENCLK_PCK_0 through 2) which can be used for driving a peripheral's bus in place of the main system clock.

I can find how to setup a programmable clock - via genclk_enable_config() which calls all the various config_defaults, enable_source etc. etc. functions.

I can also enable the peripheral clock for a particular peripheral - via sysclk_enable_peripheral_clock() which calls the PMC equivalent function.

But... how do you then select the programmable clock you created, as the clock for a peripheral, instead of the system clock? That I cannot find.

And the ASF documentation has obviously never been updated for this case, as when I look at "Advanced use case - Peripheral Bus Clock Management (SAM4S)" the article is just a copy of the "System Clock Management" article. Atmel have not written the required data... they have still left in the place-holder text copied from the system clock article?!

If I have missed a previous posting on this topic, please forgive the repost... I have looked to see if the problem was already covered, but couldn't find a match.

Last edited by sarlacii on Tue May 17, 2016 8:42 am, edited 1 time in total.
Posts: 53
Joined: Wed Aug 19, 2015 9:44 pm

Re: SAM4S use programmable clock for peripheral clock source

Wed May 11, 2016 3:00 pm

Please read the PMC part of the data sheet. It seems that you're asking for a connection which does not exist in the hardware.

The peripheral clocks are gated from the master clock (MCK). There is no source multiplexer.

In my copy of the data sheet (11100D), there is a good diagram in part 28.2.3, figure 28-5.


Posts: 68
Joined: Mon Jan 26, 2015 2:33 pm

Re: SAM4S use programmable clock for peripheral clock source

Tue May 17, 2016 8:41 am

Thank you for the reply... I was hoping that the peripheral clocks could be routed individually like the SAMD20. But I discovered, as you say, that the clocks are not configurable like that in the SAM4. No worries though, I have used the 11.0592MHz XTAL as the main clock ref for everything (in the SAMD20 I routed it to the USART's only) which gives me my nice baud rates.


Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 1 guest