Forum: µC & Digital Electronics Help me understand SAM9260's clocks

Author: A. S. (aleksazr)
Posted on:

Rate this post
0 useful
not useful
I've started programming AT91SAM9260 and some
things are not clear to me.

At first, sam-ba was giving me problems
(see http://embdev.net/topic/184418),
so I created a small win32 app to mimic sam-ba.

On reset, sam9260 sends "RomBOOT>" and then listens to commands.
I then issue some commands to write to internal SRAM
and then execute it. All that works.

Speed is what interests me now, so I set the led,
then clear it, in a loop. There are some 80 sets/resets
and one jump, to minimize jump's execution time effect.

The instruction are:
  str  r3, [r2, #-203]  ; 0xcb  // clear
  str  r3, [r2, #-207]  ; 0xcf  // set

I have a 18.432 MHz clock, and this what I use for PLL:

  #define PLLA_SETTINGS  0x2060BF09

or, to write it in a more readable way:

  #define DIVA 9
  #define PLLACOUNT 63
  #define OUTA 2
  #define MULA 96
  #define PLLA_SETTINGS (1 << 29 | MULA << 16 | OUTA << 14 | PLLACOUNT 
<< 8 | DIVA)

PLL's R1,C1,C2 are 1k, 10n and 1n, as in all schematics.

Before I work with the PLLA, I first switch from PLLB
(romboot was using it) to slow clock as the master clock.

The fastest I got was 40ns per instruction.
(i.e. 40ns per set, 40ns per clear)

and that is only if MDIV field in PMC_MCKR is set to 00
(master clock is processor clock).

If MDIV is 01 (master clock is processor clock divided by 2)
then I have 60ns per instruction. If it were 80ns, that
would make more sense... but it isn't.

First of all, I thought that master clock has nothing to
do with CPU clock, with the execution of CPU instructions.
I thought that Master clock is for SDRAM, peripherals,
sampling the inputs, etc... but not for CPU instruction clock.

Or, are instructions accessing peripherals executed
differently than others?


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.