SX Runtime Freq Change
william chan
Posts: 1,326
Anybody,
Is there a way to change SX oscillation frequencies during runtime without re-downloading?
Let's say the SX is running at 4Mhz to save current consumption, then to perform so difficult tasks,
make itself run at 50Mhz for a short while?
I think it's never been done before...
Thanks.
Is there a way to change SX oscillation frequencies during runtime without re-downloading?
Let's say the SX is running at 4Mhz to save current consumption, then to perform so difficult tasks,
make itself run at 50Mhz for a short while?
I think it's never been done before...
Thanks.
Comments
The SX has an internal RC oscillator that runs at a nominal 4 MHz. Anything other than that clock is provided by an external oscillator. There is no way to change the SX's clock speed because it has a fixed frequency clock.
The FREQ directive is there to tell the SX key what speed clock to generate. The idea is that while you are debugging, the SX-Key provides the clock, and it needs to be whatever frequency you will need in the final project. Later, when you are running the SX chip standalone, you provide an external oscillator that runs at whatever speed you had told the SX-Key to run at.
If you want to do what you are thinking of, you'll need to design a clock circuit that can switch between different speeds. However, that is entirely up to you and your hardware design, and has noting to do with the SX chip itself.
Thanks,
PeterM
I've never tried this, but you may be able to do something similar on the SX, if you are using an external R/C oscillator circuit.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
But the device will behave as though it was just turned on when it wakes up, so youll need to set a bit before sleeping and test it upon waking up to determine if you are turning on or waking up (this method is used to start in the same place each time you wake up), or if you need to reenter where you left off (when you slept or any arbitrary point) you can store the PC of your reentry point and "pop" it when you wake up (SX doesnt give you direct access to the stack, so you'll have to mimic it by writing the stored reentry point into the PC (and page if nessesary), upon startup you have nothing in the stack so doing this will not interfere with expected operation of the stack).
Andrew's method would work too, just put an EEPOT (AKA Digital Potentiometer) in place of the resistor, but this solution would kill the SX's determinism since it would take some time to scale up or down the frequency (for EEPOTS which only have WIPEUP and WIPEDOWN controls, serial interfaces usually have a SET R=Val command but even here there will be considerable jitter as the SX adjusts to the new frequency). This means if you are doing realtime IO control where you must be able to compare two time events which exist at different frequencies, you will need to add a realtime clock since using SX cycle timing methods will not be accurate.
This also means that the timing of anything connected to the SX may no-longer work (SPI, I2C, uWire, etc) since the times of the RTCC timer overflows will occur at different rates. There are work arrounds possible by knowing the EEPOT value and calculating the RC time constant and SX cycle time on the fly, but this will complicate the writing of any isr. Or use an external source for your RTCC. If you combined both methods you could generate the wakeup signal using a divide by 2^n circuit of the RTCC clock.
-Paul
Post Edited (Coriolis) : 8/7/2004 6:58:39 PM GMT
In fact, the SX-Key can be used as the runtime clock source. The tools used to provide (maybe they still do, I haven't checked for a while) a slider to adjust the clock at will. It worked but only by maintaining the clock phase continuity.
A good value in my opinion
You can adjust the clock output to many different frequencies via the I2C bus.
The trick is to remember what you set the frequency to [noparse];)[/noparse]