Code running 19 times slower than intended


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If you are using the same code and the same PIC® it has to be a hardware problem.

    Check to OSC to make sure it is OK. Maybe wrong/bad capacitor??
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default OSC is not oscillating....why??

    Quote Originally Posted by mackrackit View Post
    If you are using the same code and the same PIC® it has to be a hardware problem.

    Check to OSC to make sure it is OK. Maybe wrong/bad capacitor??
    Thanks for this tip! I put an Oscilloscope on to Pin 9 (OSC1) of the 18F2550MCU and it appears that the crystal is not oscillating. Can't figure out why not.
    I am using an 8 MHz crystal from Abracom (their P/n ABL-8-B2) with two 27 pf capacitors as C1 and C1. This crystal specs a CL of 18 pf. By my calculation I am close to that if you assume a PCB stray capacitance of Cs=4 pf (my terminatons to crystal and capacitors from the MCU are very short on the PCB), the calculation goes like this:
    CL = Cs +(c1 X c2)/(c1+c2). When usining C1=C2=27pf in this calculation CL comes out to 17.5 pf which is very close to the spec'd 18 pf and I can't believe this difference would prevent the OSC from working.
    I am operating the MCU with a regulated supply voltage of 3.1 volts, so the drive on the crystal should be sufficient to cause oscillation.
    One thing I really don't understand is why the MCU is still operating (granted at 38 times slower than expected) when the OSC is not even oscillating.
    Can anyone give me some hints or advice how to resolve this??

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I can not help much on the crystal as I do not use them. For good or bad I use those three pin resonators, that way I do not have to mess with capacitors.

    I would guess the chip has defaulted to 31 kHz, that is what it is running at.

    You could use the internal OSC. This chip has an 8 MHz built in. May or may not be good enough for serial...
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Problem solved!

    I finally found the problem thanks to rteo who advised that the 18F2550/4550 data sheet shows in one place that the external osc won't function with a supply voltage to the MCU of less than 4.2 volts. I had been running a supply voltage of 3.3 volts as a battery power conservation measure. I then experimented and discovered, rteo is partially correct.....my 18F2550 external osc circuit won't oscillate reliably until the supply voltage is at least 3.6 volts.
    This discovery is going to make me change the design for this product to a 4.2 volt supply rail.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Maybe your crystal will not run at a voltage lower than 3.6, but the 4550 will operate with an external OSC of 4MHz at 3 volts. I typically run this chip at 3.3 with SD cards.

    If you want to save power and run at a lower voltage get a three pin resonator at 4MHz.
    Dave
    Always wear safety glasses while programming.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    If you want to be able to run at lower than 4.2 volts you should probably be using the LF version of the part. Looks like the LF version will work from 2V to 5V with slower clocks the lower the voltage goes. Some F parts may work lower than the 4.2V spec, but there may be some that flat out won't.
    Tim Barr

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Dave,

    Are you sure you're not using the LF version running at 3V?
    Attached Images Attached Images   
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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