4550 osc


Closed Thread
Results 1 to 15 of 15

Thread: 4550 osc

  1. #1
    Join Date
    Oct 2009
    Posts
    11

    Default 4550 osc

    I'm a bit new with this chip and I'm having problems with the oscillator settings. Basically, I already have a program and circuit working with the chip and a 4MHz XT.

    The problem is that when I replace the crystal with a 20MHZ HS nothing communicates anymore. Debug and SPI, to be exact.

    I've changed my DEFINE OSC to 20 and made sure the right MHz and Type are selected in melabs programmer. Is there something else I am missing to get the serial ports back to normal speed?

    I'm using MicroCode Studio - PicBasic Pro with the MeLabs USB Programmer.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    First we need some info....What chip body? What compiler version? Is it a 20Mhz crystal or resonator?

    Nick

  3. #3
    Join Date
    Oct 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    18f4550 is the chip, 40 pin dip. I'm using PicBasic Pro 2.46. And it's a quartz crystal.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    have you put capacitors between the oscilator pins and ground?

  5. #5
    Join Date
    Oct 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Yes, did that. 22pF

    Reset is high, too.

  6. #6
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    The '4550 supports USB, and the oscillator section has a lot of options. Try the following;
    asm
    __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L

    __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H

    __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_2_2L & _VREGEN_ON_2L
    __CONFIG _CONFIG2H, _WDT_OFF_2H
    __CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H
    __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    endasm
    define OSC 48 'core running at 48Mhz
    DEFINE DEBUG_REG PORTA 'pin Porta.5 serial out to debug
    DEFINE DEBUG_BIT 5
    DEFINE DEBEG_BAUD 2400
    DEFINE DEBUG_MODE 0 '0 = TRUE, 1 = INVERTED

    This setup works with a 20 Mhz crystal. You will also find more information if you do a search here for 18f4550

    Good Luck,
    Jerry
    If your oscilloscope costs more than your car...

  7. #7


    Did you find this post helpful? Yes | No

    Default

    ok, cool, thaught i'd ask a stupid question...

    i used the 18F4550 myself and i also use the same OSC so, i'll run through my settings, however, i'm using winpic800 with a JDM programmer...

    OSC: HS oscillator, PLL enabled, HS used by USB
    CPU system clock: 96MHz PLL dev 5
    Oscilator selection: Devide by 5 (20MHz input)
    Vbor: 2.7V
    Brown-out restet: Enabled in hardware only
    Watchdog: 1:32768
    FCMEM enabled
    IESO enabled
    WDTEN enabled
    PWRTEN disabled
    CCP2MX enabled
    PBADEN enabled
    LPT1OSC enabled
    MCLRE disabled
    DEBUG disabled
    STVREN enabled
    LVP enabled
    ICPORT enabled
    XINST enabled
    USBPLL enabled
    VREGEN enabled

    All CP's are disabled
    All EBT's disabled
    All WRT's disabled

    Acording to oshonsoft's pic18 simulator IDE the BASIC code for those options are asfollows...

    Code:
    Define CONFIG1L = 0x3C
    Define CONFIG1H = 0xCE
    Define CONFIG2L = 0x17
    Define CONFIG2H = 0x1F
    Define CONFIG3L = 0x00
    Define CONFIG3H = 0x07
    Define CONFIG4L = 0xE1
    Define CONFIG4H = 0x00
    Define CONFIG5L = 0x0F
    Define CONFIG5H = 0xC0
    Define CONFIG6L = 0x0F
    Define CONFIG6H = 0xE0
    Define CONFIG7L = 0x0F
    Define CONFIG7H = 0x40
    Hopefully, some of that will help...
    if not, can you post a screen shot of your programmers config options screen?

    Thanks

  8. #8
    Join Date
    Oct 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Hmm, I was hoping I wouldn't have to learn what a .asm file was...

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MyBuddy View Post
    Hmm, I was hoping I wouldn't have to learn what a .asm file was...
    What ASM?
    This is all about setting the configs like you would with any PIC.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    MyBuddy,
    I just noticed that you are new here. Welcome.

    Here is a must read.
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Dave
    Always wear safety glasses while programming.

  11. #11


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MyBuddy View Post
    Hmm, I was hoping I wouldn't have to learn what a .asm file was...
    This has nothing to do with ASM (assembler)
    Take a screen cap of your programmer screen with all your osc config options on and i'll look see if you have anything set wrong...

    :edit
    I've just sorted out my fuse options for use with MPASM... Been meaning to do them but couldn't previously be botherd...

    Now, assuming your using MPASM for compiling this needs to be the first line in your BAS file...

    Code:
    @ __config _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L & _FOSC_HSPLL_HS_1H & _FCMEN_ON_1H & _IESO_ON_1H & _PWRT_ON_2L & _BOR_ON_2L & _BORV_2_2L & _VREGEN_ON_2L & _WDT_ON_2H & _WDTPS_32768_2H & _MCLRE_OFF_3H & _LPT1OSC_ON_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H & _STVREN_OFF_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_ON_4L & _DEBUG_OFF_4L & _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L & _CPB_OFF_5H & _CPD_OFF_5H & _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L & _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H & _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L & _EBTRB_OFF_7H
    The list of fuse options avaliable for MPASM can be found in C:\Program Files\Microchip\MPASM Suite
    The INC file for the pic contains the fuse options, so for the 18F4550 you need to open the file C:\Program Files\Microchip\MPASM Suite\P18F4550.INC in notepad or Microcode studio or with MPLAB...
    If you don't know what the options are for, thats where searching the datasheet comes in...
    Last edited by comwarrior; - 22nd October 2009 at 20:49.

  12. #12
    Join Date
    Oct 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    What ASM?
    This is all about setting the configs like you would with any PIC.
    I was confused with the post from b1arrrk, my bad.

    I think this pic is overly complex ... or I'm overly simple.

    Alright, I'm understanding a little better the fuses, but they look exactly like the options in the MeProg Programmer for this chip ... I'm fairly sure I've tried every possible combination of pertinent bits.

    Comwarrior, I understand what you're saying now, but I am getting some funny errors now:
    Code:
    Symbol not previously defined (_MCLR)
    Argument out of range (not a valid config register address)
    I'm guessing that second one is because of the first error. As for the first error, I don't get it... I copied the config bit from the .inc then pasted it over the @ line. Do I need to have line breaks after some point or something?

  13. #13
    Join Date
    Oct 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Another thing:

    After I compile with the following config bits:
    Code:
    @ __config _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L &
     _FOSC_HS_1H & _FCMEM_ON_1H & _IESO_ON_1H & _PWRT_ON_2L & 
    _BOR_OFF_2L & _BORV_21_2L & _VREGEN_ON_2L & _WDT_ON_2H & 
    _WDTPS_32768_2H & _MCLRE_ON_3H & _LPT1OSC_ON_3H & _PBADEN_OFF_3H 
    & _CCP2MX_ON_3H & _STVREN_OFF_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & 
    _XINST_ON_4L & _DEBUG_OFF_4L & _CP0_OFF_5L & _CP1_OFF_5L & 
    _CP2_OFF_5L & _CP3_OFF_5L & _CPB_OFF_5H & _CPD_OFF_5H & 
    _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L & 
    _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H & _EBTR0_OFF_7L & 
    _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L & _EBTRB_OFF_7H
    ... the MeProg pops up, but I still have to change the config settings on that screen, such as the Oscillator type (it is on HSPLL instead of the HS I have config'ed in the above code).

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


    Did you find this post helpful? Yes | No

    Default

    Maybe this will help. I set the configs in code so the *.inc is commented out.
    Below is for a 4550 with a 4Mhx external clocking at 48
    Code:
    DEFINE OSC 48
        @ __CONFIG   _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        @ __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
        @ __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
        @ __CONFIG    _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H 
        @ __CONFIG    _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L &_XINST_OFF_4L
    MCLR nope, MCLRE...
    Dave
    Always wear safety glasses while programming.

  15. #15


    Did you find this post helpful? Yes | No

    Default

    the MeProg pops up, but I still have to change the config settings on that screen, such as the Oscillator type (it is on HSPLL instead of the HS I have config'ed in the above code
    HS with PLL enabled is ok... PLL allows USB to be used at diferent clock speed to the main CPU, it's safe to use with PLL even if you don't use USB

Similar Threads

  1. Internal vs. external osc for comms
    By mtripoli in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th January 2010, 14:58
  2. Define osc 1
    By ronsimpson in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st October 2009, 06:35
  3. 18f2550 USB OSC Problem
    By serkanc in forum USB
    Replies: 10
    Last Post: - 29th October 2008, 20:52
  4. 18F458 and 20MHz osc problem...
    By batee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th October 2004, 20:16
  5. 12f675 internal osc question.....
    By Gabe@SPdFtsh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th January 2004, 06:33

Members who have read this thread : 1

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