Shop OBEX P1 Docs P2 Docs Learn Events
_CLKMODE and double checking my crystal — Parallax Forums

_CLKMODE and double checking my crystal

Timothy D. SwieterTimothy D. Swieter Posts: 1,613
edited 2008-12-20 19:30 in Propeller 1
I have a new design on the bench that I am working through. There are several oddities I am chasing down and at the moment one of them is double checking my crystal and _CLKMODE settings. Unfortunately I am rushed trying to get a few things done before a two week vacation, so deeper investigation of this may have to wait until I return.

Here is what I have in the design:
This is my first time not using a 5MHz. crystal. I chose the 10MHz because I wanted a small compact surface mount crystal. I also had a notion in my mind that at one point there was discussion about this crystal being used on the 4D Systems uOLED-PROP-96. When I started writing some test software at first it didn't occur to me that I should adjust the XTALx parameter in _CLKMODE so I have been using XTAL1. I of course recognized the need to change the PLLx and the _xinfreq. I want to use PLL8X and of course _xinfreq = 10_000_000 to have operation at 80MHz. My code at the moment though is this:

  '***************************************
  ' Processor Settings
  '***************************************
  _clkmode = xtal2 + pll4x      'Use the PLL to multiple the external clock by 4
  _xinfreq = 10_000_000         'An external clock of 10MHz. is used (40MHz. operation)




So, I looked at the datasheet and Propeller Manual and it appears that maybe XTALx should be XTAL2 for the crystal I am using. I am saying that because the crystal is 10MHz and based on what it says in Table4-3 on page 180 in the Propeller Manual. Is there another reason to chose one XTALx setting over another? The capacitance perhaps?

Like I said I think I am working through debugging on a new design and one oddity that I have is that I get inconsistent results with the I2C bus when running at 80MHz. but things seem fine at 40MHz. At 80MHz I can see my General Purpose I/O expander IC missing message or updates where at 40MHz Propeller speed it updates as expected. I have used the same code that I am running on the new design on a previous design with a 5MHz. crystal and running at 80MHz so I have confidence that the code works. I am still investigating my pull-up resistors and traces and such to see if the problem could be there as well. I have 10K pullups on both lines.

So this all leads me to my investigation on _CLKMODE settings and the crystal that I used and wondered what other may think or have experience with as far as the crystal. I know I will be doing another board revision of my design, so if other users have suggestions for other crystals they have used or like or are small and SMT, please let me know and I can consider them.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
www.tdswieter.com

Comments

  • soshimososhimo Posts: 215
    edited 2008-12-18 11:37
    Forgive my ignorance about the propeller architecture, but I was wondering if the i2c code is self configuring or if you have to adjust it for the new frequency as well? I2C is very deterministic, as you are probably aware, so bumping up your xtal could be messing with your timing.

    ** It's funny that you mention that now, I've just spend the last 4 hours debugging some i2c code for a serial to i2c interface I'm working on. My bug was timing related :P.
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-12-18 11:45
    Hmmm - I reviewed the I2C code and I don't see timing references in it. I know I have had this same I2C code working on a 64MHz. powered Propeller and a 80MHz. powered propeller. that doesn't mean I am not missing something or forgetting something in my rush. I need to review details on the I2C timing, but with a clock and a data line the timing is more in the transitions of the clk/data line timing and transitions relative to what the other line is doing.

    What crystal and system are you using Soshimo?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
    www.tdswieter.com
  • soshimososhimo Posts: 215
    edited 2008-12-18 11:56
    I currently have the 5mhz crystal for my propeller and I've got it bread boarded right now. I just got it last week so I am in firehose learning mode. As for the rs232/i2c interface, I'm using a pic running on a 4mhz xtal. I'm bit banging the rs232 and i2c.
  • kelvin jameskelvin james Posts: 531
    edited 2008-12-20 06:19
    Tim

    I knew that Eric Moyers' Coyote used a 10 mhz smt, and looked at the settings, which you have correct. Looking at the comment for _xinfreq, it makes you wonder if he also had some issues. Might be worth checking it with a scope to see what it is actually putting out.


    _clkmode = xtal2 + pll8x  ' enable external clock and pll times 8
    _xinfreq = 10_000_000 + 0000  ' set frequency to 10 MHZ plus some error for xtals that are not exact add 1000-5000 usually works
    




    **
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-12-20 19:30
    Thanks for the tip Kelvin. I will have to look into this. I think I also say this similar structure in Andres' Hyrdra code so I wonder if Eric picked it up from that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
    www.tdswieter.com
Sign In or Register to comment.