PIC18F4850 will not oscillate


Closed Thread
Results 1 to 25 of 25
  1. #1
    Join Date
    Mar 2011
    Posts
    10

    Default PIC18F4850 will not oscillate

    I have board that I can program using the U2 (USB) Programmer from melabs. I have a blink program that works well when I pick the internal oscillator (at 8Mhz). I have designed the card to use a 20MHz external oscillator but I have not been able to make it work. I just bought the programmer not too long ago, and I am able to program the device as long as I use the internal oscillator.

    When I change the settings to HS on the meprog software, the board will not work and the oscillator will not oscillate (checked with a 10x probe). The design uses a 20Mhz oscillator (PN: ECS-200-20-5PXDU-TR, see attached schematic) and 20pF loading caps. The board layout is exactly as what has been recommended on the PIC datasheet. The only lines from the programmer to the card are GND, PGC, PGD, and my card has a 100K pull down on PGM. I have change the oscillator to another can oscillator I used on another circuit, but it still the new design does not work. During programming I am using the internal power supply which I checked an it is 4.98V. So I tried using the programmers Pin1 5V to power my board but that did not work either. I have also tried the @confiure..... but no luck neither.

    I believe that somehow the fuses for external oscillator do not set properly and the oscillator does not oscillate. I have changed, oscillators, placed different loading caps, put a 1M across the oscillato, removed the laoding caps, but no luck so far. I am only able to run the board with internal OSC set up. I read on another thread that someone used the Vdd (Pin 4) on the USB programmer to power the board during programming and it worked. Nevertheless your website does explicitly said not to use the Vdd pin 4 as it is used for powering adaptors and not ICSP.

    I would really appreciate if anyone can point me in the right direction, as I have tried everything and I have not been able to make the external oscillator to work. I believe I am having an issue with the programming of the HS fuse, but I just have not been able to make it work with the PIC18F4580. I am always setting up the HS with the programmer.

    I have never had issues with oscillators not working, but somehow this one doesnt. By the way I have 2 board populated and they behave exactly the same, with and without the same oscillators.

    Thank you,
    Attached Images Attached Images   

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Try setting the configs in the *.inc file found in the PBP directory.
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Hello,
    You also need to have the MCLR connected to the U2 programer. I did not see it connected in your schematic or discription? Set the config to "HS" and it should work.

    I am sure you have seen this page
    http://melabs.com/support/icsp.htm

    Power your circuit with an external 5v supply
    connect U2 with GND, PGD, PGC and VPP(mclr) to the PIC
    Last edited by mark_s; - 8th March 2011 at 22:54. Reason: add link

  4. #4
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Mark,
    Although not completle shown on the schematic I posted, the MCLR is pulled-up with a resistor and a diode, and it also goes to the U2 Programmer. I have also set the meprog to HS as show in the attached picture.

    Mackrackit,
    The PIC18F4850.INC (file which is in the include statement of my *.asm) is as follows and it too sets up the oscillator to HS

    Code:
    ;****************************************************************
    ;*  18F4580.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2008 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 09/15/08                                        *
    ;*  Version   : 2.60                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F4580, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F4580.INC"	; MPASM  Header
            __CONFIG    _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
            __CONFIG    _CONFIG4L,  _STVREN_ON_4L & _LVP_OFF_4L & _BBSIZ_1024_4L & _XINST_OFF_4L
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	8
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Are you picking the correct PIC?

    Take a look at the inc you posted...
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Dave,

    Good catch and it got me excited for a second there, but I just noticed that I have a typo on my thread title.

    The PIC I have is the 18F4580, there is not such a thing as a PIC4850. I might be dislexic . THe file I posted is the correct one, so is the decription of the PIC on the schematic I posted.

    Any other ideas? I am setting the "Fail-safe clock monitor" and "Internal External Switch over" options so the PIC can run from the internal oscillator while I get this external oscillator to work. But I have tried it all, so any fresh input from anyone, will really help.

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Read the PIC back with your programmer, then view the config window. Do the config settings it reads back match what you expect?
    Regards,

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

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Your config settings look good(screen shot). The U2 program has a pull down menu option which allows you to select between using the configs written in your code or from the config menu on the programmer. Try changing this setting and commenting your configs out of your code.
    Last edited by mark_s; - 8th March 2011 at 23:41.

  9. #9
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Bruce,

    I read back the configuration from the PIC, and it returned the following:

    Code:
    0000- 0200 1f17 8200 0081 c00f e00f 400f
    Towards the bottom of the window, it has a 0xEB87. I can't really tell what this data means, so I am looking at the DS39622L document from microchip. But I really can't see how those two relate. Page 29, of the document shows the configuration bits and the CONFIG1H is located at 300001h.

    Mark_s,

    I changed the 18F4580.INC file to comment out the _CONFIG statements and recompiled. I also change the options to the meProg to not "Update configuration from file". I reprogrammed the device, but no luck. I read back the configurations bits and they are the same as above.

    Any more ideas?
    Attached Images Attached Images  

  10. #10
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    So I made sense of the configuration read back results. And as I imagine the CONFIG1H is not being set by the U2 programmer.

    CONFIG1H = 02 (HS Oscillator enabled)
    CONFIG1L = 00 (default))
    CONFIG2H = 1F
    CONFIG2L = 17
    CONFIG3H = 82
    CONFIG3L = 00
    CONFIG4H = 00
    CONFIG4L = 81
    CONFIG5H = C0
    CONFIG5L = 0F
    CONFIG6H = E0
    CONFIG6L = 0F
    CONFIG7H = 40
    CONFIG7L = 0F


    The configuration file seems to be correct. Can anyone make sense of what is going on?. I have two cards behaving exatly the same.
    Last edited by IRQ_Diode; - 9th March 2011 at 01:06. Reason: Corrected the H and L on the CONFIGx table.

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    When you read the .HEX from the PIC with your programmer, just click the C to view the config settings embedded in the .HEX file. Like you did in post #4.

    If it reads back with the settings you expect, then I would have to suspect a bad oscillator, caps, or something in the external osc circuit causing a problem.

    Double check those SMD caps to make sure they're not resistors...;o)
    Regards,

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

  12. #12
    Join Date
    Feb 2010
    Location
    USA, New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Is "Options|Update Configuration From File" checked? It shouldn't be.

    Best Regards,
    Paul
    The way to avoid mistakes is to gain experience. The way to gain experience is to make mistakes.

  13. #13
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    I read the configuration back from the PIC and it reads the correct settings for the oscillator

    I have open a ticket with Microchip and contacted melabs to see if they have another idea on how to get this solved. I have tried two different oscillators.

    Has anyone used a PIC18F4580 that could let me know what oscillator they used (actual part number)?
    Last edited by IRQ_Diode; - 9th March 2011 at 07:12. Reason: fixed PIC part number

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Add this to your config settings just below your _CONFIG2H line;
    __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOREN_BOHW_2L & _BORV_3_2L

    This should give it more time for the oscillator to start up.
    Regards,

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

  15. #15
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Bruce,

    I did try your suggestion and added the line:

    __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOREN_BOHW_2L & _BORV_3_2L

    The programmer read the configurations bits correctly, but the PIC still will not oscillate. I also went and checked the caps just to make sure that they were not resistors, and well they were not.

    I am considering that it could be the actual part number of the crystal itself. The only thing I have not tried is to place a series resistor to one side of the oscillator. I would have to cut the trace and make sure that I do not short anything to the ground pour around the oscillator.

    So before I do that, is there anything else someone can think of? Microchip is taking its time to respond, and I need to send the gerber files to the manufacturer soon.

    Thanks,

    IRQ

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Can you upload the compiled .HEX file you're programming into this part in .ZIP file?
    Regards,

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

  17. #17
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    I have uploaded and below for refrence
    Code:
    :020000040000FA
    :100000005CEF01F0E95004009EA8FDD7AD6ED880EA
    :1000100059EF01F0019E0350D8B4018E200E026EFC
    :10002000E86A1A361B361C361D36E83452D802668A
    :10003000F7D71200019E0350D8B4018E0A0E026E4B
    :100040003B0E196E9A0E186ECA0E176E000E35D83A
    :10005000050E196EF50E186EE10E176E000E2DD8F6
    :10006000196A980E186E960E176E800E26D8196AA9
    :100070000F0E186E420E176E400E1FD8196A010E31
    :10008000186E860E176EA00E18D8196A186A270EF9
    :10009000176E100E12D8196A186A030E176EE80E42
    :1000A0000CD8196A186A176A640E07D8196A186A90
    :1000B000176A0A0E02D81A500CD0166E1D50156E13
    :1000C0001C50146E1B50136E1A50126E2DEC01F062
    :1000D0001250126E024E019E035003E0025CD8B033
    :1000E00012001250D8A4019E01BE1200300F53EF2F
    :1000F00001F0080E1E6E11C0EAFF0FC0E9FF0D509F
    :1001000001B4AAEC00F001A4ACEC00F011C0E2FFD5
    :100110000FC0E1FF0E50120FE96E0C1CEF161E50BF
    :1001200011E001B0F0EC00F00EC0E9FF153214321E
    :1001300013321232EF500C10D8A00C18EF6E04D806
    :100140001E2EF4D759EF01F00D50E71A000000D031
    :10015000E71A1200EF1203D0FF0AEF1601D0FF0AD0
    :10016000E988E92AEC1659EF01F0E834E834FC0B91
    :100170000109C212C009C216C050F80B0309C06EB3
    :10018000000E136E140EDFEC00F0C282C2B2FED776
    :10019000C450136EC35059EF01F0176A186A196AF8
    :1001A000166EE86A1606175A185A195AD8A059EF47
    :1001B00001F0030E136EE30E02D8F3D7136AF50FA6
    :1001C000126EFE0E04E300D004001226FDE20000D1
    :1001D00012261306F9E212A002D000D0000012008D
    :1001E000166A176A186A196A08D01532143213325F
    :1001F00012321636173618361936FF0FF6E2195036
    :10020000156E1850146E1750136E1650126E59EF6B
    :1002100001F0166E030E03D0166E060E00D0026EAD
    :100220000AD0026E1950151815E61950155C08E130
    :100230001850145C05E11750135C02E11650125C73
    :10024000040ED8B0010ED8B4020E0214D8A4FF0ECA
    :1002500059EF01F01550195CF3D71A6A1B6A1C6A32
    :100260001D6A200E1E6E15341A361B361C361D36BE
    :1002700016501A5E17501B5A18501C5A19501D5A06
    :1002800009E216501A2617501B2218501C2219502A
    :100290001D22D89012361336143615361E2EE3D78B
    :1002A000125059EF01F0E96EFB6A0B50FA6E0A50DA
    :1002B000F96E0001040012000C0EAF6E200EAC6E41
    :1002C000900EAB6E3D0EC26E0A0EC16E720ED36EF4
    :1002D000070EB46E2F0E926ED90E936E940E946E1E
    :1002E0009568966A25682468296A266827682868B8
    :1002F00038EC02F0A3EC01F0560E85DE430E83DEEF
    :10030000530E81DE5F0E7FDE500E7DDE490E7BDEFA
    :100310004E0E79DE530E77DE200E75DE3D0E73DE57
    :10032000200E71DE250E6FDE036A29C01AF01B6AEB
    :100330001C6A1D6A040E0A6E0B6A6CDE0A0E63DE0E
    :100340000D0E61DED5D783CF24F004002450255C48
    :10035000D8B435EF02F04E0E56DE4F0E54DE200EAE
    :1003600052DE430E50DE480E4EDE410E4CDE4E0E87
    :100370004ADE470E48DE450E46DE0A0E44DE24B055
    :10038000298024A0299024B4298224A4299204003D
    :1003900029500308D8A4E0EF01F0210E266E480E84
    :1003A000276E286A430E2FDE410E2DDE530E2BDE04
    :1003B000450E29DE330E27DE0A0E25DE33EF02F06E
    :1003C000040029500208D8A4F9EF01F0266A480E6B
    :1003D000276EBF0E286E430E16DE410E14DE530E3E
    :1003E00012DE450E10DE320E0EDE0A0E0CDE33EF8C
    :1003F00002F0040029500108D8A418EF02F0210EE1
    :10040000266E276A400E286E430E03EC00F0410E64
    :1004100003EC00F0530E03EC00F0450E03EC00F08B
    :10042000310E03EC00F00A0E03EC00F033EF02F0A3
    :10043000040029500008D8A433EF02F0266827688A
    :100440002868430E03EC00F0410E03EC00F0530E5D
    :1004500003EC00F0450E03EC00F0300E03EC00F06E
    :100460000A0E03EC00F029EC03F024C025F0120082
    :10047000040E7BDE226E13C023F022C012F023C0D4
    :1004800013F0020E176E9A0EC7DED8A491EF02F099
    :100490008290560E03EC00F0420E03EC00F0410E89
    :1004A00003EC00F0540E03EC00F05F0E03EC00F0E0
    :1004B000530E03EC00F0450E03EC00F04E0E03EC7F
    :1004C00000F0530E03EC00F0450E03EC00F0200E9C
    :1004D00003EC00F03E0E03EC00F0200E03EC00F005
    :1004E0004F0E03EC00F04E0E03EC00F05F0E03EC39
    :1004F00000F0560E03EC00F04F0E03EC00F04C0E33
    :1005000003EC00F0540E03EC00F0410E03EC00F09D
    :10051000470E03EC00F0450E03EC00F00A0E03EC6E
    :1005200000F022C012F023C013F0020E176E8D0EE1
    :1005300070DED8A4E8EF02F08280560E03EC00F0E3
    :10054000420E03EC00F0410E03EC00F0540E03ECFD
    :1005500000F05F0E03EC00F0530E03EC00F0450ECC
    :1005600003EC00F04E0E03EC00F0530E03EC00F031
    :10057000450E03EC00F0200E03EC00F03C0E03EC03
    :1005800000F0200E03EC00F04F0E03EC00F0460EDE
    :1005900003EC00F0460E03EC00F05F0E03EC00F0FD
    :1005A000560E03EC00F04F0E03EC00F04C0E03EC83
    :1005B00000F0540E03EC00F0410E03EC00F0470E87
    :1005C00003EC00F0450E03EC00F00A0E03EC00F023
    :1005D000560E03EC00F0420E03EC00F0410E03EC6B
    :1005E00000F0540E03EC00F05F0E03EC00F0530E2D
    :1005F00003EC00F0450E03EC00F04E0E03EC00F0AF
    :10060000530E03EC00F0450E03EC00F03A0E03EC41
    :1006100000F0036A22C01AF023C01BF01C6A1D6A96
    :10062000040E0A6E0B6A1AEC00F0200E03EC00F0C8
    :10063000036A000EC2B2010E1A6E1B6A1C6A1D6AA2
    :10064000040E0A6E0B6A0AEC00F00A0E03EC00F0CE
    :1006500012008490840E0E6E0F0E106E040E0C6E3F
    :10066000840E0F6E0F0E116E020E0D6E016A28C001
    :1006700012F0136A146A156A79EC00F027C012F0C0
    :10068000136A146A156A79EC00F026C012F0136A36
    :10069000146A156A79EC00F084800A0ECDEC00F043
    :1006A00084904C0E03EC00F0450E03EC00F0440E79
    :1006B00003EC00F0530E03EC00F03D0E03EC00F0F1
    :1006C0003D0E03EC00F03E0E03EC00F0200E03ECB8
    :1006D00000F0250E03EC00F0036A28C01AF01B6A34
    :1006E0001C6A1D6A040E0A6E0B6A0AEC00F0200EEA
    :1006F00003EC00F0036A27C01AF01B6A1C6A1D6A2B
    :10070000040E0A6E0B6A0AEC00F0200E03EC00F0F7
    :10071000036A26C01AF01B6A1C6A1D6A040E0A6E60
    :0E0720000B6A0AEC00F00A0E03EC00F0120067
    :020000040030CA
    :0E00000000021E13008081000FC00FE00F40B1
    :00000001FF
    Thank you for looking into this

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    You do still do not have the OSC set for HS
    Name:  4580_HEX.png
