Sign in

username:

password:



Not a member?

Search AT91SAM



Search tips

Subscribe to AT91SAM



Ads

Discussion Groups

Discussion Groups | AT91SAM ARM | AT91SAM9260 timer register

For users of the Atmel AT91SAM7 and AT91SAM9 ARM CPU chips. Atmel has taken a new direction by combining on chip flash and ram with the ARM CPU on a single die. This provides low cost devices for small systems using the ARM CPU. This group is to exchange information to help users get started and learn how to use the devices.

AT91SAM9260 timer register - "ICLI, Bekir (EXT)" - Jan 17 6:18:50 2008

Hi,

I want to implement a time measurement function which i can use for
different kinds of purposes.
>From my earlier experiences with other processors (powerpc), i know that
there is a timer register which increments with the cpu clock.
Therefore, the calculation was easy and straightforward.
Does anybody have such kind of experience or knowledge, whether
AT91SAM9260 has such a timer register?

PS: I have seen the timer counters which work at most half the master
clock fast, but just wanted to makes sure if there was a hardwired timer
register.

Best regards

Bekir ICLI

msgId=3032/stime=1196348684/nc1=3848621/nc2=4507179/nc3=4834088>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )


Re: AT91SAM9260 timer register - Eric Pasquier - Jan 17 7:47:12 2008

Hi Bekir,

SAM9260 has 3 timers (TC) that you can use to measure external events like width or period of a pulse with a 16 bits resolution of a selectable clock.
It also have a "real time timer" (RTTC) which can be used for longer events, but with a lower resolution (32kHz clock max).
And, you also have a "periodic interval timer" (PIT) that can be used to increment a "software clock" and a defined rate.

The use of each timer depends of your application and what you would like to measure.

I hope this help.
Eric Pasquier

----- Original Message -----
From: ICLI, Bekir (EXT)
To: A...@yahoogroups.com
Sent: Thursday, January 17, 2008 12:15 PM
Subject: [AT91SAM] AT91SAM9260 timer register

Hi,

I want to implement a time measurement function which i can use for different kinds of purposes.
From my earlier experiences with other processors (powerpc), i know that there is a timer register which increments with the cpu clock.
Therefore, the calculation was easy and straightforward.
Does anybody have such kind of experience or knowledge, whether AT91SAM9260 has such a timer register?

PS: I have seen the timer counters which work at most half the master clock fast, but just wanted to makes sure if there was a hardwired timer register.
Best regards

Bekir ICLI



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

AW: AT91SAM9260 timer register - "ICLI, Bekir (EXT)" - Jan 17 8:26:35 2008

Hi Eric,

Thanks for the answer.
My specific interest in this is that I need to measure how long, for example, my data copy operation takes.
And I want to be precise on that. So RTTC is out of question. I guess I should use TC0 which works with MCK/2.
But I do not understand what is MCK.
There are "Main Clock", "Master Clock", "Processor Clock", "PLL", "MCK".. And I am really lost in them, what they are used for.

In the example code delivered with the devkit, it says
#define BOARD_MAINOSC 18432000

#define BOARD_MCK (((18432000 * 97) / 9)/2)

And there is this

/* Initialize PLLA at 200MHz (198.656) */

AT91C_BASE_PMC->PMC_PLLAR = BOARD_CKGR_PLLA

| BOARD_PLLACOUNT /* 63<<8 */

| BOARD_MULA /* 96<<16 */

| BOARD_DIVA; /* 9 */

I understand here he is trying to do the settings for getting MCK, but he is doing these settings in PLL register.

