Hello All,
I got my Uno R3 (DIP) three weeks ago.
I'm currently spinning ideas and testing code.
For the actual hardware (a remote controller) I'm considering getting a Fio + XBee.
I noticed the Fio runs at 8MHz, so I'd like to test my code at that speed on the Uno,
before investing in new boards.
Is there a way to simulate that?
E.g. like throttling the ATMega328?
I'm trying to pin down potential performance issues.
Thanks a lot!
Michael.
I don't think so.
You could change the crystal, but the complier would be expecting 16MHz and that would mess-up any timing in your firmware. (i.e. delay(1000) would delay for 2 seconds.) I don't if there's a compiler option for an 8MHz device (that would solve the timing issue), but there would probably be something else device-specific that would get messed-up if you use the wrong compiler-option.
For the actual hardware (a remote controller)
Processor speed shouldn't be an issue in that application.
Hi, thanks for the fast reply!
DVDdoug:
I don't think so.You could change the crystal, but the complier would be expecting 16MHz and that would mess-up any timing in your firmware. (i.e. delay(1000) would delay for 2 seconds.) I don't if there's a compiler option for an 8MHz device (that would solve the timing issue), but there would probably be something else device-specific that would get messed-up if you use the wrong compiler-option.
I think that's easily solved with adding a new entry to the boards.txt file.
I did that (by copying the original Uno entry) and changed the line for the clock speed from 16000000 to 8000000.
Now the compiler's reference is 8MHz and every clock speed related timing is properly being messed up. ]![]()
(including the speed of the serial port, which I wasn't prepared for, to be honest - why is that, BTW? The UART uses the same clock?)
For the actual hardware (a remote controller)
Processor speed shouldn't be an issue in that application.
no it shouldn't, but the code is growing fast.
OTOH I'm learning, so it's some basic curiosity as well.
The f_cpu entry in boards.txt only tells the compiler the speed of the clock, it does not change the hardware to run at that speed.
this is what I was trying to say.
i.e. when running the blink-LED example using this 8MHz entry the LED goes on and off twice as fast.
But what's the UART to do with that?
There is a register (CLKPR ) that can be accessed by software that can divide the system clock but it requires a special write special bit -write value sequence that must be done in 4 cycles for it to work ( don't know if it can be done other than using inline assembly to do it). There is a factor of 2 available so the UNO can be made to actually run at 8MHz ( have not done this but it is a feature of the mega328 chip).
ah, thanks - that sounds like the way to go. I found the relevant reference in the data sheets, looks promising,
but I see I'll have to do a lot more of reading to find out how to achieve things.
If/when I've a solution I'll post it here.
Thanks - Michael.