Shop OBEX P1 Docs P2 Docs Learn Events
Pllena — Parallax Forums

Pllena

Bobb FwedBobb Fwed Posts: 1,119
edited 2010-01-30 01:02 in Propeller 1
Manual p.29 said...
Allow 100 μs for the Clock PLL to stabilize before switching to one of its outputs via the CLKSELx bits. Once the Crystal Oscillator and Clock PLL circuits are enabled and stabilized, you can switch freely among all clock sources by changing the CLKSELx bits.
So how should I execute code to alter the PLL/XTAL?

In my program I am going into a low power mode:
clkset(%0_0_1_01_010, 5_000_000) 'no PLL



Then I want to ramp up the speed again. Do I have to do this:
clkset(%0_1_1_01_010, 5_000_000)
waitcnt(clkfreq / 10_000 + cnt) ' wait 100microseconds
clkset(%0_1_1_01_111, 80_000_000)



Or do I do this:
clkset(%0_1_1_01_011, 5_000_000) 'LSB change to use PLL1X
waitcnt(clkfreq / 10_000 + cnt) ' wait 100microseconds
clkset(%0_1_1_01_111, 80_000_000)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!

Some of my objects:
MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2010-01-30 00:34
    Bobb Fwed said...
    Then I want to ramp up the speed again. Do I have to do this:

    clkset(%0_1_1_01_010, 5_000_000)
    waitcnt(clkfreq / 10_000 + cnt) ' wait 100microseconds
    clkset(%0_1_1_01_111, 80_000_000)
    


    Or do I do this:

    [s]clkset(%0_1_1_01_011, 5_000_000) 'LSB change to use PLL1X
    waitcnt(clkfreq / 10_000 + cnt) ' wait 100microseconds
    clkset(%0_1_1_01_111, 80_000_000)[/s]
    

    The first one. You have to let the the PLL settle before you switch to it, i.e. in the second example you enable the PLL and at the same time switch to PLL1X. So just stick with XIN (%010) then go for PLL16X (%111). This sequence works for me (although starting with RCSLOW).

    HTH
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-01-30 00:54
    Ya, I would like to use RCSLOW, but my application requires some semblance of real world timing.
    Too bad the propeller doesn't have compile-time (or programmed-time) calibrated internal oscillators like some chips have. That would be close enough for me to use, and at 20kHz it would save me a lot of power.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
  • lonesocklonesock Posts: 917
    edited 2010-01-30 01:02
    Bobb Fwed said...
    Ya, I would like to use RCSLOW, but my application requires some semblance of real world timing.
    Too bad the propeller doesn't have compile-time (or programmed-time) calibrated internal oscillators like some chips have. That would be close enough for me to use, and at 20kHz it would save me a lot of power.

    You could write a simple test app using RCSLOW or RCFAST, monitor pin 31, and use the prop terminal to send across "U" (binary is %1010101) at 9600 baud on the prop-plug COM port. Then report the pin transition times (in clocks) back over the serial link (pin 30) using simple serial at 9600 baud also. Your transition clocks * 9600 should be the number of clocks per second.

    edit: you'll need to use your recently discovered timing info to set the proper baud-rate on simple-serial to send your result back.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lonesock
    Piranha are people too.
Sign In or Register to comment.