PDA

View Full Version : Device not recognized with PIC18F13K50 and ...14K50



rocket_troy
- 8th December 2010, 05:18
Been playing around with the PIC18F13K50 and 14K50 with PBP to utilise the UBS functionality via a "Low Pin Count Development Kit Board". After programming, I can connect the PIC & board up to my home XP desktop PC through USB and it works a treat. However, if I connect it up any other computer, I receive a "USB Device Not Recognized" message and suffice to say I have no USB access.

Any ideas as to what the problem could be?

Thanks for any help,

Troy

mackrackit
- 8th December 2010, 07:15
Probably missing the driver.
Look in the PBP directory -- USB18-- for mchpcdc.inf
Copy that to the other machines.

rocket_troy
- 8th December 2010, 21:52
Dave,
I don't think (caveat: this is all pretty new to me) it's a driver issue. I've tried to load that driver, but these systems aren't looking for a driver and refuse to load it when I point them to it. It's as if there's enough communication between the host and the PIC to recognize there is a valid USB device attached to it, but there doesn't appear to be any identification of the device coming through or information about what type of USB device it's supposed to be. I've looked in the assembler code and all the relevant ID headers etc appear to be in that, but for some reason it's not making it to the host? It's as if the host is saying "well, I don't know anything about this USB device so it's pointless changing the driver for it".
One thing I did notice was that the machine that does communicate with it has XP service pack 3 installed on it where 2 of the other machines I've tried it on don't. Could that be important?

Thanks,

Troy.

mackrackit
- 9th December 2010, 02:38
Looks like we need more info.
Is the project a CDC or HID?
Hardware -- capacitor value on VUSB?
How often is the the USB serviced?
Version of PBP?

Posting the code will help.

rocket_troy
- 9th December 2010, 03:22
Looks like we need more info.
Is the project a CDC or HID?

CDC - the bog standard example that comes with PBP in the PIC18 directory


Hardware -- capacitor value on VUSB?

I'm using a Microchip Low Pin Count USB development board BS41356B (or just 41356B) and the capacitor on VUSB looks like a 0.047uf by looking at the schematic of the board.



How often is the the USB serviced?

Again, it's the standard CDC example with PBP and there's virtually no pauses and minimal instructions within both servicing loops.


Version of PBP?

V2.60

It appears like it's some kind of enumeration issue. I downloaded a trial version of USB Trace to try and gather some kind of handle on what's being transferred during the enumeration process. Attached is a screen capture of the enumeration process.
Key:
Grey - Outgoing: From Host to device
Green - Incoming (success): From device to Host
Red - Incoming (Failed): From Device to Host

I notice there's no packets with data transferred. I'll do a comparison with the computer that successfully enumerates with this device. This is the result with the PIC connected to a laptop (host) running an early version of Vista Business.

Thanks for any assistance or pointers.

Troy.

mackrackit
- 9th December 2010, 03:36
I know this will sound like I am beating the dead horse, but I still think it is a driver issue.

With the USB plugged in does it show up in device manager? If so, do the update driver thing pointing to the mchpcdc.inf.

To answer your earlier question about old XP. I do not think that is a problem. That *.inf is supposed to be good for Win 2000 and up.

rocket_troy
- 9th December 2010, 04:40
mackrackit

I know this will sound like I am beating the dead horse, but I still think it is a driver issue.

With the USB plugged in does it show up in device manager? If so, do the update driver thing pointing to the mchpcdc.inf.

To answer your earlier question about old XP. I do not think that is a problem. That *.inf is supposed to be good for Win 2000 and up.


Dave,
I know where you're coming from and that was my 1st guess as to what's causing the issue.
Ok, with the Vista laptop I'll explain the process of what I've tried and experienced:

Connect the device (programmed on Microchip board) to a USB port.
Wait for something to happen
Message comes up saying "USB device not Recognized etc"
In the Device Manager, the device does appear in the updated list of Universal Serial Bus Devices as "Unknown Device"
There's no change or addition of any COM ports further up the Device manager list.
If double click on this "Unknown Device" listing I get the properties dialog for this device.
In the "General" Tab of the properties dialog for Unknown Device I get:
Device type: Universal Serial Bus controllers
Manufacturer: Standard USB Host Controller
Location: Port_#0002 Hub_#0001
Device status - No drivers are installed for this device

Under the "Driver" Tab:
Driver Provider: Microsoft
Driver Date: 21/06/2006
Driver Version: 6.0.6000.20596
Digital Signer: microsoft windows

If I click on the "Driver Details" button I get a message box that states: "No driver files are required or have been loaded for this device."

If I click on the "Update Driver" button and follow the various processes that allow me to point device manager to the directory with the PBP provided driver, I ultimately receive a "The best driver software for your device is already installed" with a "Windows has determined the driver software for your device is up to date" statement below that.
Basically, Vista won't under any of the circumstance I've encountered so far, accept any nominated driver to be associated with this device and I've tried at least a dozen different drivers that I thought could be suitable.
I'm assuming this is because the host doesn't have enough identification on the device to associate anything to it, but that could be just naive speculation.
I can uninstall the driver, but Vista will automatically reload ... well ... whatever it associates with the device next time I connect it, without any option to load a different driver.

Back to the properties dialog now in the "Details" tab:
Device Description: Unknown Device
Hardware Ids: USB\UNKNOWN
Compatible Ids: USB\UNKNOWN
Driver Key: {36fc9e60-c465-11cf-8056-444553540000}\0057
Manufacturer: (Standard USB Host Controller)
Physical Device Object name: \Device\USBPDO-14
Capabilities: 00000004 CM_DEVCAP_REMOVABLE
Bus Number: 00000000
Enumerator: USB
Address: 0000002
Power Data:
Current power state:
D3

