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 support@ccsinfo.com

18f14k50 USB This device cannot start. (Code 10) error

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



Joined: 21 Jun 2011
Posts: 9

View user's profile Send private message

18f14k50 USB This device cannot start. (Code 10) error
PostPosted: Sun Aug 12, 2012 1:12 pm     Reply with quote

Hi!

I'm testing the 18f14k50 low speed usb with 6 MHz resonator.
When I attach the device to the pc the following error code is displayed in the device manager after the driver install in win7:
This device cannot start. (Code 10)

I'm using ccs v4.124

The test code:
Code:

#include <18LF14K50.h>
#FUSES NOWDT, CPUDIV1, HS, PLLEN, NOMCLR, NOLVP, NOXINST, PUT, USBDIV1
#use delay(clock=24Mhz)
#define USB_USE_FULL_SPEED 0
#include <usb_cdc.h>
#define TX PIN_B7
#define RX PIN_B5
#use rs232(baud=9600, parity=N, xmit=TX, rcv=RX, bits=8, ERRORS, FORCE_SW, TIMEOUT=100)

void main() {
   int8 c;
   int8 a[4];

   setup_adc(ADC_CLOCK_DIV_16);
   setup_adc_ports(sAN7|sAN9);

   usb_init();

   while(1) {
      if (usb_enumerated()) {
         c = usb_cdc_getc();
         usb_cdc_putc(c);
      } 
   }
}


I tried ex_usb_mouse.c with the same config and it works fine.
Code:

#include <18LF14K50.h>
#FUSES NOWDT, CPUDIV1, HS, PLLEN, NOMCLR, NOLVP, NOXINST, PUT, USBDIV1
#use delay(clock=24Mhz)
#define USB_USE_FULL_SPEED 0

I tried ex_usb_serial.c with the same config and error code 10 again.

What am I doing wrong ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19348

View user's profile Send private message

PostPosted: Sun Aug 12, 2012 3:01 pm     Reply with quote

You'll have trouble getting a CDC device to work using low speed USB. Support for this by Microsoft, was officially dropped a few years ago. There are patched .sys files available on the web, to replace usbser.sys. A web search may still find them (though it hasn't been used by much for a while now). You'll have to edit the USB.inf file to select this instead of usbser.sys.
Problem is that a low speed USB device is allowed two USB interrupt pipes only, and the current USBSER driver needs more than this.
Basically MS decided to reserve 'low speed' for things like HID devices (joystick/mouse/keyboard etc.), and optimised the USBSER driver assuming this wouldn't be used.
Even if you can get it working, reliability may be poor....

Best Wishes
NePe



Joined: 21 Jun 2011
Posts: 9

View user's profile Send private message

PostPosted: Sun Aug 12, 2012 3:13 pm     Reply with quote

Thanks for your help.

I google it and find a driver that works:
http://www.recursion.jp/avrcdc/lowbulk.html

avrcdc_inf.zip
Ttelmah



Joined: 11 Mar 2010
Posts: 19348

View user's profile Send private message

PostPosted: Mon Aug 13, 2012 1:43 am     Reply with quote

Yes, AVR, was one of the little devices that used this. Even there though, I think you will find notes basically saying 'not a good idea now'. Certainly for anything commercial, you should not go this route. Given that by just changing resonator to 4MHz, or 8MHz, you could use the 'standard' full speed driver, it does seem a little pointless. Remember also, that you are only offered a relatively low data rate (8KB/sec - 8 bytes per packet 1K packets per second), so your device will use a lot of bus time, lots of transactions on the USB controller, and won't comfortably support speeds like 115200bps....

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