Problem with enumeration and EasyHID


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    14

    Default

    I still cant get the pic to enumerate.

    Here is my code for the fuses:

    else
    LIST
    LIST p = 18F2550, r = dec, w = -311, w = -230, f = inhx32
    INCLUDE "C:\PBasPro Projects\AirDrum\PICBasicPRO\P18F2550.INC" ; MPASM Header
    __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    __CONFIG _CONFIG1H, _FOSC_XTPLL_XT_1H & _IESO_OFF_1H
    __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_2_2L & _VREGEN_OFF_2L
    __CONFIG _CONFIG2H, _WDT_OFF_2H
    __CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H
    __CONFIG _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    NOLIST
    endif



    Here is the main code again:

    DEFINE OSC 48
    DEFINE LOADER_USED 1

    USBBufferSizeMax con 8 ' maximum buffer size
    USBBufferSizeTX con 8 ' input
    USBBufferSizeRX con 8 ' output

    ' the USB buffer...
    USBBuffer Var Byte[USBBufferSizeMax]
    USBBufferCount Var Byte
    i var byte


    ' ************************************************** **********
    ' * main program loop - remember, you must keep the USB *
    ' * connection alive with a call to USBService every couple *
    ' * of milliseconds or so... *
    ' ************************************************** **********
    usbinit ' initialise USB...
    ProgramStart:
    'gosub DoUSBIn
    'gosub DoUSBOut

    High PORTB.0
    for i = 1 to 10
    Pause 2
    USBservice
    next i

    LOW PORTB.0
    for i = 1 to 10
    Pause 2
    USBservice
    next i
    goto ProgramStart



    ' ************************************************** **********
    ' * receive data from the USB bus *
    ' ************************************************** **********
    DoUSBIn:
    USBBufferCount = USBBufferSizeRX ' RX buffer size
    USBService ' keep connection alive
    USBIn 1, USBBuffer, USBBufferCount, DoUSBIn ' read data, if available
    return

    ' ************************************************** **********
    ' * wait for USB interface to attach *
    ' ************************************************** **********
    DoUSBOut:
    USBBufferCount = USBBufferSizeTX ' TX buffer size
    USBService ' keep connection alive
    USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
    return





    The LED lights up correctly, but the pic still does not enumerate even with calling the USBSERVICE. I have 0.5microF on VSUB, 20 MHZ crystal with 33 pF connected to it. D+, D- set up correctly. Bus powered.

    I have no idea what the problem is!

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

    Default

    For a 20mhz crystal, second config line should be

    Code:
    __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _IESO_OFF_1H
    DT

  3. #3
    Join Date
    Apr 2007
    Posts
    14

    Default

    I changed the config for 20 Mhz clock, but still no enumeration. I uploaded my project files in the following zip. Can someone please let me know if they can get this to enumerate on their bread board? Thanks
    Attached Files Attached Files

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

    Default

    It would have been much easier to start with mister_e's example ....

    Apparently, you have an 18F2550.INC file in your project folder where you are changing the configs.
    PBP won't use that file. It uses the one in the PBP folder.

    But you should really put the configs in your program, and comment out the configs in the 18F2550.inc file in the PBP folder.

    Use these ...
    Code:
        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
    Then remove the pauses in your loops, USBSERVICE must be called every ~1ms or less. (when enumerating)

    After making those changes, I was able to get your program to enumerate on an 18F4550. Don't have a 2550.

    DT

  5. #5
    Join Date
    Apr 2007
    Posts
    14

    Default

    Well I changed the config files and took out the pause in the code. Still no enumeration. Could this be a hardware problem?

    I attached everything the same way as the 4550 pictured by easyhid, but just adapted to the 2550.
    Attached Images Attached Images  

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

    Default

    There's always a chance for a hardware problem. But that's a liitle hard to troubleshoot on this end.
    The schematic is good though.

    Just noticed you have a DEFINE LOADER_USED 1

    Are you using a bootloader?
    DT

  7. #7
    Join Date
    Apr 2007
    Posts
    14

    Default

    No im not, im using melabs pic programmer. Should I take out that define statement?

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