Teensy 3.0 chip speed

Status
Not open for further replies.

renasis

Active member
Hello,

When you set the clock frequencyfrom the drop down in the Arduino IDE does it make change on the chip? Or is there an additional step that is needed, a line in sketch...etc?

Thanks,

-ren
 
No additional steps needed.

The crystal connected to the MK20 (the Teensy 3's MCU) runs at 16 Mhz, and circuitry inside the MK20 (called a phase-locked loop) multiplies this up to 96 Mhz. When you pick the speed option inside the IDE it sets a compiler flag, and the compiler generates startup code that sets the system frequency to full speed (96 Mhz), half (48), or or quarter speed (24 Mhz). You can look at mk20dx128.c in hardware / teensy / cores / teensy3 of your Arduino program directory if you're really interested.

[edit - clarity]
 
Last edited:
Well, you do have to upload after changing the speed, since that setting controls how your program is compiled. The new speed takes effect when Teensy3 reboots after the upload.

But there's no other changes needed, like physically changing the crystal (as you would do on an official Arduino board) or editing anything else. All the timing stuff, like delay(), millis(), IntervalTimer, all automatically adjusts to the new CPU speed.

Of course, your program will run slower. If your code depends upon the CPU speed, you'll need to make whatever adjustments are needed in your own software.
 
Status
Not open for further replies.
Back
Top