
USB Audio Design Guide 18/61
3.6.4.2 USB Rate Control
The Audio core must consume data from USB and provide data to USB at the correct
rate for the selected sample frequency. The USB 2.0 Specification states that the
maximum variation on USB packets can be +/- 1 sample per USB frame. USB frames
are sent at 8kHz, so on average for 48kHz each packet contains six samples per
channel. The device uses Asynchronous mode, so the audio clock may drift and run
faster or slower than the host. Hence, if the audio clock is slightly fast, the device
may occasionally input/output seven samples rather than six. Alternatively, it may
be slightly slow and input/output five samples rather than six. Figure 9 shows the
allowed number of samples per packet for each example audio frequency.
See USB Device Class Definition for Audio Data Formats v2.0 section 2.3.1.1 for
full details.
Frequency (kHz) Min Packet Max Packet
44.1 5 6
48 5 7
88.2 10 11
96 11 13
176.4 20 21
192 23 25
Figure 9:
Allowed
samples per
packet
To implement this control, the decoupler core uses the feedback value calculated
in the buffering core. This value is used to work out the size of the next packet it
will insert into the audio FIFO.
3.7 Device Firmware Upgrade (DFU)
The DFU interface handles updates to the boot image of the device. The interface
links USB to the XMOS flash user library (see XM-000953-PC). In Application mode
the DFU can accept commands to reset the device into DFU mode. There are two
ways to do this:
·
The host can send a
DETACH
request and then reset the device. If the device is
reset by the host within a specified timeout, it will start in DFU mode (this is
initially set to one second and is configurable from the host).
·
The host can send a custom user request
XMOS_DFU_RESETDEVICE
to the DFU
interface that resets the device immediately into DFU mode.
Once the device is in DFU mode. The DFU interface can accept commands defined
by the DFU 1.1 class specification
10
. In addition the interface accepts the custom
command
XMOS_DFU_REVERTFACTORY
which reverts the active boot image to the
factory image. Note that the XMOS specific command request identifiers are
defined in dfu_types.h within module_dfu.
10
http://www.usb.org/developers/devclass_docs/DFU_1.1.pdf*USB
REV 6.1
Comentários a estes Manuais