Propeller system clock performance
Scott Lewis
Posts: 18
I am not sure if the performance I am seeing is accurate. I have the propeller education board with a 5.0 MHz crystal and am using the 16x PLL to get a clock of 80 MHz. Is this clock split between all the cores, resulting in 10 MHz per core, or does each core get the whole 80 MHz.
I ran a test to see how fast a core could switch an output pin and do nothing else and i got about 43 kHz, I think it should be more than this. Here is the code I used and a screenshot from my oscilloscope.
I ran a test to see how fast a core could switch an output pin and do nothing else and i got about 43 kHz, I think it should be more than this. Here is the code I used and a screenshot from my oscilloscope.
CON _xinfreq = 5_000_000 _clkmode = xtal1 + pll16x var long stack[noparse][[/noparse]20] PUB main cognew(start(15),@stack[noparse][[/noparse]0]) Pub start(Pin) dira[noparse][[/noparse]Pin]~~ repeat !outa[noparse][[/noparse]Pin]
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
2) Your program is written in Spin which is compiled into byte codes that are interpreted by a program running in a cog. The speed you're seeing is about right. If you rewrote the program in the Propeller's assembly language, you'd be able to toggle an I/O pin every 8 clock cycles (about 100ns).
3) As Paul mentioned, you can use the cog counters (see application note #001) from either Spin or assembly language to generate pulse trains of at least 128MHz
Post Edited (Mike Green) : 11/14/2008 10:23:57 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
If you use the following code:
it will toggle the output pin @ 10 MHz, this is the fastest you can drive a pin from code. Using the counter can achieve frequencies up to 128 MHz when using the PLL mode of operation.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Example, say a N cycle positive pulse:
- set FRQ to 1
- set PHS to 232 - N
- set counter to NCO mode %00100 (PHS bit 31 = output)
- waitcnt for longer pulses > 4 cycles (calculate beforehand)
- stop the counter (CTR = 0) or reload PHS
How it works: this sets the counter to output a very slow square wave of 2^32 cycles (about 54 seconds at 80 MHz), but more importantly starts the counter N cycles before it is about to transition from 1 to 0. There is lots of time after the transition to stop the counter (pseudo "one-shot") or restart it.
If you want to send out back-to-back short pulses like this, then you have to use multiple synchronized cogs (waitcnt), as the counter setup takes at least 16 cycles per pulse.