USBee DX Toolbuilder Source Code Library
The USBee DX Test Pod System consists of the USBee DX
Test Pod connected to a Windows® 2000, XP or Vista PC High Speed USB 2.0 port through
the USB cable, and to your circuit using the multicolored test leads and clips.
Once connected and installed, the USBee can then be controlled using either the
USBee DX Windows Software or your own USBee DX Toolbuilder software.
The USBee DX system is also expandable by simply
adding more USBee DX pods for more channels and combined features.
The USBee DX Test Pod is ideal for students or
designers that need to get up and running with High Speed USB
immediately. With a mini-B USB connector on one end and signal pin
headers on the other, this simple pod will instantly USB 2.0 High-Speed enable
your design. Then using the source code libraries, drivers and DLL's that
are included here you can write your own PC application to control and monitor
the signal pins on the pod.
The USBee DX has headers that are the interface to
your circuits. The signals on these
headers represent a 16 bit data bus, a Read/Write#/TRG signal (T) and a clock
line (C). Using the libraries and source
code provided you can do reads and writes to these signals. The USBee DX acts as the master, driving the
T and C signals to your circuit.
There are six modes of data transfers that you can
use depending on your system needs.
·
Voltmeter Mode
·
Signal Capture
·
Digital Signal Generator
·
Bi-Directional “bit-bang” mode
·
Uni-Directional High Speed mode
Voltmeter
Mode
The simplest of the analog functions is the DVM
(Digital Voltmeter) routine called GetAllSignals. It simply samples all of the signals on the
USBee DX pod and measures the voltage on both analog channels. This measurement is taken over a second an
the average is returned.
The routine GetAllSignals () samples the specified
channel and returns the measurement.
Signal
Capture
The USBee DX has the ability to capture samples
from the 16 digital signals and two analog channels at the same time. Each analog sample is time synchronized with
the corresponding digital samples.
In signal capture modes, there is a single capture
buffer where each sample is a long value made up of 4 bytes. The low order 2 bytes represent the 16
digital channels. Digital Signal 0 is
bit 0 of each long value. The Analog
samples are the high two bytes where each byte is an 8-bit ADC value taken
during that sample period for that channel.
The samples range from 0 (at -10.0V) to 255 (at +10.0V). Each count of the ADC equates to 78.125mV,
which is the lowest resolution possible on the USBee DX without averaging.
The maximum sample rate that is possible in Signal
Capture mode is 24Msps. This value can
depend on your PC system and available processing speed and how many byte lanes
are sampling data. The basic rule of
thumb is that the maximum bandwidth through USB 2.0 is near
24Mbytes/second. Therefore to capture 2
bytelanes (16 digital channels for example) would equate to a maximum sample
rate of 12Msps.
The method for performing a single data capture, or
sampling, using the Signal Capture routines is as follows:
·
Allocate the sample buffers (MakeBuffer() )
·
Start the capture running (StartCapture(…))
·
Monitor the capture in progress to determine if
it is triggered, filling, or completed. (CaptureStatus()).
·
End the capture when it is finished.
(StopCapture())
·
Process the sample data that is now contained in
the sample buffers.
Once the data is captured into a buffer, you can call the Bus
Decoder routines to extract the data from these busses.
Digital
Signal Generator
The USBee DX has the ability to generate (output)
samples from 8 or 16 digital signals at up to 24Msps or 12Msps in Signal
Generator mode.
In this mode, there is a single buffer that stores
the samples to generate. Each sample is
a long value made up of 4 bytes. The low
order 2 bytes represent the 16 digital channels. Digital Signal 0 is bit 0 of each long value.
The high two bytes are not used. These samples can then be generated on
command.
The maximum sample rate that is possible Signal
Generator mode is 24Msps. This value can
depend on your PC system and available processing speed and how many byte lanes
are generating data. The basic rule of
thumb is that the maximum bandwidth through USB 2.0 is near
24Mbytes/second. Therefore to generate 2
bytelanes (16 digital channels for example) would equate to a maximum sample
rate of 12Msps.
The method for generating a single output pattern
using the Signal Generator routines is as follows:
·
Allocate the sample buffer (MakeBuffer())
·
Fill the sample buffer with the pattern data you
want to generate.
·
Start the generation running (StartGenerate (…))
·
Monitor the generation in progress to determine
if it is triggered, filling, or completed. (GenerateStatus()).
·
Terminate the generation. (StopGenerate())
The USBee DX can not generate analog output
voltages using this mode. Variable
analog outputs are possible using the PWM Controller and an external RC
circuit.
Bi-Directional
and Uni-Directional Modes
These two modes allow bit-level data transfers to
and from the USBee DX pod. The first
offers complete flexibility of the 8 digital signal lines, while the other
gives you very high transfer rates.
In the Bi-Directional Mode, each of the 16 data
signals can be independently setup as inputs or outputs. When sending data to the pod, only the lines
that are specified as outputs will be driven.
When reading data from the pod, all 16 signals lines will return the
actual value on the signal (whether it is an input or an output)
In the High-Speed Mode, all of the 16 data signal
lines are setup in the same direction (as inputs or outputs) at the same time. When sending data to the pod, all signals
become outputs. When reading data from
the pod, all signals become inputs.
Also in High Speed mode, you can specify the CLK
rate. Available CLK rates are 24MHz,
12MHz, 6MHz, 3MHz, and 1MHz. For slower
rates you can use the bi-directional mode
In each of the modes you can specify the polarity
of the CLK line. You can set the CLK
line to change data on the falling edge and sample on the rising edge, or visa
versa.
The routines used to read and write the data to the
pod are the same for both modes. You
call the SetMode function to specify the mode you want to use. All subsequent calls for data transfers will
then use that mode of transfer.
The following table shows the possible transfer
rates for the various modes. This
assumes that your USB 2.0 host controller can achieve these rates. USB 2.0 Host controllers can vary greatly.
|
Mode
|
Transfer Type
|
Burst Rate
|
Sustained Average
Rate
|
|
Bi-Directional
|
Write-SetSignals
|
300k Bytes/sec
|
~300k
Bytes/sec
|
|
Bi-Directional
|
Read-GetSignals
|
175k Bytes/sec
|
~175k
Bytes/sec
|
|
High-Speed
|
Write-SetSignals
|
24M Bytes/sec
|
~20M
Bytes/sec
|
|
High-Speed
|
Read-GetSignals
|
16M Bytes/sec
|
~13M
Bytes/sec
|
|