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

Variable never used USB_STRING_DESC_OFFSET?

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



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

Variable never used USB_STRING_DESC_OFFSET?
PostPosted: Fri Aug 12, 2016 8:53 am     Reply with quote

The CCS USB library have some Warnings but it works anyway, but now I did note this one

Variable never used: USB_STRING_DESC_OFFSET

I don't know if ok or not but now the USB doesn't recognize the device (unknown device).

The device is a PIC18F67J50 CCS version is 5.058.


In the main c file I have

Code:

#define  USB_CONFIG_PID       0x0000
   #define  USB_CONFIG_VID       0x0000
   #define  USB_CONFIG_BUS_POWER 500   //500mA  (range is 0..500)
   #define  USB_CONFIG_VERSION   0x0100      //01.00  //range is 00.00 to 99.99
char USB_STRING_DESC_OFFSET[]={0,4,20};
// Here is where the "CCS" Manufacturer string and "SERIAL DEMO" are stored.
// Strings are saved as unicode.
// These strings are mostly only displayed during the add hardware wizard.
// Once the operating system drivers have been installed it will usually display
// the name from the drivers .INF.
char const USB_STRING_DESC[]={
   //string 0
         4, //length of string index
         0x03, //descriptor type 0x03 (STRING)
         0x09,0x04,   //Microsoft Defined for US-English
   //string 1  - manufacturer
         16, //length of string index
         0x03, //descriptor type 0x03 (STRING)
         'L',0,
         'a',0,
         'm',0,
         'd',0,
         'a',0,
         '0',0,
         '1',0,
   //string 2 - product
         30, //length of string index
         0x03, //descriptor type 0x03 (STRING)
         'T',0,
         'X',0,
         '8,0,
         '0',0,
         '0',0,
         ' ',0,
         'U',0,
         'S',0,
         'B',0,
         ' ',0,
         'U',0,
         'A',0,
         'R',0,
         'T',0
};
//set to 1 to use a PIC's internal USB Peripheral
//set to 0 to use a National USBN960x peripheral
#define __USB_PIC_PERIF__ 1
#if __USB_PIC_PERIF__ && defined(__PCH__)
 #define USB_CON_SENSE_PIN PIN_E0
#endif

#include <usb_cdc.h>


The VID/PID is not 0x0000, I have my own.

There's something wrong with this?
Why USB_STRING_DESC_OFFSET are not being used?
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19516

View user's profile Send private message

PostPosted: Fri Aug 12, 2016 10:42 am     Reply with quote

That's perfectly all right. It is left over from the old drivers that used this.

VID 0x0000 & PID 0x0000 is never going to be recognised.

PID can be zero (this is a development ID).

However the VID has to be a legitimate vendor ID. Use the CCS UART one that come with the compiler. The Windows drivers will not recognise the device unless it has a legitimate vendor ID. You can write your own .inf file to accept other values, but 1, is the lowest allowed VID (actually Kingston).

Use the VID/PID supplied by CCS.
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

PostPosted: Fri Aug 12, 2016 12:57 pm     Reply with quote

The VID/PID is not 0x0000, I have my own.
I just changed to 0x0000 when I created the post on purpose.
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19516

View user's profile Send private message

PostPosted: Fri Aug 12, 2016 1:40 pm     Reply with quote

If you have your own, you will have to write your own .inf file to support it.

Understand that Windows has the basic USB CDC 'driver', but it has to be told to use this. This is what the .inf file does. It looks at the incoming VID/PID and checks this against the data supplied in it's inf files to find what driver to use.

For the CCS VID/PID, this is in the Drivers\NT,2000,XP,VISTA,7,8,10 directory.

You'll need to take the .inf file there, and edit it to match the VID/PID you are using. Beware though that you won't have the driver signing, so Windows will complain every time this is installed that it is an unsupported driver, and require this to be authorised.

This is different from things like HID devices where basic classes are supported without any inf file. For CDC an inf file is needed.
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

PostPosted: Fri Aug 12, 2016 3:44 pm     Reply with quote

I thought that HID needs a specific DLL to handle the device (PIC) from PC side.
Is not that way?

I never use the HID because I don't know how to create the DLL.
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19516

View user's profile Send private message

PostPosted: Sat Aug 13, 2016 2:12 am     Reply with quote

No, depends on the device.

There are a number of standard HID devices that can be used without any other driver (keyboard, mouse etc..).

Throughout USB, there are standard driver 'classes', that can be supported without an add-on genuine 'driver', but they still require being 'told' what actual driver to use.

Look here:
<https://msdn.microsoft.com/en-gb/library/windows/hardware/ff538820(v=vs.85).aspx>
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