Power capabilities:
0000005D
PDCAP_D0_SUPPORTED
PDCAP_D2_SUPPORTED
PDCAP_D3_SUPPORTED
PDCAP_WAKE_FROM_D0_SUPPORTED
PDCAP_WAKE_FROM_D2_SUPPORTED

Power state mappings:
S0 -> D0
S1 -> D2
S2 -> D2
S3 -> D2
S4 -> D2
S5 -> D3

Install State: 00000000
Display Name: Unknown Device
Device Instance Path: USB\VID_0000&PID_0000\5&2B5F8035&0&2
DevNode status:
01806000
DN_DISABLEABLE
DN_REMOVABLE
DN_NT_ENUMERATOR
DN_NT_DRIVER

Driver Node Strong Name:
usb.inf:Generic.Section.NTx86:BADDEVICE.Dev:6.0.60 00.20596:usb\unknown

Driver assembly date: 21/06/2006
Driver assembly description: Unknown Device
Inf Name: usb.inf
Inf section: BADDEVICE.Dev
Inf section extention: .NT
Matching Device ID: usb\unknown
Provider: Microsoft
Rank of installed driver: 0DFF0000

Etc...

Cheers,

Troy.

ps: the VUSB cap value was supposed to be 0.47uf not 0.047uf (typo)

rocket_troy
- 9th December 2010, 05:56
I just tried to really twist Vista's arm to load the mchpcdc.inf driver by sneaking into c:\windows\inf and renaming the usb.inf to usb.tmpinf. After uninstalling this driver from the association to the PIC18F14K50 device I disconnected and reconnected the USB cord. Vista had no usb.inf to find so it threw its claws in the air and gave up looking thereby providing me with an option to load mchpcdc.inf, but alas, it still didn't accept it. Can't remember the exact message, but it went along with lines of "Windows can't associate this driver to USB device with name Unknown Device".

Wha Wha Wha Whaaaaaaaaaaaaaa.... [resigned sigh]

Troy.

mackrackit
- 9th December 2010, 10:35
Maybe??
http://www.microchip.com/forums/tm.aspx?m=488342

rocket_troy
- 9th December 2010, 22:27
mackrackit

Maybe??
http://www.microchip.com/forums/tm.aspx?m=488342


Dave,
Thanks for the link, but unfortunately it didn't work. I'm 95% sure this is not a driver issue. I've tried connecting the PIC+board to 6 different computers now - 2 with success and 4 without. The 2 I had success with have lots in common - they're both Acer Desktop computers of about the same vintage and both run XP; however I don't think one has SP3 installed and I tend to agree it's not a service pack issue.
When I *initially* (ie. for the very 1st time) connect the PIC+CDC code to one of these Acer Desktops, the USB controller communicates with it well and gathers straight away that it has a CDC device connected. A little bit later it'll ask for a driver and all be it fine and dandy.
The machines that it doesn't work with have not much in common - 1 old XP laptop, 1 vista laptop and 2 non Acer desktops running XP - don't get to the stage of recognizing any of the identification or capabilities of the device.
So, I'm tending to think the issue is either a USB controller or a hardware issue?

If I *omit* the line OSCTUNE 0.6 = 1 which activates the PLL, which I think multiplies my 12Mhz crystal speed x4 to enable all speed modes of USB, I get the same "Device Not Recognized" error with the Acer Desktops. This leads me to think the process or mechanism that enables the host to recognize there's a USB device attached doesn't require the system clock to function properly perhaps? Dunno... But to get any further than acknowledging it has an unrecognizable USB device attached does require a working clock that complies with the USB requirements and the various correct protocols and handshaking for the enumeration to at least get to the point of the operating system to request a specific driver (if required)?

Troy.

mackrackit
- 9th December 2010, 23:59
Comment out the OSCTUNE line and have the configs set like this.


__CONFIG _CONFIG1L, _CPUDIV_NOCLKDIV_1L & _USBDIV_OFF_1L
__CONFIG _CONFIG1H, _FOSC_HS_1H & _PLLEN_ON_1H & _PCLKEN_ON_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _BBSIZ_OFF_4L & _XINST_OFF_4L

rocket_troy
- 10th December 2010, 01:06
mackrackit

Comment out the OSCTUNE line and have the configs set like this.

Tried it. No luck on the Vista notebook, but it still works fine on the Acer Desktop boxes ie. status quo.
One thing I have noticed when I program the chip via the Microchip PICkit 2 interface is that a yellow message always appears after loading a HEX file compiled from a PBP example stating that some of the configuration words are not in the HEX file and requests me to check the configuration settings to verify they're ok. I'm assuming this isn't the cause of my grief as I've also tried to load some of Microchip's PIC18F precompiled examples where the message didn't come up, but still no luck on the Vista notebook.

Troy.

rocket_troy
- 16th December 2010, 01:09
It's working on the vista notebook!

The fix could be classified as something obvious that I should've known or read about, but it took a fair bit of analyzing and reading to finally pinpoint the issue. It was a jumper (J12) on the Microchip development board which I left open that connected the VUSB; so Dave you were on the right track to begin with. Obviously the thing that really threw me off the scent was the fact it would work fine on some computers and not others.

Thanks again for the assistance Dave,

Cheers,

Troy.