CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC18F2455 + USB - Solved

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

PIC18F2455 + USB - Solved
PostPosted: Wed Aug 12, 2009 3:39 pm     Reply with quote

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. Embarassed

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

View user's profile Send private message

PostPosted: Wed Aug 12, 2009 3:51 pm     Reply with quote

This thread contains a "walk through" for the Ex_usb_hid.c example:
http://www.ccsinfo.com/forum/viewtopic.php?t=38897
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 11:56 am     Reply with quote

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. Cool
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 1:59 pm     Reply with quote

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. Cool Cool
Ttelmah
Guest







PostPosted: Thu Aug 13, 2009 2:50 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group