Hi all. I'm newbie in the USB field. but in the past week I studied alot!!
I'm using keil rl-USB library for making a composite device that uses Mass storage + HID. The proccessor used is AT91SAM7S256.
Till now the firmware was only an HID device but we dicided to deliver the little software needed for operation of the device within itself recently.
So...
AT91sam7s has endpoints numbered 0,1,2 and 3 and I seam to need 2 endpoints for my mass storage and 2 for HID device. I was wondering if t is possible at all or not and i investigated te net a bit. I read in sam7s datasheet that endpoint 0 and 3 are control type and they are bidirectional. 1. is it true endpoit 0 and 3 are bidirectional and 1 and 2 are not? 2. does bidirectional mean that i can config both direction as separate endpoints in my device?
I compiled and ran RL_lib's HID and Mass storage sample on my board successfully. I've also successfully changed the descriptor for making a composite mass storage + HID out of the 2 samples. but the HID sample seam to use endpoint 0 for sending and recieving data. it also kind of uses endpoint 3 for sending info to host(In direction) I was wondering that ... 3. is this sample using endpoint 0 for both recieving and sending data to the host? if so what is endpoint 3 doing here? 4. I wondered if endpoint 0 (IN + OUT)is the only requirement i should be able to remove endpoint 3 and did so. but after removing it from the descriptor the device won't get successfully installed on the host. It seamed that windows do not accept HID device descriptor with no additional endpoint(beside endpoint 0) configured. So, is it possible to have HID device that use endpoint 0 only?
> 1. is it true endpoit 0 and 3 are bidirectional and 1 and 2 are not? > 2. does bidirectional mean that i can config both direction as separate endpoints in my device?
Atmel's AT91SAM7S data sheet isn't clear on the fact that EP1/2/3 are single direction, when they are assigned to bulk/interrupt/isoc www.atmel.com/.../doc6175.pdf
I wasn't sure on this fact, until I found this definition of EPTYPE for each endpoint.
35.6.10 UDP Endpoint Control and Status Register / UDP_CSRx EPTYPE[2:0]: Endpoint Type 000 - Control 001 - Isochronous OUT 101 - Isochronous IN 010 - Bulk OUT 110 - Bulk IN 011 - Interrupt OUT 111 - Interrupt IN
As you see, just single direction (IN or OUT) is available for bulk/interrupt/isoc. EP3 is bidirectional, just when it is assigned to control transfer. When EP3 is assigned to bulk/interrupt/isoc, it's also single direction.
To distributes these endpoints to your MSC + HID composite device, - Common default endpoint (EP0) - Two endpoints (bulk IN/OUT) for MSC - One endpoint (interrupt IN) for HID (- - No endpoint for HID interrupt OUT)
HID Output reports, if any, are passed over the default endpoint. HID interrupt OUT endpoint is optional on the HID spec. > I compiled and ran RL_lib's HID and Mass storage sample on my board successfully. > I've also successfully changed the descriptor for making a composite mass storage + HID out of the 2 samples.. > 3. is this sample using endpoint 0 for both recieving and sending data to the host? if so what is endpoint 3 doing here?
Are you talking about this example? RL_v4.22a \Keil\ARM\Boards\Atmel\AT91SAM7S-EK\RL\USB\RTX_HID This is the last RL version, in which you can directly touch to the USB descriptors. OR \Keil\ARM\Boards\Atmel\AT91SAM7S-EK\RL\USB\Device\HID of current MDK
In general, HID Input / Output reports can be exchanged both over the interrupt endpoints, and over the default endpoint (Get_/Set_Report requests). The interrupt IN endpoint is used to send asynchronous (unrequested) data from the device to host. The reports over the default endpoint occurs at the timing when host actively requests exchange of report.
> So, is it possible to have HID device that use endpoint 0 only?
It can't. The interrupt IN endpoint is mandatory for HID device by the HID spec.
Tsuneo
Thanx alot Tsuneo! u cleared alot of aspects out for me.
>Atmel's AT91SAM7S data sheet isn't clear on the fact that EP1/2/3 are single direction, when they are assigned to bulk/interrupt/isoc yes! it was really annoying to extract some usefull information out of it!
I have keil 4.03 installed and i use examples without RTX_ in RL\Keil\ARM\Boards\Atmel\AT91SAM7S-EK\RL\USB\...
>To distributes these endpoints to your MSC + HID composite device, >- Common default endpoint (EP0) >- Two endpoints (bulk IN/OUT) for MSC >- One endpoint (interrupt IN) for HID >(- - No endpoint for HID interrupt OUT) > >HID Output reports, if any, are passed over the default endpoint.
i'm just worried of one fact now. My device used to have dedicated IN/Out endpoints and after this(as a composite device) it will use default endpoint as it's OUT. The HID device also pass bulky data in both direction. 1. will this affect my device's performance? 2. what if i make a read-only mass storage device like a CD-ROM? I can realese one MSC endpoint and use it for HID this way?
ty for reply again. :)
sorry for multiple posts! but i have a problem with later version of RL_lib(on keil 4.53) the MSC sample for it compiles and runs successfully but driver instalation is hell slow. the same goes to disc drive instalation and this is why i'm using the older version now. Do you know what is going wrong here?
> My device used to have dedicated IN/Out endpoints and after this(as a composite device) it will use default endpoint as it's OUT. The HID device also pass bulky data in both direction. > 1. will this affect my device's performance?
Usually, Interrupt OUT is faster than Set_Report request, when the size of the report is 64 bytes or less, - Interrupt OUT: 1 or 2 ms (USB frames) - Set_Report: 2 or 3 ms
But when the size of the report is greater than 64 bytes, Set_Report may be faster. Because the DATA stage of Set_Report may carry more than 64 bytes in single frame, whereas Interrupt OUT requires another frame.
> 2. what if i make a read-only mass storage device like a CD-ROM? I can realese one MSC endpoint and use it for HID this way?
MSC requires both bulk IN/OUT endpoints, even if it exposes CD-ROM.
> but driver instalation is hell slow. the same goes to disc drive instalation
When you are working on the same board and on the same PC, the low performance derives from the firmware difference, doesn't it?
Thanx for the help Tsuneo