USBMOUSE Example Help


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429

    Default USBMOUSE Example Help

    Hi,

    I'm trying to get the USBMOUSE.BAS example working on a 18F4550 and not having much luck.

    When I plug it in, windows XP says "USB Device Not Recognized" and shows up as an "Unknown Device"

    I have:

    4Mhz crystal with 22pF caps
    10k between MCLR and +5v
    0.1uF between each Vdd and Vss
    470nF between Vusb and Gnd
    100Uf between Vdd and Vss

    Anyone have ideas?
    Last edited by Kamikaze47; - 9th June 2007 at 14:26.

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


    Did you find this post helpful? Yes | No

    Default

    Oscillator Configs?
    <br>
    DT

  3. #3
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Just the default that came with PBP:

    Code:
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
    i'm new to 18Fxxxx chips. I'm not overly familiar with these configs.

    Is there 2 different clocks at different speeds for the 4550? In mister_e's USB Demo program, the OSC is defined as 48, but a 4Mhz oscillator is used.

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


    Did you find this post helpful? Yes | No

    Default

    That would work for 20Mhz.

    For 4Mhz try _PLLDIV_1_1L inplace of _PLLDIV_5_1L
    <br>
    DT

  5. #5
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Thanks. Works like a charm.

    Im trying to familiarize myself with the CONFIG settings now.

    Dos you have any insight on the 2 different oscillator settings? I.e. "DEFINE OSC 48" in the code, and defining 4Mhz in CONFIG.

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


    Did you find this post helpful? Yes | No

    Default

    The 2550/4550 etc type chips have a really nice PLL in the oscillator stage.

    The PLL always ends up running at 96 Mhz, and to do so, it needs a reference of 4mhz. So if you're using a 20Mhz crystal, it has to be divided by 5 with the prescaler to get back down to 4Mhz. That's the _PLLDIV_?_1L

    Code:
    Crystal
    4  - _PLLDIV_1_1L
    8  - _PLLDIV_2_1L
    12 - _PLLDIV_3_1L
    16 - _PLLDIV_4_1L
    20 - _PLLDIV_5_1L
    24 - _PLLDIV_6_1L
    
    External Oscillator
    40 - _PLLDIV_10_1L
    48 - _PLLDIV_12_1L
    Then once you have the 4 Mhz reference, the PLL will run at 96 Mhz.
    A postscaler can divide that by 2 to give 48 Mhz to the USB. _USBDIV_2_1L

    And a seperate postscaler can give the CPU 48, 32, 24 or 16 Mhz depending on the _CPUDIV_OSC1_PLL2_1L config setting.

    In effect, you can get any of these frequencies, no matter which one of the (multiple of 4Mhz) crystal you use.

    You can have a 4Mhz crystal supplying 48Mhz to the USB and 16 Mhz to the CPU, or both USB and CPU at 48Mhz.

    Clear as Mud, right.
    <br>
    DT

Similar Threads

  1. How to work with USBMOUSE ?
    By iugmoh in forum USB
    Replies: 6
    Last Post: - 17th April 2008, 17:18
  2. Which PIC best for USBMOUSE?
    By TonyA in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st April 2007, 01:32
  3. Replies: 2
    Last Post: - 9th February 2006, 22:03

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