|
|
View previous topic :: View next topic |
Author |
Message |
NePe
Joined: 21 Jun 2011 Posts: 9
|
18f14k50 USB This device cannot start. (Code 10) error |
Posted: Sun Aug 12, 2012 1:12 pm |
|
|
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: 19545
|
|
Posted: Sun Aug 12, 2012 3:01 pm |
|
|
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
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Mon Aug 13, 2012 1:43 am |
|
|
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 |
|
|
|
|
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
|