That I dont understand why. :( Also in the manual, it says that main oscillator is 12 MHz, but here he sets it to 18432000..

I am so confused in all these..

Mit freundlichem Gruß / Best regards

Bekir ICLI
________________________________

Von: A...@yahoogroups.com [mailto:A...@yahoogroups.com] Im Auftrag von Eric Pasquier
Gesendet: Donnerstag, 17. Januar 2008 13:35
An: A...@yahoogroups.com
Betreff: Re: [AT91SAM] AT91SAM9260 timer register

Hi Bekir,

SAM9260 has 3 timers (TC) that you can use to measure external events like width or period of a pulse with a 16 bits resolution of a selectable clock.
It also have a "real time timer" (RTTC) which can be used for longer events, but with a lower resolution (32kHz clock max).
And, you also have a "periodic interval timer" (PIT) that can be used to increment a "software clock" and a defined rate.

The use of each timer depends of your application and what you would like to measure.

I hope this help.
Eric Pasquier

----- Original Message -----
From: ICLI, Bekir (EXT)
To: A...@yahoogroups.com
Sent: Thursday, January 17, 2008 12:15 PM
Subject: [AT91SAM] AT91SAM9260 timer register

Hi,

I want to implement a time measurement function which i can use for different kinds of purposes.
From my earlier experiences with other processors (powerpc), i know that there is a timer register which increments with the cpu clock.
Therefore, the calculation was easy and straightforward.
Does anybody have such kind of experience or knowledge, whether AT91SAM9260 has such a timer register?

PS: I have seen the timer counters which work at most half the master clock fast, but just wanted to makes sure if there was a hardwired timer register.

Best regards

Bekir ICLI





(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

AW: AT91SAM9260 timer register - Matthias Wieloch - Jan 17 10:50:13 2008

Besides, If you want to measure how much time a copy operation takes you can
use a free PIO Pin as output that you set on start and clear on end of
operation and use an oscilloscope to measure the time the pin was set high.
Or if you are sending data to an external peripheral you could watch the
corresponding pins with an oscilloscope.

_____

Von:
sentto-14415064-3210-1200575568-matthias_wieloch=w...@returns.groups.yahoo
.com
[mailto:sentto-14415064-3210-1200575568-matthias_wieloch=w...@returns.grou
ps.yahoo.com] Im Auftrag von ICLI, Bekir (EXT)
Gesendet: Donnerstag, 17. Januar 2008 14:13
An: A...@yahoogroups.com
Betreff: AW: [AT91SAM] AT91SAM9260 timer register

Hi Eric,

Thanks for the answer.

My specific interest in this is that I need to measure how long, for
example, my data copy operation takes.

And I want to be precise on that. So RTTC is out of question. I guess I
should use TC0 which works with MCK/2.

But I do not understand what is MCK.

There are "Main Clock", "Master Clock", "Processor Clock", "PLL", "MCK"..
And I am really lost in them, what they are used for.

In the example code delivered with the devkit, it says

#define BOARD_MAINOSC 18432000

#define BOARD_MCK (((18432000 * 97) / 9)/2)

And there is this

/* Initialize PLLA at 200MHz (198.656) */

AT91C_BASE_PMC->PMC_PLLAR = BOARD_CKGR_PLLA

|
BOARD_PLLACOUNT /* 63<<8 */

|
BOARD_MULA /* 96<<16 */

|
BOARD_DIVA; /* 9 */

I understand here he is trying to do the settings for getting MCK, but he is
doing these settings in PLL register.

That I dont understand why. :( Also in the manual, it says that main
oscillator is 12 MHz, but here he sets it to 18432000..

I am so confused in all these..

Mit freundlichem Gruß / Best regards

Bekir ICLI

_____

Von: A...@yahoogroups.com [mailto:A...@yahoogroups.com] Im Auftrag von
Eric Pasquier
Gesendet: Donnerstag, 17. Januar 2008 13:35
An: A...@yahoogroups.com
Betreff: Re: [AT91SAM] AT91SAM9260 timer register

Hi Bekir,

SAM9260 has 3 timers (TC) that you can use to measure external events like
width or period of a pulse with a 16 bits resolution of a selectable clock.

It also have a "real time timer" (RTTC) which can be used for longer events,
but with a lower resolution (32kHz clock max).

And, you also have a "periodic interval timer" (PIT) that can be used to
increment a "software clock" and a defined rate.

The use of each timer depends of your application and what you would like to
measure.

I hope this help.

Eric Pasquier

----- Original Message -----

From: ICLI, Bekir (EXT)

To: AT91SAM@yahoogroups .com

Sent: Thursday, January 17, 2008 12:15 PM

Subject: [AT91SAM] AT91SAM9260 timer register

Hi,

I want to implement a time measurement function which i can use for
different kinds of purposes.

>From my earlier experiences with other processors (powerpc), i know that
there is a timer register which increments with the cpu clock.

Therefore, the calculation was easy and straightforward.

Does anybody have such kind of experience or knowledge, whether AT91SAM9260
has such a timer register?

PS: I have seen the timer counters which work at most half the master clock
fast, but just wanted to makes sure if there was a hardwired timer register.

Best regards

Bekir ICLI

d=3032/stime=1196348684/nc1=3848621/nc2=4507179/nc3=4834088>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: AT91SAM9260 timer register - Rick Collins - Jan 17 10:58:40 2008

These days, the documentation on the clocks of most any MCU is a bit
complex. The AT91SAM parts stand out as being very complicated, at
least judging by their documentation.

I am more familiar with the SAM7 parts where there are only two main
clock sources, a slow clock and the main clock. The SAM9260 seems to
have a third a crystal controlled low power, 32kHz oscillator. Oddly
enough the low power oscillator is only mentioned once in the clock
generator section.

These three sources then feed the rest of the chip through various
paths that, although may be documented completely, are not documented
clearly. The information you need is scattered around in the data
sheet. For example the low power oscillator is not really documented
at all in the clock generator section, but rather is described in
various places such as 9.0 System Controller and poorly at that!

The two clock sources (or is it three?) are fed into clock
distribution. If you look at the diagram in section 9.5, power
management, you will see that there is a lot to configure in the clock
distribution. One of those outputs is MCLK which is mainly used to
clock the peripherals and can be the processor clock divided by 1, 2,
3 or 4.

The bottom line is that, if you really want to understand it, you have
to read the entire manual and construct your own unified documentation
of the clock generation and distribution. Besides, remember when you
had to give book reports in elementary school? That was because once
you study something well enough to document it, you should know it
pretty durn well!



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

AW: AT91SAM9260 timer register - Matthias Wieloch - Jan 17 11:09:38 2008

The Master Clock (MCK) defines the frequency of the controller. The MCK can
be derived from Slow Clock (SCK), Main Clock (MAINCK), or PLL Clock (PLLCK).

SCK is generated by an internal RC Oscillator and it is not possible to
change it.

Most eval boards with Atmel processors use an 18,432MHz crystal Main
Oscillator (responsible for Main Clock). The main oscillator can be bypassed
(as most applications do) when using the PLL to generate MCK.

As far as you code snippet goes you are right the MCK is set by PLL. I don’t
know any details of the SAM9260 but I think the mechanism is similar to SAM7
series.

The Power Management Controller is set to use PLL to generate MCK with
divider 9 and multiplier 96.

In general MCK generation works as follows:

In one register you choose which clock is used to generate MCK, as far as I
know this can be SCK, MAINCK or PLL, and a prescaler.

If PLL is used for MCK generation: Main Clock (18,423 MHz) is divided by
PLL_DIV (9) and multiplied by PLL_MUL + 1 (96 + 1) = PLLCK (198,656MHz)

Then at the end the prescaler determines how fast the MCK goes. In your
example the prescaler divides the input clock by 2, so the MCK on your eval
board is 99,328 MHz.

For further details have a look in the datasheet, especially the chapters
about PMC, Clock generator and System Controller, and see how the demo
application handles this on initialisation.

_____

Von:
sentto-14415064-3210-1200575568-matthias_wieloch=w...@returns.groups.yahoo
.com
[mailto:sentto-14415064-3210-1200575568-matthias_wieloch=w...@returns.grou
ps.yahoo.com] Im Auftrag von ICLI, Bekir (EXT)
Gesendet: Donnerstag, 17. Januar 2008 14:13
An: A...@yahoogroups.com
Betreff: AW: [AT91SAM] AT91SAM9260 timer register

Hi Eric,

Thanks for the answer.

My specific interest in this is that I need to measure how long, for
example, my data copy operation takes.

And I want to be precise on that. So RTTC is out of question. I guess I
should use TC0 which works with MCK/2.

But I do not understand what is MCK.

There are "Main Clock", "Master Clock", "Processor Clock", "PLL", "MCK"..
And I am really lost in them, what they are used for.

In the example code delivered with the devkit, it says

#define BOARD_MAINOSC 18432000

#define BOARD_MCK (((18432000 * 97) / 9)/2)

And there is this

/* Initialize PLLA at 200MHz (198.656) */

AT91C_BASE_PMC->PMC_PLLAR = BOARD_CKGR_PLLA

|
BOARD_PLLACOUNT /* 63<<8 */

|
BOARD_MULA /* 96<<16 */

|
BOARD_DIVA; /* 9 */

I understand here he is trying to do the settings for getting MCK, but he is
doing these settings in PLL register.

That I dont understand why. :( Also in the manual, it says that main
oscillator is 12 MHz, but here he sets it to 18432000..

I am so confused in all these..

Mit freundlichem Gruß / Best regards

Bekir ICLI

_____

Von: A...@yahoogroups.com [mailto:A...@yahoogroups.com] Im Auftrag von
Eric Pasquier
Gesendet: Donnerstag, 17. Januar 2008 13:35
An: A...@yahoogroups.com
Betreff: Re: [AT91SAM] AT91SAM9260 timer register

Hi Bekir,

SAM9260 has 3 timers (TC) that you can use to measure external events like
width or period of a pulse with a 16 bits resolution of a selectable clock.

It also have a "real time timer" (RTTC) which can be used for longer events,
but with a lower resolution (32kHz clock max).

And, you also have a "periodic interval timer" (PIT) that can be used to
increment a "software clock" and a defined rate.

The use of each timer depends of your application and what you would like to
measure.

I hope this help.

Eric Pasquier

----- Original Message -----

From: ICLI, Bekir (EXT)

To: AT91SAM@yahoogroups .com

Sent: Thursday, January 17, 2008 12:15 PM

Subject: [AT91SAM] AT91SAM9260 timer register

Hi,

I want to implement a time measurement function which i can use for
different kinds of purposes.

>From my earlier experiences with other processors (powerpc), i know that
there is a timer register which increments with the cpu clock.

Therefore, the calculation was easy and straightforward.

Does anybody have such kind of experience or knowledge, whether AT91SAM9260
has such a timer register?

PS: I have seen the timer counters which work at most half the master clock
fast, but just wanted to makes sure if there was a hardwired timer register.

Best regards

Bekir ICLI

d=3032/stime=1196348684/nc1=3848621/nc2=4507179/nc3=4834088>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: AT91SAM9260 timer register - Eric Pasquier - Jan 17 11:45:43 2008

Just check your Crystal frequency, if it is 12MHz or 18.432MHz.

Eric
----- Original Message -----
From: ICLI, Bekir (EXT)
To: A...@yahoogroups.com
Sent: Thursday, January 17, 2008 4:40 PM
Subject: AW: [AT91SAM] AT91SAM9260 timer register

The exact explanation I needed..!
Really appreciated..

Mit freundlichem Gruß / Best regards

Bekir ICLI

------------------------------------------------------------------------------
Von: A...@yahoogroups.com [mailto:A...@yahoogroups.com] Im Auftrag von Matthias Wieloch
Gesendet: Donnerstag, 17. Januar 2008 16:35
An: A...@yahoogroups.com
Betreff: AW: [AT91SAM] AT91SAM9260 timer register

The Master Clock (MCK) defines the frequency of the controller. The MCK can be derived from Slow Clock (SCK), Main Clock (MAINCK), or PLL Clock (PLLCK).

SCK is generated by an internal RC Oscillator and it is not possible to change it.

Most eval boards with Atmel processors use an 18,432MHz crystal Main Oscillator (responsible for Main Clock). The main oscillator can be bypassed (as most applications do) when using the PLL to generate MCK.
As far as you code snippet goes you are right the MCK is set by PLL. I don't know any details of the SAM9260 but I think the mechanism is similar to SAM7 series.

The Power Management Controller is set to use PLL to generate MCK with divider 9 and multiplier 96.

In general MCK generation works as follows:

In one register you choose which clock is used to generate MCK, as far as I know this can be SCK, MAINCK or PLL, and a prescaler.

If PLL is used for MCK generation: Main Clock (18,423 MHz) is divided by PLL_DIV (9) and multiplied by PLL_MUL + 1 (96 + 1) = PLLCK (198,656MHz)

Then at the end the prescaler determines how fast the MCK goes. In your example the prescaler divides the input clock by 2, so the MCK on your eval board is 99,328 MHz.
For further details have a look in the datasheet, especially the chapters about PMC, Clock generator and System Controller, and see how the demo application handles this on initialisation.

------------------------------------------------------------------------------

Von: sentto-14415064-3210-1200575568-matthias_wieloch=w...@returns.groups.yahoo.com [mailto:sentto-14415064-3210-1200575568-matthias_wieloch=w...@returns.groups.yahoo.com] Im Auftrag von ICLI, Bekir (EXT)
Gesendet: Donnerstag, 17. Januar 2008 14:13
An: A...@yahoogroups.com
Betreff: AW: [AT91SAM] AT91SAM9260 timer register
Hi Eric,
Thanks for the answer.

My specific interest in this is that I need to measure how long, for example, my data copy operation takes.

And I want to be precise on that. So RTTC is out of question. I guess I should use TC0 which works with MCK/2.

But I do not understand what is MCK.

There are "Main Clock", "Master Clock", "Processor Clock", "PLL", "MCK".. And I am really lost in them, what they are used for.
In the example code delivered with the devkit, it says

#define BOARD_MAINOSC 18432000

#define BOARD_MCK (((18432000 * 97) / 9)/2)

And there is this

/* Initialize PLLA at 200MHz (198.656) */

AT91C_BASE_PMC->PMC_PLLAR = BOARD_CKGR_PLLA

| BOARD_PLLACOUNT /* 63<<8 */

| BOARD_MULA /* 96<<16 */

| BOARD_DIVA; /* 9 */

I understand here he is trying to do the settings for getting MCK, but he is doing these settings in PLL register.

That I dont understand why. :( Also in the manual, it says that main oscillator is 12 MHz, but here he sets it to 18432000..

I am so confused in all these..
Mit freundlichem Gruß / Best regards

Bekir ICLI
------------------------------------------------------------------------------

Von: A...@yahoogroups.com [mailto:A...@yahoogroups.com] Im Auftrag von Eric Pasquier
Gesendet: Donnerstag, 17. Januar 2008 13:35
An: A...@yahoogroups.com
Betreff: Re: [AT91SAM] AT91SAM9260 timer register

Hi Bekir,
SAM9260 has 3 timers (TC) that you can use to measure external events like width or period of a pulse with a 16 bits resolution of a selectable clock.

It also have a "real time timer" (RTTC) which can be used for longer events, but with a lower resolution (32kHz clock max).

And, you also have a "periodic interval timer" (PIT) that can be used to increment a "software clock" and a defined rate.
The use of each timer depends of your application and what you would like to measure.
I hope this help.

Eric Pasquier

----- Original Message -----

From: ICLI, Bekir (EXT)

To: A...@yahoogroups.com

Sent: Thursday, January 17, 2008 12:15 PM

Subject: [AT91SAM] AT91SAM9260 timer register
Hi,
I want to implement a time measurement function which i can use for different kinds of purposes.

From my earlier experiences with other processors (powerpc), i know that there is a timer register which increments with the cpu clock.

Therefore, the calculation was easy and straightforward.

Does anybody have such kind of experience or knowledge, whether AT91SAM9260 has such a timer register?
PS: I have seen the timer counters which work at most half the master clock fast, but just wanted to makes sure if there was a hardwired timer register.

Best regards

Bekir ICLI



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )