USB on 18F2455 funky problem


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2006
    Posts
    32

    Question USB on 18F2455 funky problem

    Hi guys,

    Ive got a bit of a strange problem that I cant seem to fathom out.

    Ive got an 18F2455 using the USB and on the breadboard it works fine, plug in a USB to the project and I can read and write the settings etc. but earlier today, I transferred the project onto an etched PCB (checked the PCB for any shorts etc all checked out fine) now here's the problem, it all works as it should BUT whenever I hook it upto the USB windowz comes up with the error saying something like 'theres a problem with the USB divice (sorry cant remember exactly but you'll probably know lol!)

    I tried rewiring the USB port, changing the wire I used, even tried ultra short wires and nothing!
    I tested the lines with my meter, and sticking one probe onto each pin individually on the USB port and the other on the actual pins of the pic chip and theres no breaks on either track so im at a complete loss!! (GND obviously to the GND line and shows continuity)

    Im not using the 5V from the USB, as im using 24v PSU split down to 5V for the logic side etc, but I am obviously using the GND so that the PC and the project are grounded, and the D- D+ are correctly connected too.

    So does anyone have any suggestions? I can add a schematic if needed, but everything else is working fine.

    Many thanks,

    Mark

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

    Default Re: USB on 18F2455 funky problem

    Do you have a capacitor on VUSB? 0.22uF or greater?
    And is the regulator turned on in the configs?
    DT

  3. #3
    Join Date
    Dec 2006
    Posts
    32

    Default Re: USB on 18F2455 funky problem

    Hi Darrel,

    Yeah ive got a cap on the VUSB, same on both the breadboard and the project.
    regulator? youve got me there!

    Here is my config settings from my project, and I think it was from a thread about USB that I think maybe you had written (but dont quote me on that lol!)
    It all works fine when its sat on the breadbaord, just not when its on my PCB.

    Code:
    '****************************************************************
    ' Config settings
    '****************************************************************
    
    asm
    __CONFIG    _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]
                            ; No prescale (4 MHz oscillator input drives PLL directly)
    
    
    __CONFIG    _CONFIG1H, _FOSC_XTPLL_XT_1H & _FCMEM_OFF_1H & _IESO_OFF_1H 
                            ;                  ;               ; Oscillator Switchover mode disabled
                            ;                  ; Fail-Safe Clock Monitor disabled
                            ; XT oscillator, PLL enabled, XT used by USB
                            
    __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 & _XINST_OFF_4L & _DEBUG_OFF_4L 
    endasm
    DEFINE OSC 48
    clear
    Hope that helps.

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

    Default Re: USB on 18F2455 funky problem

    The _VREGEN_ON_2L turns on the regulator, so you're ok there.

    Does your PCB have a 4mhz crystal? That's what the configs are set for.

    Are you running USBSERVICE often enough? ~1-2mS.
    DT

  5. #5
    Join Date
    Dec 2006
    Posts
    32

    Default Re: USB on 18F2455 funky problem

    yeah im using a 4mhz xtal as theyre what I had handy at the time lol.
    Im using your USB ints for controlling the USB and its set to 10ms interval on both the USB_POLLIN and USB_POLLOUT

    Edit: USB interupts are running on TMR1

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

    Default Re: USB on 18F2455 funky problem

    Quote Originally Posted by Mark J View Post
    Edit: USB interupts are running on TMR1
    That should not be the case. They should run off of the USB interrupts.
    DT

  7. #7
    Join Date
    Jan 2006
    Location
    Toronto
    Posts
    109

    Default Re: USB on 18F2455 funky problem

    I don't know if this helps but I have had similar problems in the past and simply putting a capacitor from the USB V+ to GND worked every time. I always use a 0.1uF but it probably doesn't really matter what value.

  8. #8
    Join Date
    Dec 2006
    Posts
    32

    Default Re: USB on 18F2455 funky problem

    Quote Originally Posted by Darrel Taylor View Post
    That should not be the case. They should run off of the USB interrupts.
    Sorry Darrel, my mistake, the USB is running under the USB_HANDLER interupt, its my sub routine thats using TMR1 (late at night I posted that lol)

    Will try the cap across the pins and see if that remedies the problem as it is a bit of a headache having to remove the LED light unit from where it is to access the pic so I can edit the settings etc.

    Edit: just realised, do you mean the 5V to GND of the USB? as on my pcb (and breadboard) I never wired up the 5V as I dont need to use the 5v from the USB so thought better to be safe and not connect it anywhere on the PCB just in case the 2 different 5v sources made things go pop etc! Only pins wired on the PCB side for the usb port are the D+/D- and GND.
    Attached Images Attached Images  
    Last edited by Mark J; - 24th February 2011 at 22:30.

  9. #9
    Join Date
    Jan 2006
    Location
    Toronto
    Posts
    109

    Default Re: USB on 18F2455 funky problem

    Yes for some reason I have the same problem happen. Putting a cap across the USB V+ and GND seemd to fix it for me, I thought maybe it just needed some sort of load to make it work.

    I don't seem to need it on breadboards either, very wierd.

  10. #10
    Join Date
    Dec 2006
    Posts
    32

    Default Re: USB on 18F2455 funky problem

    Will have to try that but agree that it is very weird!! Will let you know if it does it for me too.

  11. #11
    Join Date
    Dec 2006
    Posts
    32

    Default Re: USB on 18F2455 funky problem

    Amazing!! rebuilt the USB breakout board and put a cap across the 5v and GND and blow me it works! weird! but MANY MANY thanks for the info!!!

    One (Almost) happy chappy

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