Searching \ for '[PIC]: 18F USB device code' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=18F
Search entire site for: '18F USB device code'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 18F USB device code'
2006\03\07@085326 by andrew kelley

picon face
Hi all,

I'm curious as to if anyone has usb code that would enumerate as two
different devices at the same time or at different times.  Yes, the
bootloader and my code enumerate at different times, but they are
loaded separately from each other.  I'm wondering as to how I would
disconnect one driver and connect a different one.  I'm leafing
through the documents to see what would be relevant, but I haven't
made a breakthrough yet.  If no one has any examples, I'll post mine
when I'm finished with it, but an example makes it easier to do.  BTW
I'm using mchip's framework in c18.

--
andrew

2006\03\07@093634 by Mat Clayton

picon face
Hey,
Don't think it will be of much use if at all, but there is a mention on the
microchip forums how to do mouse and keyboard HID's at the same time,
(http://forum.microchip.com/tm.aspx?m=116779). Im trying to pull together
lots of usb example coding and articles at the moment for a new website I
just setup (http://www.piccoder.co.uk), would you be interested in writing an
article on it when your done, if so just register/login and click submit
content.

Mat

--------------------------------------------
http://www.piccoder.co.uk
Where PIC coders can share code and ideas.


{Original Message removed}

2006\03\07@094004 by Alan B. Pearce

face picon face
>I'm curious as to if anyone has usb code that would
>enumerate as two different devices at the same time
>or at different times.

I haven't tried to do any USB coding, but I seem to remember that at least
one of the app notes with examples for the 16C745 has multiple enumeration
examples - keyboard/mouse and joystick IIRC.

2006\03\07@095240 by andrew kelley

picon face
On 3/7/06, Mat Clayton <spam_OUTmsc41TakeThisOuTspamcam.ac.uk> wrote:
> Hey,
> Don't think it will be of much use if at all, but there is a mention on the
> microchip forums how to do mouse and keyboard HID's at the same time,
> (http://forum.microchip.com/tm.aspx?m=116779). Im trying to pull together
> lots of usb example coding and articles at the moment for a new website I
> just setup (http://www.piccoder.co.uk), would you be interested in writing an
> article on it when your done, if so just register/login and click submit
> content.

Thats kinda what I was looking for but not quite(well, actually its
exactly what I was first trying to do, but not now), its a good step
towards where I'm trying to go..

> Mat


--
andrew

2006\03\07@100955 by Mat Clayton

picon face
Im doing quite a bit of usb stuff at the moment, you trying to use HID/CDC
or the microchip one? Mat

{Original Message removed}

2006\03\07@125132 by andrew kelley

picon face
On 3/7/06, Mat Clayton <.....msc41KILLspamspam@spam@cam.ac.uk> wrote:
> Im doing quite a bit of usb stuff at the moment, you trying to use HID/CDC
> or the microchip one? Mat

I have the HID code (from Mchip) working for the mouse. I'm using a
joystick as input for the mouse coordinates.  That works.  I'm trying
to add a CDC (I'll derive from MChip code most likely) class, where I
can send the raw a/d values to the PC so I can calibrate the
joystick..  Make any sense?  It'd have a switch to change modes.

--
andrew

2006\03\07@185628 by Will

flavicon
face
> Hi all,
>
> I'm curious as to if anyone has usb code that would enumerate as two
> different devices at the same time or at different times.  Yes, the
> bootloader and my code enumerate at different times, but they are
> loaded separately from each other.  I'm wondering as to how I would
> disconnect one driver and connect a different one.  I'm leafing
> through the documents to see what would be relevant, but I haven't
> made a breakthrough yet.  If no one has any examples, I'll post mine
> when I'm finished with it, but an example makes it easier to do.  BTW
> I'm using mchip's framework in c18.

Hi,
I am also interested in your question, can you please explain the concept
of a device enumerating as two usb devices. I know that when I connect
a usb mouse I actually get 2 devices in the device manager, one will be
hid device, the other will be hid compliant mouse, is this what you are
referring too, and how does this happen?

2006\03\07@191724 by andrew kelley

picon face
> Hi,
> I am also interested in your question, can you please explain the concept
> of a device enumerating as two usb devices. I know that when I connect
> a usb mouse I actually get 2 devices in the device manager, one will be
> hid device, the other will be hid compliant mouse, is this what you are
> referring too, and how does this happen?

OK, perhaps my question was not specfic enough, but what you're
referring to is how windows handles devices.  You get two devices
because windows loads a driver for HID interface and another for the
HID mouse.  What I was wondering was if I could enumerate the PIC as a
CDC device and a HID mouse at the same time. Or if there were examples
where if a switch/flag was on/off it would enumerate as one or the
other.  Or if there were any examples where it enumerated as a
keyboard and mouse. (which is possible, and has been done, and the
code is on the mchip forum, look back in the thread some hours). I
still have not reached a conclusion as to whether I could enumerate it
as a HID and CDC device.
--
andrew

2006\03\08@093624 by Xiaofan Chen

face picon face
On 3/8/06, andrew kelley <leetslackerspamKILLspamgmail.com> wrote:
>
> OK, perhaps my question was not specfic enough, but what you're
> referring to is how windows handles devices.  You get two devices
> because windows loads a driver for HID interface and another for the
> HID mouse.  What I was wondering was if I could enumerate the PIC as a
> CDC device and a HID mouse at the same time. Or if there were examples
> where if a switch/flag was on/off it would enumerate as one or the
> other.  Or if there were any examples where it enumerated as a
> keyboard and mouse. (which is possible, and has been done, and the
> code is on the mchip forum, look back in the thread some hours).

HID device will always be enumerated as two device under Windows.
I have collected many PIC USB related websites in the following
Microchip thread and I think it might be useful to those who are
interested in USB.
http://forum.microchip.com/tm.aspx?m=123533.

> I still have not reached a conclusion as to whether I could enumerate it
> as a HID and CDC device.

As far as I know, this is not possible. HID seems to be a bit special so that
a device can not be enumerated as an HID and a CDC device at the same
time.

Regards,
Xiaofan

2006\03\08@093838 by Xiaofan Chen

face picon face
On 3/8/06, andrew kelley <.....leetslackerKILLspamspam.....gmail.com> wrote:
>
> I have the HID code (from Mchip) working for the mouse. I'm using a
> joystick as input for the mouse coordinates.  That works.  I'm trying
> to add a CDC (I'll derive from MChip code most likely) class, where I
> can send the raw a/d values to the PC so I can calibrate the
> joystick..  Make any sense?  It'd have a switch to change modes.
>

You do not need to use CDC for that. HID is very capable of doing
the things you want. You can add vendor requests to HID.

Regards,
Xiaofan

2006\03\08@095114 by Chris Emerson

flavicon
face
On Wed, Mar 08, 2006 at 10:36:23PM +0800, Xiaofan Chen wrote:
> On 3/8/06, andrew kelley <EraseMEleetslackerspam_OUTspamTakeThisOuTgmail.com> wrote:
> > I still have not reached a conclusion as to whether I could enumerate it
> > as a HID and CDC device.
>
> As far as I know, this is not possible. HID seems to be a bit special so that
> a device can not be enumerated as an HID and a CDC device at the same
> time.

I don't know about the PIC's USB controller specifically, but it is
possible in USB general (a composite device).  The device would have two
interface descriptors (one for HID, one for CDC, for example), each with
the relevant endpoint etc.  descriptors.  Each interface will be treated
as a different device by Windows (or other OS).

Chris

2006\03\08@181824 by andrew kelley

picon face
> HID device will always be enumerated as two device under Windows.

Yes, this I understood.  I've noticed it, and it makes sense.

<about sending raw values back to PC>
> You do not need to use CDC for that. HID is very capable of doing
> the things you want. You can add vendor requests to HID.

Yes, but are there any examples using vendor requests? (PC and PIC side)
As far as enumerating as two different classes of devices, it should
be possible separately, if not at the same time (IIRC some devices,
not PIC based, do this, so why can't it be done in a PIC?).

> Regards,
> Xiaofan

--
andrew

2006\03\09@034740 by Alan B. Pearce

face picon face
>As far as enumerating as two different classes of
>devices, it should be possible separately, if not
>at the same time (IIRC some devices, not PIC based,
>do this, so why can't it be done in a PIC?).

Is this portion not actually handled by the PC side driver? i.e. the driver
for the specific PID/VID knows that the hardware device "out there" has two
functions, and provides suitable entry points for each?

2006\03\09@073912 by Will

flavicon
face
> >As far as enumerating as two different classes of
> >devices, it should be possible separately, if not
> >at the same time (IIRC some devices, not PIC based,
> >do this, so why can't it be done in a PIC?).
>
> Is this portion not actually handled by the PC side driver? i.e. the
driver
> for the specific PID/VID knows that the hardware device "out there" has
two
> functions, and provides suitable entry points for each?

The pc system creates if I understand correctly one device for
every inteface descriptor in your active configuration, or one
device per hid descriptor (I am not sure which). In the case
of a usb (hid) mouse, I think one device is  created for the
interface descriptor, and another for the hid descriptor, and this is why
there are 2 new devices in the device manager when you plug
in a usb mouse. This is my guess, maybe someone who knows
will confirm or correct this guess...

2006\03\09@081336 by andrew kelley

picon face
On 3/9/06, Will <kerri1111111spamspam_OUTbtinternet.com> wrote:
> > >As far as enumerating as two different classes of
> > >devices, it should be possible separately, if not
> > >at the same time (IIRC some devices, not PIC based,
> > >do this, so why can't it be done in a PIC?).

> The pc system creates if I understand correctly one device for
> every inteface descriptor in your active configuration, or one
> device per hid descriptor (I am not sure which). In the case
> of a usb (hid) mouse, I think one device is  created for the
> interface descriptor, and another for the hid descriptor, and this is why
> there are 2 new devices in the device manager when you plug
> in a usb mouse. This is my guess, maybe someone who knows
> will confirm or correct this guess...

That is correct, but its not the question I'm asking.  One device(in
DM) is for the HID interface descriptor, and another is for the
specific HID protocol descriptor

Nobody seems to know if I can put code in the PIC to be an HID device
AND a CDC device at the same time.

--
andrew

2006\03\09@114856 by Will

flavicon
face
> > > >As far as enumerating as two different classes of
> > > >devices, it should be possible separately, if not
> > > >at the same time (IIRC some devices, not PIC based,
> > > >do this, so why can't it be done in a PIC?).
>
> > The pc system creates if I understand correctly one device for
> > every inteface descriptor in your active configuration, or one
> > device per hid descriptor (I am not sure which). In the case
> > of a usb (hid) mouse, I think one device is  created for the
> > interface descriptor, and another for the hid descriptor, and this is
why
{Quote hidden}

Since you are confirming my thoughts, and if this is indeed correct,
then the answer to your question immediately follows, namely,
you need one interface desc. for your hid, and another one for
CDC. Makes sense?

Will

2006\03\09@161035 by andrew kelley

picon face
> > Nobody seems to know if I can put code in the PIC to be an HID device
> > AND a CDC device at the same time.
>
> Since you are confirming my thoughts, and if this is indeed correct,
> then the answer to your question immediately follows, namely,
> you need one interface desc. for your hid, and another one for
> CDC. Makes sense?

Yes, it makes sense but I don't know that it can in fact be done.  I
think it can, so I'll give it a try tomorrow.

> Will

--
andrew

2006\03\10@181344 by Robert Ammerman

picon face
How it enumerates will depend on the descriptors that you send to the system
at 'startup' or 'restart'.

When a USB device is plugged in the host detects its presence due to a pull
up resistor on one of the data lines. The host then interrogates the device
to determine what it is.

All you have to do is:

(1) make the host think the device is disconnected,
(2) then reconnect it, and
(3) finally pass the host a different set of descriptors.

Steps 1 and 2 are easier to do in some USB implementations than others.

Bob Ammerman
RAm Systems


More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...