• AVR Freaks

Helpful ReplyHot!USB COM driver not migrated PIC18 [SOLVED]

Author
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
2020/04/01 05:19:27 (permalink)
0

USB COM driver not migrated PIC18 [SOLVED]

I'm debugging a USB driver on a PIC18f2455. Here's the sequence:
1) (after receiving and setting address)
2) Host requests full Device Descriptor... I send... Host ACKs (returns zero-length data).
3) Host requests Config Descriptor... I send... Host ACKs (returns zero-length data).
4) I assume the driver loads at this point. 
    I receive notification from Windows that the is being set up
    I receive notification from Windows that the driver is read to use. 
5) Chip receives 2nd request for the Device Descriptor (DD) (I assume this comes from the driver).
6) I send the DD... and receive ACK (zero-length data). 
That's the last transaction the chip receives. I'm assuming the driver didn't like my DD. 
 
Windows Device Manager reports "Device Failed Operation" and "Device not mitigated":
Device USB\VID_D804&PID_0A00\5&36f97d97&0&1 was not migrated due to partial or ambiguous match.
Chip:   PIC18f2455
Windows 10
Vendor ID:  using MC's vendor id (0x04d8)
Device ID: 0x000a (MC's RS232 device code)
USB Ver: 2.0
 
I tried reversing the VID and PID for low-order byte first and got the same result. Web search for "Device not mitigated" hasn't helped. 
 
Does anyone have any ideas? 
 
post edited by The Bean - 2020/05/09 04:47:06
#1
crosland
Super Member
  • Total Posts : 1942
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/01 06:14:12 (permalink) ☄ Helpfulby The Bean 2020/04/01 06:17:30
+1 (1)
Have you used Microchip VID/PID before on other projects?
 
I would find a way to purge all devices from Windows that use MCs VID/PID.
#2
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/01 06:17:36 (permalink)
0
I have. I'll check that out. 
Thanks. 
#3
crosland
Super Member
  • Total Posts : 1942
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/01 06:24:46 (permalink)
0
A further thought:
 
I don't know what VID/PID the MC dev tools use so might be best just to try and remove devices that match the VID/PID you are having problems with.
 
I always use VID/PID from MCs USB sub-licensing program, which I assume are different to any official MC ones.
#4
ric
Super Member
  • Total Posts : 27115
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/01 14:11:54 (permalink)
+1 (1)
Note "mitigated" is a different word to "migrated".
The message in your first post does indicate you have the LSB/MSB of VID and PID swapped.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#5
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/02 07:33:32 (permalink)
0
Thank you all for your responses. I'm making progress. 
1) Yes, it's migrated not mitigated. My mistake. 
2) It doesn't seem to matter about Least significant byte (LSB) first or MSB first. They both load the same driver. Most curious. I'm still working on that. 
3) I'm trying different MC devices based on the INF's. I have an MC "stick" product with the same micro (PIC18f2455) I'm trying to emulate. (I'm new to the world of INFs and Drivers, going through learning curve). 
Bottom line: Made progress on driver. It now does everything except start the COM port. It does start the control port. 
#6
mlp
boots too small
  • Total Posts : 916
  • Reward points : 0
  • Joined: 2012/09/10 15:12:07
  • Location: previously Microchip XC8 team
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/03 15:22:28 (permalink)
+1 (1)
TheBean
1) Yes, it's migrated not mitigated. My mistake. 

Then fix it. This isn't Reddit - titles are editable.

Mark (this opinion available for hire)
#7
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/19 11:58:03 (permalink)
0
Unfortunately, I still need help with this (4 weeks of identical results no matter what I change). I've uninstalled previous versions, changed PIDS, changed functional capabilities, everything. 
 
Any Ideas??????
#8
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11827
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/19 12:51:03 (permalink)
0
A CDC USB device doesn't require a driver or .inf file installation on Windows 10.  Are you using the Microchip CDC demo code?
#9
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/04/21 04:27:55 (permalink)
0
I'm trying 2 different drivers. The device I'm modeling uses the microchip driver (PID 0x9015). It's the same driver as the Demo (I checked the .INF). Note that i also tried the Demo PID as well as the standard RS232 PID (0x000a). When I use the microchip VID with any of these PIDs, I get the microchip driver.
 
 
In my research, I discovered a documented trick to force loading of the standard microsoft driver which works (set both Class and SubClass to 0x02 in the device descriptor). 
Both drivers give me identical results. 
 
I had a thought this morning that it might not be driver-related. When I test with a new PID (either by uninstalling the previous device or by changing the PID), the host asks for a device_qualifier descriptor. As I'm only supporting full speed, I reply with a stall packet to indicate no support for the device_qualifier descriptor. The 2nd request for the device descriptor follows, so I may not be issuing the stall packet correctly (I've tested several methods). The host never asks for it again using for that VID/PID until I uninstall it. 
 
