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

pic18f4550 USB problem with win7

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



Joined: 14 Jun 2010
Posts: 3

View user's profile Send private message

pic18f4550 USB problem with win7
PostPosted: Mon Jun 14, 2010 2:24 am     Reply with quote

Hi eveybody! I'm new on this forum... i would like to ask you some help...
I'm trying to connect a PIC18F4550 via USB to my laptop with windows 7. the problem is that my pc see the pic as a device, but cannot install the right drivers, so i can't communicate.
I've searched on the net but i didn't found any help.

thanks!

krikko92
P51D



Joined: 25 Jan 2010
Posts: 36

View user's profile Send private message

Re: pic18f4550 USB problem with win7
PostPosted: Mon Jun 14, 2010 2:52 am     Reply with quote

krikko92 wrote:
the problem is that my pc see the pic as a device, but cannot install the right drivers, so i can't communicate.

Windows install automaticly the default microchip-usb-driver so it could be that it's not the correct driver

you can install the driver manual via "driver update", then select the source from the old driver (winxp driver is normaly compatible).

I've had never problems with win7 and PIC USB device.

best wishes
P51D
krikko92



Joined: 14 Jun 2010
Posts: 3

View user's profile Send private message

PostPosted: Mon Jun 14, 2010 2:58 am     Reply with quote

Thank you for the reply
i've already tried installing the driver manually, selecting the source as the Drivers file in the PICC file, but it doesn't work.
i've understand from the net that i need a file named ccport.inf but in my pc there isn't...
krikko92



Joined: 14 Jun 2010
Posts: 3

View user's profile Send private message

PostPosted: Mon Jun 14, 2010 3:11 am     Reply with quote

i solved my problems: i've moved the driver in another empty file, because windows picked the wrong driver. now it works.

thanks

krikko92
krlosjcc



Joined: 30 Sep 2010
Posts: 3

View user's profile Send private message

worse problem under windows 7 / 64 bits on laptop
PostPosted: Sun Oct 03, 2010 8:53 am     Reply with quote

I've been trying for weeks to connect the 4550 to my laptop but it won't even detect a device has been connected Rolling Eyes

can you help me to get it to work? maybe sample code or the guide you followed to get the work done.
Ttelmah



Joined: 11 Mar 2010
Posts: 19544

View user's profile Send private message

PostPosted: Sun Oct 03, 2010 10:14 am     Reply with quote

If it is not detecting that a device is connected, you probably have a hardware problem. Basically, if the PIC has the right clock, has the right voltages on Vss, Vdd, and Vusb, and is connected to the USB pins, if any of the USB demo programs are loaded, a device _will_ be seen. Getting it to work is the next stage, but you have something 'fundamental'.
First, check that the PIC is actually running. Do a basic 'flash an LED' type test. Then verify that it is running at the right rate.
Then double check the USB connections, and the smoothing on Vusb.
Then load on of the basic examples (ex_usb_serial.c). Modify it's PLL settings if your crystal is not the expected 20MHz, and see if this works.

Best Wishes
krlosjcc



Joined: 30 Sep 2010
Posts: 3

View user's profile Send private message

still nothing
PostPosted: Sun Oct 03, 2010 6:46 pm     Reply with quote

thanks a lot for your reply

I tried what you said, here's the code to probe that the pic is running

Quote:

#include "C:\Users\Carlos\Desktop\stuff\TEC\labComu\proyecto\prueba con led\soloLED.h"
#fuses USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=31000)

#define USB_HID_DEVICE FALSE //deshabilitamos el uso de las directivas HID
#define USB_EP1_TX_ENABLE USB_ENABLE_BULK //turn on EP1(EndPoint1) for IN bulk/interrupt transfers
#define USB_EP1_RX_ENABLE USB_ENABLE_BULK //turn on EP1(EndPoint1) for OUT bulk/interrupt transfers
#define USB_EP1_TX_SIZE 1 //size to allocate for the tx endpoint 1 buffer
#define USB_EP1_RX_SIZE 3 //size to allocate for the rx endpoint 1 buffer

#include <pic18_usb.h> //Microchip PIC18Fxx5x Hardware layer for CCS's PIC USB driver
#include "usb_desc_scope.h" //ConfiguraciĆ³n del USB por Enumerador Palitroquez
#include <usb.c> //handles usb setup tokens and get descriptor reports

#byte OSCCON = 0xFD3 //crea variable en la direccion del

void main()
{
OSCCON = 0b00000010; //configuracion del oscilador

output_high(PIN_B6);
delay_ms(500);
output_low(PIN_B6);
delay_ms(500);
output_high(PIN_B6);
delay_ms(500);
output_low(PIN_B6);
delay_ms(500);
output_high(PIN_B6);
delay_ms(500);
output_low(PIN_B6);
delay_ms(500);

usb_init();
usb_task();
usb_wait_for_enumeration();

output_high(PIN_B6); //if the led turns on, the pic supossely has been detected

delay_ms(500);
output_low(PIN_B6); //Ya fue detectado por PC
delay_ms(500);
}


and here's the enumerator I'm using


Quote:

#IFNDEF __USB_DESCRIPTORS__
#DEFINE __USB_DESCRIPTORS__

#include <usb.h>

//////////////////////////////////////////////////////////////////
///
/// start config descriptor
/// right now we only support one configuration descriptor.
/// the config, interface, class, and endpoint goes into this array.
///
//////////////////////////////////////////////////////////////////

#DEFINE USB_TOTAL_CONFIG_LEN 32 //config+interface+class+endpoint

