Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 17 of 17

Thread: CPU Clock speed for Teensy 3.0

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    7

    CPU Clock speed for Teensy 3.0

    Im trying to lower the CPU clock speed for the Teensy 3.0, when I use the code as per the Teensy website for CPU Clock Speed I get an error, but when I run it on the teensy 2.0 it compiles. Can someone explain this or let me know what I have to do. Its the last part f the project so Im hoping to get this sorted asap.
    Thanks.

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    lower CPU speed for power conservation reasons?

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    7
    Yes, Im using a 3.7volt 110mAh Lithium battery and I only need the clock speed at roughly 1 Mhz to do what I need. please say you have an easy solution?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,929
    Quote Originally Posted by frgl View Post
    I get an error,
    Please follow these guidelines when asking technical questions.

    http://forum.pjrc.com/threads/15136-...-Your-Question!

    Really, I do want to help you. I just can't with so little information.

  5. #5
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    7
    Sorry,
    When I add the code as per the PJRC website to my code and try compile it I get the following.
    Click image for larger version. 

Name:	screenshot.png 
Views:	544 
Size:	69.7 KB 
ID:	1481

    However when I compile the code selecting the Teensy 2.0 board the code will work but not for my board which is the Teensy 3.0.
    How do I alter the speed for the 3.0 version?

  6. #6
    Senior Member duff's Avatar
    Join Date
    Jan 2013
    Location
    Las Vegas
    Posts
    949
    that won't work, two different beasts. Teensy 3.0 is arm chip, take a look at my Low-Power library, I have code for scaling the processor speed, look at the CPU function in the LowPower_Teensy3.cpp that uses mcg.c file. Its complicated so be warned but it should get you started. You also can use the library but right now it is in flux and I don't have an example for CPU scaling currently but its pretty easy just call the CPU(speed) function; the configured speeds are 2,4,8,16,24,48,96 MHz.

    One warning is that if you plan to use anything lower than 24MHz, USB will not work and also the Teensy core is not configured for anything lower. I have ported some stuff over to use slower clock rates but there is still lots that will not work as expected. I'm working on getting the most used features ported now but it's not that easy.

    duff

  7. #7
    Junior Member
    Join Date
    Feb 2014
    Posts
    3
    Quote Originally Posted by frgl View Post
    Sorry,
    When I add the code as per the PJRC website to my code and try compile it I get the following.
    Click image for larger version. 

Name:	screenshot.png 
Views:	544 
Size:	69.7 KB 
ID:	1481

    However when I compile the code selecting the Teensy 2.0 board the code will work but not for my board which is the Teensy 3.0.
    How do I alter the speed for the 3.0 version?
    I am having the same problem. I am using Teensy 3.1, and have no idea how to change the clock speed in arduino.
    The same error, clkpr not defined. Wonder how to change the CPU clock speed in arduino

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    I suggest the strategy for power conservation on ARMs and Teensy is to code for sleeping and low power state for 90% or more of the time, on average.

  9. #9
    Junior Member
    Join Date
    Feb 2014
    Posts
    3
    Click image for larger version. 

Name:	problem.PNG 
Views:	265 
Size:	14.3 KB 
ID:	1492

    I am using Teensy 3.1, simply try to use 16MHz for clock speed. The program is simply a blink one, to test the clock speed.
    The error is CLKPR not declared.

    I am running Teensyduino on Windows 7.

    Does this function only work on C + makefile? Or can I include a header file to make this work on a Teensyduino

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,929
    That's AVR-only code. It's also code that generally is meant for stand-alone use, without Arduino.

    Teensyduino makes this very easy. Just use the Tools > CPU Speed menu.

    On Teensy 3.1, the minimum speed is 24 MHz.

  11. #11
    Junior Member
    Join Date
    Feb 2014
    Posts
    3
    Quote Originally Posted by PaulStoffregen View Post
    That's AVR-only code. It's also code that generally is meant for stand-alone use, without Arduino.

    Teensyduino makes this very easy. Just use the Tools > CPU Speed menu.

    On Teensy 3.1, the minimum speed is 24 MHz.
    I am just to confirm. So that using Arduino, the Teensy is working by default at a clock speed of 96 MHz?

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,929
    Yes, the menu defaults to 96 MHz.

  13. #13
    Member
    Join Date
    Jan 2014
    Location
    London, UK
    Posts
    76
    Quote Originally Posted by PaulStoffregen View Post
    Yes, the menu defaults to 96 MHz.
    Sorry to hijack thread, but is it possible to go higher on the overclock? Would this affect the PWM peripheral hardware, or is that locked to a separate clock? I'm keen to get the resolution of the PWM up a bit, with very successful test of 8bit, 15Khz audio playback running the PWM at around 32Khz, it would be fun to try and aim for something a bit higher quality.

  14. #14
    Member
    Join Date
    Jan 2014
    Location
    Iowa, USA
    Posts
    23
    Will a selection of 72Mhz for the Teensy 3.1 be added soon? Or will the 96Mhz setting work? If the point of the 3.1 is the added speed, it would be a shame to limit it to 48Mhz.

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,929
    Quote Originally Posted by DrOldies View Post
    Will a selection of 72Mhz for the Teensy 3.1 be added soon?
    If you consider "soon" about 4-5 months, then yes.

    Or will the 96Mhz setting work?
    Yes, 96 MHz works fine. I develop and test everything for Teensy 3.1 at 96 MHz.

    Technically it's overclocking. But all these K20 chips are made on the same 90 nm process, and all the I/O still runs at 48 MHz when the CPU is at 96 MHz.


    If the point of the 3.1 is the added speed, it would be a shame to limit it to 48Mhz.
    If you need the speed, just use it. But 48 MHz and 24 MHz consume less power, and they're still plenty fast enough for many applications.

  16. #16
    Junior Member
    Join Date
    Apr 2019
    Posts
    1

    Teensy 3.1 8Mhz

    Quote Originally Posted by PaulStoffregen View Post
    If you consider "soon" about 4-5 months, then yes.



    Yes, 96 MHz works fine. I develop and test everything for Teensy 3.1 at 96 MHz.

    Technically it's overclocking. But all these K20 chips are made on the same 90 nm process, and all the I/O still runs at 48 MHz when the CPU is at 96 MHz.




    If you need the speed, just use it. But 48 MHz and 24 MHz consume less power, and they're still plenty fast enough for many applications.
    Hi Paul, I configured the CPU speed at 8 MHz of my Teensy 3.1 and now it doesn't work more, what I can do to revive it?

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,929
    Quote Originally Posted by Joel_CC View Post
    Hi Paul, I configured the CPU speed at 8 MHz of my Teensy 3.1 and now it doesn't work more, what I can do to revive it?
    I believe you also sent me an email message, right?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •