Hear-it! Solution Kit
R12UZ0012EG0110 Rev. 1.10
Page 24 of 34
Apr 03, 2017
6. Description of Software
The choice between USB audio playback and streaming from line-in or MIC input is achieved through conditional
compilation of the application software project. Refer to section 5.3 for details of the conditional compilation
required to change operating modes.
6.1
USB Playback Sample
6.1.1
Operation
After reset, the sample waits for a USB mass storage device to be connected to the USB connector CN9. Once
this occurs, the user is first presented with a list of available .wav files in the ‘Music’ folder. The user can choose
an audio file from the list by using the potentiometer and pressing SW3 to select. Once the file has been selected,
file playback is paused so that the user can adjust the volume to a suitable level, using the pot R43 (as the pot
has just been used to select the file, the volume may start at a surprising level). Pressing switch SW3 starts
playback of the file, and SW3 can then be used to pause or resume during the file playback. The pot R43 can
be used to control the volume of the speaker (and headphones if fitted). Visual indication of status, volume and
progress are shown on the display.
6.1.2
PCM Data Transfer
The transfer of PCM data from the .wav file on the USB drive to the audio CODEC is managed by a receive
buffer for data pulled from the USB drive and a corresponding transmit buffer to send data to the CODEC via
the SSI interface. The Renesas TFAT FIT module is used to transfer data from the USB to the receive buffer.
Internally, data is transferred from receive buffer to transmit buffer by a memcpy function. The 16-bit PCM data
in the transmit buffer is sent to the CODEC via the SSI interface by the DMAC microcontroller peripheral,
matching the sampling frequency of the wav files at 48kHz.
In order to achieve seamless playback each buffer is divided into 3 sub-blocks. The data being transferred into
a buffer is always being placed into a different sub-block to the data being transferred out of the buffer to the
next stage. The changeover process for updating the active read/write blocks is managed in the DMAC0 end of
transfer interrupt, which is the slowest part of the chain from USB to CODEC. In this way, the CODEC has a
continuous supply of data.
Figure 6-1 shows this transfer graphically. Table 6-1 shows the operations in progress at each step.
Figure 6-1 : USB Playback Mode Buffer Processing Overview
Step
USB operation
memcpy operation
DMAC0 operation
1
data read into rx buffer (c)
rx buffer (b) to tx buffer (b)
tx buffer (a) to CODEC
2
data read into rx buffer (a)
rx buffer (c) to tx buffer (c)
tx buffer (b) to CODEC
3
data read into rx buffer (b)
rx buffer (a) to tx buffer (a)
tx buffer (c) to CODEC
Table 6-1 : USB Playback Mode Buffer Operations
Tx Buffer
Rx Buffer
(a)
(b)
(c)
(a)
(b)
(c)
USB
CODEC
memcpy
DMAC0 (SSI)
2
3
1
2
3
1
1
2
3
Caution:
Headphones should be connected to the 3.5mm line-out connector CN5. Connector CN6 is designed to
connect to a speaker only. It is not recommended to attach headphones to speaker connection CN6, as
damage to the headphones may occur. Refer to section 4.2.6 for further information.
Summary of Contents for RX231
Page 34: ...RX231 Group R12UZ0012EG0110 ...