Views: 1101
Size:  66.5 KB
    Dave
    Always wear safety glasses while programming.

  19. #19
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Dave, I don't think you imported the .hex file.

    Here's what meProg shows ...

    Name:  4580_IRQ.jpg
Views: 1168
Size:  167.8 KB
    DT

  20. #20


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Another silly thought. Some times you can open a hex file in the melabs programmer and it's not the latest. The compiler may be storing it in a different directory. You may be opening an older version of your hex file from another directory. As much as you modify your basic code, you keep programing the chip with the same hex. Recompile and check the date and time stamp on the file. I have used that chip before and it is not difficult to get working. If you post your code, someone can compile it and see whats going on.

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Quote Originally Posted by Darrel Taylor View Post
    Dave, I don't think you imported the .hex file.
    DOH!!! I imported something... Now that I do it again, MPLAB shows the same as you.
    Dave
    Always wear safety glasses while programming.

  22. #22
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Hi,
    It looks like all your smt caps are shorted in the PCb traces, is that possible ?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  23. #23
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Joe,

    I am not sure what you mean. Are you saying if maybe the caps got shorted when solder?mmm... you know what I have not checked on that.

    After opening a ticket with Microchip, they could not help me much either. They thought that maybe I damaged the crystal when I solder it. Which I suppose it could be a possibility.

    Since I had to order new boards anyways, I placed the XTAL closer to the PIC (Maybe 15-30mils closer) and the new boards work fine. So I am not sure what happen before but I guess it is one of those items I will not find out what happen without using up more time that I already have.

    Thanks for the help.

  24. #24
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Not a solder bridge, but copper where it should not be? Looks like the traces bridge the caps and some other components. Looks like exacto knife time.Name:  shoer.JPG
Views: 1125
Size:  111.6 KB
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  25. #25
    Join Date
    Mar 2011
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4850 will not oscillate

    Joe,

    I see what you mean now. My bad, the layout I uploaded is black and white, and the component bodies are part of my capture. Those aren't really copper, they are just the bodies of the components.

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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