Shop OBEX P1 Docs P2 Docs Learn Events
SimpleIDE Question — Parallax Forums

SimpleIDE Question

nchowahnchowah Posts: 4
edited 2015-04-05 08:51 in General Discussion
Hi,

I'm a "newbie" to the SimpleIDE environment. I've been experimenting with a little project and I have a question. When using the SPIN language you have the ability to specify both the crystal frequency and the phase locked loop multiplier. I'm wondering about this with SimpleIDE. It seems like I read, somewhere, that it depended on the type of propeller board that you had when the project was created. I have a propeller professional development board. Can someone tell me what speed it is running at by default and whether or not I have any control over that from within the C implementation for the propeller.

Thanks

Comments

  • prof_brainoprof_braino Posts: 4,313
    edited 2015-04-03 08:24
    The frequency of the crystal is determined by the hardware. All the stock Parallax prop board have a 5MHz crystal. Other boards are available the have the 6.x MHz crystal, folks use these when they need to overclock, but they are less common than the stock borads.

    The phase lock loop is specified in software, in the code you compile. Most code is written for the stock board at the stock speed, which is 5Mhx crystal with 16x phase lockedloop.

    Well written code takes the crystal frequency and phase locked loop into consideration and adjusts any functions that rely on these settings. For example, baurd functions rate need to be adjusted if you change the frequncy or phase lock loop.

    So the crystal frequncy is determined by whatever hardware you bought, and you can change the frequency in software.

    In your case, I believe the professional development board is still 5MHz crystal, so any stock prgram can usually be expected at 80MHz, unless it is for a particular purpose, and would so such. You can set you own code to whatever frequncy the clock and phase lock loop can generate. You have to make should you account for changing the phase lock loop multiplier in your own code.

    Someone will usually correct me if I have made any mistakes.
  • PublisonPublison Posts: 12,366
    edited 2015-04-03 09:14
    I will usually open a new project with "Demo Board" which is set to 5Mhz-PLL16x. From there I will adjust the pins to suit my board.

    The Propeller Professional Development Board has the ability to put all the pins where you want them via jumpers, so you can set it up as a "Demo Board", using the appropriate pins for a Demo Board in the Spin File.
  • nchowahnchowah Posts: 4
    edited 2015-04-03 15:14
    I really appreciate your help, however I'm still not sure about how I would change the PLL setting from within my code. Could you point me at the appropriate function call? the crystal on my board is indeed a 5MHz device so that's a no brainer. I intend to let the board run @ 80MHz but I am still curious about how I would programmatically alter this should I desire to. Again, thank you for your help>
  • $WMc%$WMc% Posts: 1,884
    edited 2015-04-03 18:05
    Swap the 5 MHz xtal for a 6.25 MHz xtal and your overclocking the Prop at 100MHz. The Prop runs fine at this speed. I have some projects that are a few years old running at 100MHz. Make sure you change the software setting from 5_000_000 to 6_250_000 or how ever your defining the xtal.
  • prof_brainoprof_braino Posts: 4,313
    edited 2015-04-03 18:38
    nchowah wrote: »
    still curious about how I would programmatically alter this should I desire to.

    Change the phaselocked loop from 16 to another interger from 1 to 16 is how the frequency can be changed in software. Often you need todo a reset of some kind depending on whats going on.

    In another environment (propforth) when we change from 80MHz to RCSlow to save power, we do a soft reset or else the comms get messed up because of the way it affects the bvaud rate. when we get another signal and wake from RCslow (low power mode) to normal80MHz mode we again do another reset to ensure the coms are not messed up.

    There should be exmples of low power mode in the obex but I'm not familliar with them.
  • nchowahnchowah Posts: 4
    edited 2015-04-03 19:03
    Eureka;

    I found it buried within the "propeller.h" as a macro.

    "clkset(mode, frequency)"

    Frequency is a funny one because as near as I can see it simply sets/update the contents of an internal register for programmatic use later. Clearly the external crystal runs at it's dominant mode frequency.

    Mode on the other hand configures the internals to select the 16X tap of the phase locked loop. I have a "Rev. A" propeller professional development board and I've looked it over carefully and I can't see any jumpers that might be interrogated by the chip to establish the PLL setting. Maybe other boards have them, still I wonder. Under the build manager I see several board types but nothing that makes it obvious as to a default PLL setting. Oh well, as Franklin said "experience keeps a dear school, but a fool will learn in no other".

    I truly appreciate all of your comments and help. I just may change my xtal to one running at 6.25MHz because the final frequency would make some of the timing math simpler, thank you for the suggestion.
  • GenetixGenetix Posts: 1,754
    edited 2015-04-04 22:14
    The PLL is internal to the Propeller along with an RC Oscillator. All of this is detailed in the Propeller Manual.
    Page 22 gives an overview while Table 1-10 on page 30 shows the details
    Both Spin and PASM have a CLKSET command shown on pages 71 and 271 respectively.
    https://www.parallax.com/sites/default/files/downloads/P8X32A-Web-PropellerManual-v1.2.pdf
  • nchowahnchowah Posts: 4
    edited 2015-04-05 07:10
    I've found the tables/values that you refer to and it above mentioned function call does seem to work. I used printing to the PST the "clkfreq" to prove to myself that my development board does run at 80MHz by default when loaded from within the SimpleIDE environment. However, after issuing a change to the PLL mode (tap) my comms to the PST cease working. I'm sure that I'm seeing the effects of the frequency change on how baud rate is calculated as suggested by a prior post. It was mentioned in a prior post that a soft reboot was often needed to straighten things out.

    So my next questions are;

    1-) How do I make the chip do a "Soft Reboot" from within my code?
    2-) Are there any other registers that I should be concerned with after such a reboot to get the comms working?

    Again, thanks to all of you that have posted trying to get me straightened out.
  • prof_brainoprof_braino Posts: 4,313
    edited 2015-04-05 08:51
    As you noticed, the crystal always runs at the stated speed (5Mhz or 6.x MHx) which is the purpose of having the crystal. The phaselockedloop is changes only in software, there are no jumper unless you built a circuit to read the jumpers and them change the PPL in you program.

    RESET would be a call to your initialization routines that read the settings for the comms, and set them up. My stuff reads and starts the comms, sets counters back to zero (to the start) sets the buffers to zero, etc. Your stuff would just set up tyou initialization stuff as a function to call after you change you clock.

    I don't recall any reset internalto the prop, aside from pullin the reset line, but that we reset everything, and you would forget what you were doing. But its been a while since we had to do any work in that area, so there maybe stuff I'm leaving out.
Sign In or Register to comment.