Communicating With Vm-Usb; General Structure Of Out Packets - Wiener VM-USB User Manual

Hide thumbs Also See for VM-USB:
Table of Contents

Advertisement

4

COMMUNICATING WITH VM-USB

Communication with the VM-USB consists of writing and reading data buffers to/from the
USB2 port of the VM-USB using bulk-transfer mode. Borrowing from the USB language,
the buffers to be written to the VM-USB will be called Out Packets, and they are sent to pipe
0 of the USB port. The buffers to be read will be called In Packets, and they are read from
pipe 2 of the USB port.
The USB controller IC, when connected to a USB2 port configures packet lengths to 512
bytes. For USB1 (full speed), the packet length is set to 64 bytes. The Out Packets must be
properly formatted to be understood by the internal devices of VM-USB and, by the same
token, the format of the In Packets retrieved from the VM-USB must be understood by the
user in order to be useful.
User may send Out Packets to four devices – the Register Block (RB), VME Readout Stacks
(VDS and VSS), and the VME Generator (VGen). User may read In Packets only from the
Common Output Buffer. Reading back data from the RB, VDS, and VSS is achieved by, first
sending a data request Out Packet to these devices and then by reading the In Packet
containing the requested data from the Common Output Buffer.
Writing to the VME Generator constitutes implicitly a request for data, such that in response
to such a writing, VM-USB performs the requested VME operation (including the ones
addressed to internal registers of VM-USB) and returns the VME data in the Common
Output Buffer. Both, In and Out Packets are of a variable length, depending on which
internal address is involved and what the content of the message is.
Important Note:
With some drivers (EZUSB in conjunction with Windows API), read operations from the
USB port are blocking operations, such that the host program will stop executing until the
data are available at the port. Therefore, the host program must make sure (by first requesting
data) that VM-USB has placed data in the Common Output Buffer (physically this is the
FIFO of the USB controller IC), before the read command is issued. VM-USB provides a
mechanism for supplying data, even when the host program is "frozen" in a state of waiting
for data. The mechanism consists in starting a second copy of the program and issuing a bare
request for data command from this second copy, not followed by the read IN Packet
command.
The libxxusb package of VM-USB access functions makes overlapped USB calls that have
preset timeout periods. When no data is available until the end of this period, the I/O is
canceled and the respective function returns error code. The user is then expected to take
proper actions, which may include resubmitting the call.
It is important to specify a sufficiently long In Packet size to be at least of the size of the
actual data buffer available at the Common Output Buffer. This is especially important in the
case of reading VME data buffers which differ in size substantially depending on the
structure of the VME Readout Stack.

4.1 General structure of Out Packets

Since internally, the USB controller of the VM-USB is set up as a 16-bit wide FIFO (First-
In-First-Out Memory), the In and Out Packets are organized as collections of 16-bit words.
WIENER, Plein & Baus GmbH
24
www.wiener-d.com

Advertisement

Table of Contents
loading

Related Products for Wiener VM-USB

Table of Contents