Page 1 of 1

Advise ? USB MSD+CDC for 2 Virt ComPort refers

Posted: Fri Sep 06, 2013 10:27 pm
by GertJL
Hi Group,
This may be a rather old topic?
However, if someone can help or assist me I will really appreciate it since I am stuck with my app.

Proc uchip 32MX795FL MPLABX 1.85 Compiler : XC32 o/s Win7

App > to connect target to pc via usb such that it will create on pc -
1x MSD device session
2x Virt Serial ComPort eg ComPort eg 4&5, (refer to numbers for this topic only)
Now, start 2x TermEmu Apps on pc, one Config for ComPort4, the other ComPort 5 (115200,8,n,1, no flow)
Sending (typing) chars/data from TermEmulAppComPort4 to display on TermEmulAppComPort5 and vice versa.
I have arrange the targer descriptor for this appliction.
(1st Interface for MSD, next 2 Intf > for ComPort4, last 2 intf for ComPort5, thus 5 Intf defined.
Modified the win7 .inf to allow 1xMSD and CDC 2x VirtPort.
On execution, Win7 creates MSD,CDC with 2 Virt ComPorts (eg 4&5) All fine.

Target Testing session -
One set of code to test MSD & only ComPort4
Next set of code config MSD & only Comport5

Resulst -
Mass Storage Device - working during both sessions.
ComPort4 - tx/rx to target working.
ComPort5 - Open TermEmul session, but can't seem to tx/rx in the Configure TermEmul session
I can't tx from target to TermEmul.
It appears if I type a few chars, fast, the TermEmul Session seems to crash.

So, my problem is that I can't seem to establish a comms Session with last Virt ComPort in the descriptor.

I have looked at my target for both the sessions, besides modifying the code to
point to diff Endp where applicable (at this time I am using the same data-buffs and related vars for
both sessions) I can't see an obvious code problem, imho, both session should work, at this level.
Which it doesn't!! :(

I am now thinking that maybe my win7 .inf / usbser.sys files need to be modified somehow
to allow actual comms on the second ComPort(5). btw, I had modify the .inf to allow Win7
to see the 2nd Virt Comport(5). Unfortunately I don't know at this time howto/where/or/if one have to
modify some config/sys file in Win7, in addition to the .inf file?

Have any of you guys here done something similar and are you prepared to share some info, pointers.

I appreciate your valuable feedback and comments, hopefully allowing me to find a solution!?

Many thanks.
Gert

Re: Advise ? USB MSD+CDC for 2 Virt ComPort refers

Posted: Tue Sep 10, 2013 4:53 am
by EmbeddedMan
Sorry Gert - this is beyond my knowledge. I've only worked with the Microchip examples in the MLA (Microchip Library for Applications) - never really modified the USB descriptors much if a all.

I have heard of problems under Windows (all versions?) with USB devices that try to be more than one thing. (like MSD + CDC)

My advice is to look on the usb implementers forum (usb.org) and see if you can glean some information on what problems others have had.

Also, try your test under Mac OS - if it works, you know the problem is a Windows one.

*Brian

Re: Advise ? USB MSD+CDC for 2 Virt ComPort refers

Posted: Tue Sep 10, 2013 9:28 am
by ttabbal
I agree, sounds like a Windows .inf problem. Unfortunately, I'm not any help either as all my work with it was done on OSX and Linux. In large part to Windows driver stupidity. They just show up on OSX and Linux, no need to change anything, if you got the code right.

For OSX, they have a nice tool to see what's plugged in. Apple Menu>About this Mac>More Info.

For Linux, try "lsusb" to see it. Also "dmesg" can help see the kernel USB messages. It's possible your descriptor is off or one of the length calculations is off. If so, Linux's kernel will complain about it so you can track it down. If it's right, you should see the kernel telling you it found the MSD and CDC ports and what /dev nodes it assigned them to. Test in there, mount the device and test I/O, then you can use screen or minicom to test the CDCs. If it's all good, you just need to figure out how to tell Windows to use them.