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

[USB]Windows doesn't recognize the 18f4550

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



Joined: 05 Feb 2016
Posts: 33

View user's profile Send private message

[USB]Windows doesn't recognize the 18f4550
PostPosted: Mon Sep 19, 2016 5:35 pm     Reply with quote

Hello,

I want to use USB communication to communicate my 18f4550 and PC. I used the project wizard to create a project. Codes and header files here:

1-main.h file


Code:

#include <18F4550.h>
#device ADC=10

#FUSES NOWDT,XTPLL,PLL12                //No Watch Dog Timer

#use delay(clock=48MHz,crystal=4MHz,USB_FULL)

#define USB_CONFIG_VID 0x2405
#define USB_CONFIG_PID 0x000B
#define USB_CONFIG_BUS_POWER 500
#define USB_STRINGS_OVERWRITTEN

char USB_STRING_DESC_OFFSET[]={0,4,16};

char const USB_STRING_DESC[]={
   //string 0 - language
      4,  //length of string index
      0x03,  //descriptor type (STRING)
      0x09,0x04,  //Microsoft Defined for US-English
   //string 1 - manufacturer
      12,  //length of string index
      0x03,  //descriptor type (STRING)
      'K',0,
      'i',0,
      'r',0,
      'a',0,
      'z',0,
   //string 2 - product
      28,  //length of string index
      0x03,  //descriptor type (STRING)
      'M',0,
      'e',0,
      'd',0,
      'i',0,
      'c',0,
      'a',0,
      'l',0,
      'S',0,
      'e',0,
      'r',0,
      'v',0,
      'e',0,
      'r',0
};

#define USB_CONFIG_HID_TX_SIZE 63
#define USB_CONFIG_HID_RX_SIZE 63
#include <pic18_usb.h>
#include <usb_desc_hid.h>
#include <usb.c>







main.c file


Code:

#include <main.h>

/* TODO: Use usb_put_packet() to transmit data to USB HID,
using USB_HID_ENDPONT for the endpoint and the payload size
needs to match USB_CONFIG_HID_TX_SIZE. Use usb_get_packet()
to read incomming data, using USB_HID_ENDPOINT for the
endpoint. usb_enumerated() can be used to see if connected to
a host and ready to communicate. */

void main()
{
   usb_init();

   while(TRUE)
   {

      usb_task();

      //TODO: User Code
   }

}

temtronic



Joined: 01 Jul 2010
Posts: 9255
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Sep 20, 2016 5:02 am     Reply with quote

step 1... try the working examples that CCS supplies !
step 2.. be SURE D+ and D- ARE connected properly !!
step3 .. ONCE 1 and 2 are 100% working THEN 'go out on your own' and cut code.

USB is NOT easy unlike good old 'RS-232'. You NEED to have everything right for it to work.


PS be sure to READ and do what's in the comments in the example code and drivers......it's the 'details' you need to understand and do....

yup, I prefer good old RS232...HATE USB..

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19568

View user's profile Send private message

PostPosted: Tue Sep 20, 2016 9:22 am     Reply with quote

The .inf file for the CCS VID/PID is in a subdirectory off the examples folder. If Windows asks for a driver, it needs to be pointed at this. The string descriptor is meant to match the one in this file, or Windows will not accept it. The file itself, has to be approved by MS to be accepted, and if you change the descriptor, it will no longer match the ID stored in the security info.....

You can manually modify the file, but then Windows will always complain that the driver is not approved.
biomed12



Joined: 05 Feb 2016
Posts: 33

View user's profile Send private message

PostPosted: Tue Sep 20, 2016 2:33 pm     Reply with quote

temtronic wrote:
step 1... try the working examples that CCS supplies !
step 2.. be SURE D+ and D- ARE connected properly !!
step3 .. ONCE 1 and 2 are 100% working THEN 'go out on your own' and cut code.

USB is NOT easy unlike good old 'RS-232'. You NEED to have everything right for it to work.


PS be sure to READ and do what's in the comments in the example code and drivers......it's the 'details' you need to understand and do....

yup, I prefer good old RS232...HATE USB..

Jay


Dear Jay,

I definitely agree with you about RS-232 but I have to accomplish this peripheral to my MCU-devices to make it more efficient. As you know RS-232 ports no longer exist in modern computers. I don't want to use any additional peripheral no longer.

I think this problem related to win10. I will install win7 and try to solve problem for win10.

Thanks.
temtronic



Joined: 01 Jul 2010
Posts: 9255
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Sep 20, 2016 2:44 pm     Reply with quote

As Mr T points out, you need to give Windows (any version +-) the correct information and it will work. I used the CCS examples on XP pro and home without problems...

Nowadays I don't use the 4550 for several reasons...

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19568

View user's profile Send private message

PostPosted: Wed Sep 21, 2016 1:41 am     Reply with quote

As I have already pointed out the problem is security.

Windows10 (and the later releases of W7, to a slightly lesser extent), will now only allow 'secured' drivers to be used. CCS supply one for their VID/PID/Name combination, but you are changing the name, which means the security certificate is invalid.....

If you want your own name, you will need to buy a PID/VID combination, and generate a new .inf file to match this, and then get a security certificate for this.

Otherwise just use the CCS example name.
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