USB Bulk transfers, General questions

Hello,

I am implementing bulk transfer on the 1161 USB chip. This is the first time I'm doing low level programming (USB device)so please be gentle :)

I have a few questions about the concept of USB bulk transfer. I read the documentation supplied by Philips but I cannot fully understand some parts.

What is the difference if I assign the Bulk In and Bulk Out on different endpoints? How is this typically done?

When I handle Bulk In Interrupt, assuming the payload I have to send to the host is greated than the full speed limit, 64 Bytes, what is the correct way to send the data out? Do I write into the FIFO buffer many times in 1 ISR or spread them out in different ISRs?

Thank you for reading!

Reply to
prune
Loading thread data ...

Each pipe (bulk in/bulk out pair) would be connected to a different task or thread. They could be same or different apps.

Queue them up and send when ready.

Reply to
linnix

"prune" wrote in news:1173763555.894640.310430 @j27g2000cwj.googlegroups.com:

This depends on your hardware. The usb spec allows 16 IN addresses and

16 OUT addresses. Endpoint 0 is special, so take away 1 IN and 1 OUT for this bi-directional endpoint.

usb spec v1.1 says:

5.7.3 Interrupt Transfer Packet Size Constraints An endpoint for an interrupt pipe specifies the maximum size data payload that it will transmit or receive. The maximum allowable interrupt data payload size is 64 bytes or less for full-speed. Low-speed devices are limited to eight bytes or less maximum data payload size.

Interrupt endpoints are periodic and guaranteed bandwidth. This means you cannot take more than allocated at enumeration, so a fixed max size transfer. However the data in an interrupt transfer is unformatted, so you can put whatever you choose in multiple records. So if your device says it should be polled for interrupts every 4 frames, you can send at most maxpacketsize each polling interval. But you can specify more than maxpacketsize data by sending in multiple intervals.

Most people with more than maxpacketsize data chunks will send it via bulk transfer - it simplifies stuff on both your device and in your host driver.

You also seem to be confused about USB transfers. It looks like you are talking about a device/gadget/function/slave rather than a host/master. If that is correct, you do not ever "send" data, you load up the endpoint and the host comes and gets it whenever it feels like it. You device descriptors make some requests to the host as to transfer type and interval and sizes, but it is up to the host to initiate any transfers. If the device is not ready with the FIFO/endpoint enabled - the device endpoint hardware will NAK the host and tell it to try again later.

Regards, Steve

Reply to
Steve Calfee

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.