View previous topic :: View next topic |
Author |
Message |
bungee-
Joined: 27 Jun 2007 Posts: 206
|
PIC18F2455 + USB - Solved |
Posted: Wed Aug 12, 2009 3:39 pm |
|
|
Hi!
I'm trying now for two days to connect my PIC to my PC. I was first trying to use modified ex_usb_serial.c, but because I use windows 7 I thought that CDC driver is not working with this version of OS. So I decided to try to bring up to life a little modified ex_usb_hid.c but it was almost the same result: "Unknown device" reported by windows.
Modification that I made was to remove the code that was written for other peripherals and RS232 was replaced with LCD (unmodified driver from CCS).
When I start the PIC it boots, it writes "Hello world" and after that comes USB part.
I use PIC18F2455 with external 20MHz clock source and relevant fuses set as: Code: | #FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PLL5 //Divide By 5(20MHz oscillator input)
#FUSES USBDIV //USB clock source comes from PLL divide by 2
#FUSES CPUDIV1 //No System Clock Postscaler
#FUSES VREGEN //USB voltage regulator
#use delay(clock=48M)
|
Is there a really good soul that would post the minimum code reqired for PIC to connect to PC and report it self as HID. So I can see if it my hardware that is causing the problems or my programming.
Allmost forgot, I use CCS ver 4.088.
Edit: Change to Subject
Last edited by bungee- on Thu Aug 13, 2009 2:01 pm; edited 2 times in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Thu Aug 13, 2009 11:56 am |
|
|
Thank you for reply.
The "walk through" was allready done because I have to modify the code according to my hardware.
And today with a clearer mind I found my "typos" in the code and now it is working like a charm. |
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Thu Aug 13, 2009 1:59 pm |
|
|
I have to post one of my additional observation. I had, beside the code problems, problem with the hardware itself.
I had capacitor on Vusb that was not adequate (33nF) I changed it to 100uF and life become beautifull again.
I have to report that even CDC example is running on Windows 7 ....
Problem with "driver" was in fact USB device that was wrongly introducing it self. |
|
|
Ttelmah Guest
|
|
Posted: Thu Aug 13, 2009 2:50 pm |
|
|
Put a capacitor in the recommended range on Vusb.
220nF, to 470nF.
Though it is working, 100uF cap, probably implies an electolytic, which usually have poor HF response, and you risk problems from this. 220nF, is the _minimum_ recommended (which is why 33nF didn't work), and 470nF is generally more reliable.
You now see why we always suggest going 'back' to known working code.
Best Wishes |
|
|
|