Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

problem connecting PIC18f4550 with GUI in laptop

Status
Not open for further replies.

electroing

New Member
hello, i used previous senior project to testing (it is success project), i burned the program in PIC but then i facing problem by connecting PIC18F with GUI. GUI status showing the status offline, but there is suppose online as i connect PIC to my laptop.

Any idea?

Please help!!
 
Last edited:
I assume you are using the USB peripheral on the '18F.

Really though there are not enough details.

It could be a problem with hardware, software on your PIC or software on your PC.
 
i am so sorry.

i got GUI which done using visual C++. PIC done using MPLAB. maybe the problem is the Vender ID and Product ID not match? just changing VID and PID? we can search VID and PID in usb_decription and?? so that it can match?
 
If you have used the same VID and PID for a different-function USB circuit on your current computer, then yes, you will have to change the PID or windows will be trying to use the wrong driver. The VID should be Microchips VID.

Some basic troubleshooting:

Are there any lights or otherwise on the circuit which you can see if the program is running?

Does the computer make the noise when you plug in the USB cable?

Does the USB device show up in device manager?

What type of device is your software configured as? (HID, Mass Storage, etc).

Did you write the USB descriptors yourself?

If you used Microchips example descriptors, and changed anything at all in the descriptors, then that could stop it working also.
 
I am using SK40C with PIC18F4550, when i plug in the USB, the LED of power is on.

Does the computer make the noise when you plug in the USB cable?
The laptop didn't make any noise when i plug in

Does the USB device show up in device manager?
The USB device did not show up anything in device manage

What type of device is your software configured as? (HID, Mass Storage, etc).
I am using HID bootloader

Did you write the USB descriptors yourself?
No, i didn't write myself. i used previous senior's.

This is my usb decriptors
#ifndef __USB_DESCRIPTORS_C
#define __USB_DESCRIPTORS_C

/** INCLUDES *******************************************************/
#include "usb.h"
#include "usb_function_hid.h"

/** CONSTANTS ******************************************************/
#if defined(__18CXX)
#pragma romdata
#endif

/* Device Descriptor */
ROM USB_DEVICE_DESCRIPTOR device_dsc=
{
0x12, // Size of this descriptor in bytes
USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type
0x0200, // USB Spec Release Number in BCD format
0x00, // Class Code
0x00, // Subclass code
0x00, // Protocol code
USB_EP0_BUFF_SIZE, // Max packet size for EP0, see usb_config.h
0x04D8, // Vendor ID
0x003F, // Product ID: Mouse in a circle fw demo
0x0002, // Device release number in BCD format
0x01, // Manufacturer string index
0x02, // Product string index
0x00, // Device serial number string index
0x01 // Number of possible configurations
};

/* Configuration 1 Descriptor */
ROM BYTE configDescriptor1[]={
/* Configuration Descriptor */
0x09,//sizeof(USB_CFG_DSC), // Size of this descriptor in bytes
USB_DESCRIPTOR_CONFIGURATION, // CONFIGURATION descriptor type
0x29,0x00, // Total length of data for this cfg
1, // Number of interfaces in this cfg
1, // Index value of this configuration
0, // Configuration string index
_DEFAULT | _SELF, // Attributes, see usb_device.h
50, // Max power consumption (2X mA)

/* Interface Descriptor */
0x09,//sizeof(USB_INTF_DSC), // Size of this descriptor in bytes
USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type
0, // Interface Number
0, // Alternate Setting Number
2, // Number of endpoints in this intf
HID_INTF, // Class code
0, // Subclass code
0, // Protocol code
0, // Interface string index

/* HID Class-Specific Descriptor */
0x09,//sizeof(USB_HID_DSC)+3, // Size of this descriptor in bytes
DSC_HID, // HID descriptor type
0x11,0x01, // HID Spec Release Number in BCD format (1.11)
0x00, // Country Code (0x00 for Not supported)
HID_NUM_OF_DSC, // Number of class descriptors, see usbcfg.h
DSC_RPT, // Report descriptor type
HID_RPT01_SIZE,0x00,//sizeof(hid_rpt01), // Size of the report descriptor

/* Endpoint Descriptor */
0x07,/*sizeof(USB_EP_DSC)*/
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
HID_EP | _EP_IN, //EndpointAddress
_INTERRUPT, //Attributes
0x40,0x00, //size
0x01, //Interval

/* Endpoint Descriptor */
0x07,/*sizeof(USB_EP_DSC)*/
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
HID_EP | _EP_OUT, //EndpointAddress
_INTERRUPT, //Attributes
0x40,0x00, //size
0x01 //Interval
};


//Language code string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409
}};

//Manufacturer string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[23];}sd001={
sizeof(sd001),USB_DESCRIPTOR_STRING,
{'U','N','I','M','A','S',' ','E','n','g','i','n','e','e','r','i','n','g',' ','T','e','a','m'
}};

//Product string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[22];}sd002={
sizeof(sd002),USB_DESCRIPTOR_STRING,
{'W','i','n','d',' ','M','o','n','i','t','o',
'r','i','n','g',' ','S','y','s','t','e','m'
}};

//Class specific descriptor - HID
ROM struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={
{
0x06, 0x00, 0xFF, // Usage Page = 0xFF00 (Vendor Defined Page 1)
0x09, 0x01, // Usage (Vendor Usage 1)
0xA1, 0x01, // Collection (Application)
0x19, 0x01, // Usage Minimum
0x29, 0x40, // Usage Maximum //64 input usages total (0x01 to 0x40)
0x15, 0x00, // Logical Minimum (data bytes in the report may have minimum value = 0x00)
0x26, 0xFF, 0x00, // Logical Maximum (data bytes in the report may have maximum value = 0x00FF = unsigned 255)
0x75, 0x08, // Report Size: 8-bit field size
0x95, 0x40, // Report Count: Make sixty-four 8-bit fields (the next time the parser hits an "Input", "Output", or "Feature" item)
0x81, 0x00, // Input (Data, Array, Abs): Instantiates input packet fields based on the above report size, count, logical min/max, and usage.
0x19, 0x01, // Usage Minimum
0x29, 0x40, // Usage Maximum //64 output usages total (0x01 to 0x40)
0x91, 0x00, // Output (Data, Array, Abs): Instantiates output packet fields. Uses same report size and count as "Input" fields, since nothing new/different was specified to the parser since the "Input" item.
0xC0} // End Collection
};


//Array of configuration descriptors
ROM BYTE *ROM USB_CD_Ptr[]=
{
(ROM BYTE *ROM)&configDescriptor1
};

//Array of string descriptors
ROM BYTE *ROM USB_SD_Ptr[]=
{
(ROM BYTE *ROM)&sd000,
(ROM BYTE *ROM)&sd001,
(ROM BYTE *ROM)&sd002
};

#endif


Thanks in advance.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top