USB CDC Communications for Dummies!


Closed Thread
Results 1 to 40 of 105

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Posts
    48

    Default

    Thank you Darrel. Here are the configs from the code arnie posted earlier, which is very similar to the configs (except I used a 12 MHz oscillator) that I created earlier according to the data sheet and include file review.

    asm
    CONFIG_REQ
    CONFIG1L = _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    ; ; ; USB clock source comes from the 96 MHz PLL divided by 2
    ; ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2] Determines cpu speed
    ; No prescale (4 MHz oscillator input drives PLL directly)
    CONFIG1H = _FOSC_XTPLL_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    ; ; ; Oscillator Switchover mode disabled
    ; ; Fail-Safe Clock Monitor disabled
    ; XT oscillator, PLL enabled, XT used by USB
    CONFIG2L = _PWRT_ON_2L & _BOR_ON_2L & _BORV_2_2L & _VREGEN_ON_2L
    CONFIG2H = _WDT_OFF_2H
    CONFIG3H = _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H
    CONFIG4L = _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    ; Removed ICPRT_OFF_4L used with 18F4550
    endasm


    Did not have the define statement included though.... try that and see soon.
    Also, noticed that your oscillator settings were HS instead of XT.

    --Kirt

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

    Default

    If you're trying to use the new style CONFIG with PBP, you should be aware that it can't be placed in your program.
    It has to be the first thing loaded, which means it must be in a file that gets loaded before the PBP library. (Not fun)

    The original __CONFIG statements are still the way to set configs with PBP.
    In other words, please delete what you just posted from your program, and follow the suggested __CONFIG style.
    Also, noticed that your oscillator settings were HS instead of XT.
    HS mode will always drive a crystal that might qualify for XT mode. The reverse is not always true. I err on the Cautious side.
    DT

  3. #3
    Join Date
    Dec 2008
    Posts
    48

    Default

    Thank you Darrel.

    I was going through that the other day and the only way I could get code to compile is the way it is written now... but apparently not compiling correctly.

    When I use the __config statements, the following appears rather consistently.

    AUTO2550.ASM 72 : Overwriting previous address contents (0000)
    Error[118] C:\PROJECTS\KEYFER\AUTO2550\AUTO2550.ASM 72 : Overwriting previous address contents (0001)

    This doesn't require a CDC bootloader for the PIC, does it? Also noticed that the cdc windows drivers only have an .inf file and a .cat file, but no .sys file.

    --Kirt

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

    Default

    There we go. That one must be #3

    What to do if i get "overwriting previous address content" error message? (mister_e)
    http://www.picbasic.co.uk/forum/show...75&postcount=5
    DT

  5. #5
    Join Date
    Dec 2008
    Posts
    48

    Default

    Awesome!! That was number 3! Still with the OSC define statement, but will put that in for completeness sake! All works. Will post a detailed 'my experience' in a few.

  6. #6
    Join Date
    Dec 2008
    Posts
    48

    Default On An 18F2550

    Okay.... I got this puppy working with a bit of help from Darrel through the posts that lead up to this.

    Attached is the MPLAB project file and supporting files. The biggest stickler has been getting the configurations correct for the oscillator selection. So the rule going forward for my projects is to comment out the configuration statements in the PBP devicexxxxx.inc files and declare them in the program.

    Enjoy! Will be looking at this often as now I am moving onto inputs and other device profiles.... hopefully!
    Attached Files Attached Files

  7. #7
    Join Date
    Jan 2009
    Posts
    6

    Default

    I know to look out for all of the above and im very careful with setting configs on any 18 series device as there is a lot to them, however none of the above is my problem.

    I cannot even get a confirmed working hex file to work without the dredded "Unknown Device" error, with EXACT hardware even.

    Ive tried many different cables, ports, PC's etc. to no avail.

    I always use .47uF caps on VUSB, as I have a hundreds of them.

    Im about done with trying to get USB working and just continue on with the FTDI solution.

Similar Threads

  1. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  2. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 00:04
  3. USB CDC help..
    By jchandir in forum USB
    Replies: 6
    Last Post: - 22nd November 2008, 21:23
  4. Replies: 4
    Last Post: - 5th November 2008, 16:21
  5. USB PIC without USB Connection
    By Tissy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th December 2005, 17:39

Members who have read this thread : 3

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