Question about CLKMODE
Reinhard
Posts: 489
Hi,
should it be possible to change the CLKMODE at runtime.
with this piece of code, it seem's not:
but with differnt parameters at loading the code:
propeller-load -pcom6 -D clkmode=RCSLOW -D clkfreq=20000 -r rcmode.elf
or
propeller-load -pcom6 -D clkmode=RCFAST -D clkfreq=120000000 -r rcmode.elf
I see an effect. (observe the pin with an oszi)
Maybe I have misunderstood this feature ?
should it be possible to change the CLKMODE at runtime.
with this piece of code, it seem's not:
#include "propeller.h" #define P0 (1<<0) #define RCFAST 0 #define RCSLOW 1 void main () { unsigned x = 0; DIRA |= P0; for(;;) { OUTA ^= P0; x++; if(x == 1000) { CLKMODE(RCFAST); } if(x == 2000) { CLKMODE(RCSLOW); x=0; } } }
but with differnt parameters at loading the code:
propeller-load -pcom6 -D clkmode=RCSLOW -D clkfreq=20000 -r rcmode.elf
or
propeller-load -pcom6 -D clkmode=RCFAST -D clkfreq=120000000 -r rcmode.elf
I see an effect. (observe the pin with an oszi)
Maybe I have misunderstood this feature ?
Comments
On loading the code it does work because the Spin interpreter that boots gcc reads that variable and sets the clock mode based on it.
Eric
Yes, this is my bug. I'm opening an issue on it.
I would call it CLKSET, but that has a different meaning in SPIN. Opinions?
Thanks,
--Steve
CLKMODE will become a read-only macro like CLKFREQ.
A macro clkset(mode, frequency) will be added.
All macros that use a __builtin_propeller_* function are lower case.
CLKMODE and CLKFREQ are variables that can be read or written.
Sounds good !
Can not await next version :-)
Today I have downloaded the 0_1_9 version and the first experiment is the clkset demo,
because just in time I finished a little hardware work with only a DIP40 Propeller chip and RS232 converter from MAXIM.
No XTAL and no EEPROM currently in use. RCMODE only.
The modified version, included in the demo pack, shows the effect of clockswitch better than my origin.
(observed with an oszi ).
Many Thanks to the Team !!!
If I remember right ( for United States ) happy Thanksgiving.