A quickie on USB Endpoints


            

Endpoints are essentially the USB addresses that USB data is sent to or from. Now, here is the trick. The transfer direction naming convention is a bit unintuitive.

Contrary to — at least — what I imagined, an IN Endpoint will transfer USB data from the USB device to the host PC, while an OUT Endpoint will transfer USB data from the host PC to the USB device. Basically this means that the data transfer direction naming convention is relative to the host and not to the device.

Another USB rule is that an IN endpoint has an odd address while an OUT uses an even address.

The number of endpoints is largely defined by the device class chosen. A user may add additional endpoints, but this would then start to move the overall design to require dedicated drivers on the host. All designs will include a control endpoint for configuration and control. This will be typically endpoint 0 (zero). The transfer mode will be largely defined by the device class selected also. See this in FTDI documentation:

  • A device that uses isochronous transfers has no error checking, but will send regular sized chunks at regular intervals. Applications such as audio may be suited to this.
  • A device that uses interrupt transfers will be receiving data at unspecified intervals, such as Human Interface Devices (HID). This may include mouse and keyboard interfaces.
  • The third main transfer type is bulk mode transfer. This is used for transferring large blocks of data and includes error checking.

We’ll get back on this. Definitely.

XCode 5 LLDB Debug Assertions

One situation when a debugger might not be the first option is when you are not sure where does a program has a bug. One way you can check whether your assumptions are truly what is happening in your code is by using assertions. What assertions let you do is express one particular assumption and […]

SCPI on Mac

Some more days passed and some more finishing touches added to my MacSCPI app. It is entirely dependent on hooking the device via the USBTMC driver, but it works fine and is stable: I had some problems with buffer padding and the output it is still not 100% gibberish–free , but I assume I have to play with […]

Leave a Reply

Your email address will not be published. Required fields are marked *