//configuration descriptor
char const USB_CONFIG_DESC[] = {
//config_descriptor for config index 1
USB_DESC_CONFIG_LEN, //length of descriptor size
USB_DESC_CONFIG_TYPE, //constant CONFIGURATION (0x02)
USB_TOTAL_CONFIG_LEN,0, //size of all data returned for this config
1, //number of interfaces this device supports
0x01, //identifier for this configuration. (IF we had more than one configurations)
0x00, //index of string descriptor for this configuration
0xC0, //bit 6=1 if self powered, bit 5=1 if supports remote wakeup (we don't), bits 0-4 reserved and bit7=1
0x32, //maximum bus power required (maximum milliamperes/2) (0x32 = 100mA)

//interface descriptor 0 alt 0
USB_DESC_INTERFACE_LEN, //length of descriptor
USB_DESC_INTERFACE_TYPE, //constant INTERFACE (0x04)
0x00, //number defining this interface (IF we had more than one interface)
0x00, //alternate setting
2, //number of endpoints, not counting endpoint 0.
0xFF, //class code, FF = vendor defined
0xFF, //subclass code, FF = vendor
0xFF, //protocol code, FF = vendor
0x00, //index of string descriptor for interface

//endpoint descriptor
USB_DESC_ENDPOINT_LEN, //length of descriptor
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (0x05)
0x81, //endpoint number and direction (0x81 = EP1 IN)
0x02, //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
USB_EP1_TX_SIZE & 0xFF,USB_EP1_TX_SIZE >> 8, //maximum packet size supported
0x01, //polling interval in ms. (for interrupt transfers ONLY)

//endpoint descriptor
USB_DESC_ENDPOINT_LEN, //length of descriptor
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (0x05)
0x01, //endpoint number and direction (0x01 = EP1 OUT)
0x02, //transfer type supported (0 is control, 1 is iso, 2 is bulk, 3 is interrupt)
USB_EP1_RX_SIZE & 0xFF,USB_EP1_RX_SIZE >> 8, //maximum packet size supported
0x01, //polling interval in ms. (for interrupt transfers ONLY)

};

//****** BEGIN CONFIG DESCRIPTOR LOOKUP TABLES ********
//since we can't make pointers to constants in certain pic16s, this is an offset table to find
// a specific descriptor in the above table.

//NOTE: DO TO A LIMITATION OF THE CCS CODE, ALL HID INTERFACES MUST START AT 0 AND BE SEQUENTIAL
// FOR EXAMPLE, IF YOU HAVE 2 HID INTERFACES THEY MUST BE INTERFACE 0 AND INTERFACE 1
#define USB_NUM_HID_INTERFACES 0

//the maximum number of interfaces seen on any config
//for example, if config 1 has 1 interface and config 2 has 2 interfaces you must define this as 2
#define USB_MAX_NUM_INTERFACES 1

//define how many interfaces there are per config. [0] is the first config, etc.
const char USB_NUM_INTERFACES[USB_NUM_CONFIGURATIONS]={1};

#if (sizeof(USB_CONFIG_DESC) != USB_TOTAL_CONFIG_LEN)
#error USB_TOTAL_CONFIG_LEN not defined correctly
#endif


//////////////////////////////////////////////////////////////////
///
/// start device descriptors
///
//////////////////////////////////////////////////////////////////

//device descriptor
char const USB_DEVICE_DESC[] ={
USB_DESC_DEVICE_LEN, //the length of this report
0x01, //constant DEVICE (0x01)
0x10,0x01, //usb version in bcd
0x00, //class code (if 0, interface defines class. FF is vendor defined)
0x00, //subclass code
0x00, //protocol code
USB_MAX_EP0_PACKET_LENGTH, //max packet size for endpoint 0. (SLOW SPEED SPECIFIES 8)
0xD8,0x04, //vendor id (0x04D8 is Microchip)
0x11,0x00, //product id
0x00,0x01, //device release number
0x01, //index of string description of manufacturer. therefore we point to string_1 array (see below)
0x02, //index of string descriptor of the product
0x00, //index of string descriptor of serial number
USB_NUM_CONFIGURATIONS //number of possible configurations
};


//////////////////////////////////////////////////////////////////
///
/// start string descriptors
/// String 0 is a special language string, and must be defined. People in U.S.A. can leave this alone.
///
/// You must define the length else get_next_string_character() will not see the string
/// Current code only supports 10 strings (0 thru 9)
///
//////////////////////////////////////////////////////////////////

//the offset of the starting location of each string.
//offset[0] is the start of string 0, offset[1] is the start of string 1, etc.
const char USB_STRING_DESC_OFFSET[]={0,4,12};

#define USB_STRING_DESC_COUNT sizeof(USB_STRING_DESC_OFFSET)

char const USB_STRING_DESC[]={
//string 0
4, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
0x09,0x04, //Microsoft Defined for US-English
//string 1
8, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
'C',0,
'C',0,
'S',0,
//string 2
32, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
'P',0,
'I',0,
'C',0,
' ',0,
'M',0,
'i',0,
'g',0,
'S',0,
'a',0,
'n',0,
't',0,
'i',0,
'a',0,
'g',0,
'o',0,

};


#ENDIF

I get a blinking led at the beginning, but once the configuration of the device starts, it never blinks again as it's supposed to.

I connect the pic to a laptop with win7/64bit, and.... NOTHING HAPPENS, I connect it to a desktop running Sp 32bits and at least it says device not recognized. The author of the code says it's compatible with both versions of Windows. Any help would be appreciated.

Yes I know with the code provided the pic is not going to do anything through the usb, I just wanted to try if the pic was running and if it configured ok.
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