View previous topic :: View next topic |
Author |
Message |
jaderd
Joined: 26 Jun 2009 Posts: 19
|
Problems with USB / 18F4550 |
Posted: Fri Jun 26, 2009 12:34 pm |
|
|
Hi! I am using many examples and projects downloaded off internet, or examples of the CCS Compiler to comunicate between PIC / PC and never the PC recognized the PIC. On all projects and examples, when connect the USB cable, the messages show that the device is not recognized. I need help, because I read the datasheet, manuals, tutorials, and I can't make the PC recognize the PIC, on CDC examples and HID too.
I am using a 20MHz crystal, and the code to oscillator configuration is above:
Code: | #include <18F4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1, VREGEN
#use delay(clock=48000000)
|
I am using a 270nF capacitor in USB pin of the PIC, but I don't use the 5V power supply of the bus. I have an external supply, for it the +Vcc USB bus pin is connected with a 10k pin to ground.
A curious fact is which never, on none of the examples or projects, the windows requests some driver.. Some tests the windows install a generic driver, but with this driver the pic does not communicate with PC, or as serial emulator (cdc).
I need help!!!!! Thanks in advance!!! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
jaderd
Joined: 26 Jun 2009 Posts: 19
|
|
Posted: Fri Jun 26, 2009 1:08 pm |
|
|
I make the modifications presents on the post and nothing changed.
The windows install the generic driver, and shows the PIC in the hardware list as unknown device... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 26, 2009 1:23 pm |
|
|
What version of Windows ? I tested this on Win2K SP4. |
|
|
jaderd
Joined: 26 Jun 2009 Posts: 19
|
|
Posted: Fri Jun 26, 2009 1:43 pm |
|
|
the version is XP SP2... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 26, 2009 2:51 pm |
|
|
What is your compiler version ? It's a 4-digit number in this format: x.xxx
It's given at the top of the .LST file. The .LST file is in your project
directory (after a successful compile). |
|
|
jaderd
Joined: 26 Jun 2009 Posts: 19
|
|
Posted: Fri Jun 26, 2009 2:55 pm |
|
|
CCS PCH C Compiler, Version 4.068, 5937 |
|
|
jaderd
Joined: 26 Jun 2009 Posts: 19
|
|
Posted: Fri Jun 26, 2009 3:05 pm |
|
|
I heard that some versions of the CCS have bugs in the oscillator configuration, but I dont know what is and which versions are. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 26, 2009 3:19 pm |
|
|
I did a file comparison on some of the USB files, such as
Quote: |
pic18_usb.h
ex_usb_hid.c
usb_desc_hid.h
|
and there are many differences between vs. 4.068 and vs. 4.093.
(I didn't compare all the files in the project. I stopped looking after
seeing so many differences in just these 3 files). |
|
|
jaderd
Joined: 26 Jun 2009 Posts: 19
|
|
Posted: Mon Jun 29, 2009 8:06 am |
|
|
but if you found these differences are the origins of failure in using the USB communication? |
|
|
Ttelmah Guest
|
|
Posted: Mon Jun 29, 2009 9:59 am |
|
|
I doubt it.
I have USB code working OK, that was compiled with versions back around this area.
A couple of other comments apply.
270nF, is 'borderline'. CCS, recommend 470nF, and some chips do seem to need the larger capacitor.
Unless you are making the Vusb sense connection to the chip, you need to adjust the setting in the demo files to say this is not present. Both the serial examples, and the USB_HID example, assume that the sense connection is present on B0, and won't function, unless this is made, or this feature is turned off (add a line defining this to be '0', before loading the USB stuff in the examples). If this line is floating, it'd explain everything.....
I think the |
|
|
Guest
|
|
Posted: Mon Jun 29, 2009 11:00 am |
|
|
I will try it, but I already disable this option. |
|
|
Guest
|
|
Posted: Mon Jun 29, 2009 11:32 am |
|
|
I think that my code is correct on the sense pin mode:
Code: | #ifndef USB_CON_SENSE_PIN
#define USB_CON_SENSE_PIN 0
#endif |
This code is in "pic18_usb.h"... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 29, 2009 11:40 am |
|
|
That's the .h file. It's #included in the Ex_usb_hid.c example file.
The #define statement in the .h file is only compiled if the symbol is not defined elsewhere.
But it is defined elsewhere. It's #defined in the Ex_usb_hid.c file:
Code: |
#define __USB_PIC_PERIF__ 1
///only the 18F4550 development kit has this pin
#if __USB_PIC_PERIF__ && defined(__PCH__)
#define USB_CON_SENSE_PIN PIN_B2
#endif |
So your program does use the sense pin. |
|
|
jaderd
Joined: 26 Jun 2009 Posts: 19
|
|
Posted: Mon Jun 29, 2009 11:50 am |
|
|
I had reviewed these 3 lines, thus, is not without the sense pin? |
|
|
|