I suspect this is better handled as a separate thread. 
#10
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/05/06 14:37:01 (permalink)
+2 (2)
SOLVED. A combination of wrong sync bits (DATA0 vs DATA1) and ping-pong buffers caused very confusing results. 
For anyone else who's reading... Unless you're running at 48Mhz, use ping-pong buffers on EP0 (I was able to get it to work using single buffers at 48Mhz, but at 24Mhz, I couldn't turn the buffer around fast enough). I aways set my sync bits in the BD to 1. That seems to work well. 
Thank you all for your time and effort! 
#11
xiaoximena
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2020/05/25 11:50:12
  • Location: 0
  • Status: offline
Flagged as Spam (2)
Re: USB COM driver not mitigated PIC18 2020/06/01 06:27:40 (permalink)
0
TheBean
SOLVED. A combination of wrong sync bits (DATA0 vs DATA1) and ping-pong buffers caused very confusing results. 
For anyone else who's reading... Unless you're running at 48Mhz, use ping-pong buffers on EP0 (I was able to get it to work using single buffers at 48Mhz, but at 24Mhz, I couldn't turn the buffer around fast enough). I aways set my sync bits in the BD to 1. That seems to work well. 
Thank you all for your time and effort! 


I'm trying different MC devices based on the INF's. I have an MC "stick" product with the same micro (PIC18f2455) I'm trying to emulate. I'm new to the world of INFs and Drivers, going through learning curve
 walmart one omegle


post edited by xiaoximena - 2020/06/02 06:45:29
#12
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/06/02 08:10:28 (permalink)
0
Hi Walmart One Omegle:
 
Welcome to the wonderful world of USB. 
 
Make no mistake... this is the most complex (and if I may say "convoluted") protocol I've ever seen. I built several full real-time communication systems for air traffic control systems on three continents and the US weather radar system, so I feel like I can have an opinion.
 
Learning USB from the documentation (the official USB specs) is like learning the English Language using a dictionary. It gives you all the definitions but doesn't tell you how to put it together. To make a VERY long story (3 months worth) very short:
 
Re: INF: the standard microsoft driver and the standard MC driver will work fine for COM emulation. Set VID/PID to MC's standard :(0x4d8 and 0x000a). Watch licensing. MC offers sub-licensing if you're planning on letting your product outside of your lab. Device class is 0x02 (CDC emulation), subclass 0x00 in the Device Descriptor, subclass "0x02" (Abstract Control Model - ACM) in the IF descriptor. I spent several weeks investigating the INF issue and found it irrelevant.  
 
If your goal is to get something running, I switched to the PIC18F45K50. That chip is supported by the MCC which comes with a full and working version of a USB driver for COM emulation. I wish I had know that earlier. The PIC18F25K50 chip is pin-compatible with the PIC18F2455 with minor non-relevant programming differences (PLEASE, if anyone can confirm). The PIC18F45K50 is simply the 40-pin version. All have the same USB hardware in the chip (I believe, but haven't confirmed). I haven't tried my PIC18F2455, but I suspect it will work with this code. Note that the "K" versions of the chips are cheaper and offer more support on the MCC. 
 
If your goal is to learn USB... good luck. I spent three months and got it to start making Line Control requests and and while it was able to communicate with my PC host, I never got that to work quite right before switching the K50 chip. Here's what I learned:
  • Sync bits always set to "1" immediately after a SETUP PID. The Tx side (IN PID) needs to toggle after the first transmission. I still haven't found a time where the Rx side (OUT PID) needs to be other than "1" for CDC/ACM emulation. 
  • Complete processing before responding to a SETUP request... except for setting the device address. I'll let you read about that one. 
  • PING-PONG buffer EP0 Rx (OUT PID). I got it to work without Ping-Pong buffers using a clock speed of 48Mhz, but at 24Mhz, the host responds too fast and I couldn't turn the buffer around fast enough -- and I know how to write tight code. I lost several weeks on this one. 
Tools:
  • usbView - shows the descriptor information as received by Windows nicely
  • USBDeview - uninstalls devices from Windows (Windows makes certain assumptions about devices once installed. When you're testing, these assumptions are frequently wrong. De-installing devices is a critical step for testing. 
  • Device Monitoring Studio - tracks most exchanges between Windows and device. 
I believe all these tools are available on GitHub.com. If not, just google them. 
 
Let me know if I can be of further assistance. The people on this forum have been wonderful and I'd love to give back (difficult, since I'm also a newbee). 
 
FOR THE PROs: Please correct any information as needed. 
 
The Bean
#13
The Bean
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2020/03/03 05:26:03
  • Location: 0
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/06/02 08:17:44 (permalink)
0
Walmart One Omegle:
 
An afterthought: Sending the STALL PID in response to the request for qualification descriptor is a bit tricky. Let me know if you need help with that. 
 
The Bean. 
#14
ric
Super Member
  • Total Posts : 27115
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: USB COM driver not mitigated PIC18 2020/06/02 13:11:44 (permalink)
+1 (1)
TheBean
Walmart One Omegle:
 
An afterthought: Sending the STALL PID in response to the request for qualification descriptor is a bit tricky. Let me know if you need help with that. 
 
The Bean. 


That is a spammer, just borrowing text from your post#6.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#15
Jump to:
© 2020 APG vNext Commercial Version 4.5