ATAPI CD-ROM INTERFACE

The ATA/IDE standard denotes five-volt logic levels for all means of communications except the new high-speed direct memory access (DMA) transfers. Since CD-ROMs use only programmed input/output (PIO) and not DMA, five-volt logic levels are fine. This worked well with our five-volt Atmel Atmega103 microcontroller. ATA/IDE interface is done through two cables. One is the standard four-pin power connector with two ground wires and one positive five and one positive twelve-volt power supply. I placed the drive in a external drive case that included a power supply, a fan, a power switch and a standard drive power connector that I could connect to the CD-ROM drive. The other ATA/IDE connector is a 40-pin pin connector on a ribbon cable. I took two old ATA/IDE cables with a number of connectors on them and cut off one connector from each and then very tediously spliced nearly all of the 40 wires from each cable into a number of pin connectors that I could easily connect to the Atmel development boards. One cable was customized to connect to an STK-200 board and was used for early testing. The second cable was customized to connect to an STK-300 board and was used in the final product. Both cables required several hours for construction and verification. I connected to the 16-bit bus, 8 control signals and 7 ground wires on the ATA/IDE cable. To learn more about the ATA/IDE signals please reference the standards documents at http://www.t13.org.

STA013 MP3 DECODER

The STA013 runs off of a 14.74 MHz crystal. It has three I/O buses, each with a different protocol. The 2-bit I2C serial control bus is used to initialize the STA013 and to control volume. These lines are SDA and SCL. A second 2-bit serial bus, comprising the SDI and SCKR signals, is used to transfer MP3 data to the STA013. All of these bus pins are driven exclusively by the microcontroller, with the exception of the bi-directional SDA pin. The DATA_REQ line is asserted by the STA013 to indicate that it has available space in its internal buffers to store incoming MP3 data. Unfortunately, the DATA_REQ line triggers when as few as four bytes of space are available, limiting the amount of data that can be sent between checks of DATA_REQ to four bytes. The STA013 shares a RESET line with the CD-ROM drive

The STA013 communicates with the DAC via a 4-bit I2S bus. Only one bit in this bus is data. The others are clock signals of various speeds, with the 256x oversampling clock running at speeds in excess of 10MHz. This strains the limits of the prototype board but the circuit remains functional.

The STA013 is not available in a DIP package, so the surface-mount package had to be connected through an adapter to allow us to use it in the protoboard.

CS4334 24-BIT STEREO DAC

The CS4334 connects to the STA013 over the 4-bit I2S bus described above. It is a straightforward chip to use, with only the 4 inputs, connections for VDD and GND, and outputs for the left and right channels. Like the STA013, the CS4334's surface-mount packaging requires the use of an adapter. This DAC produces CD-quality output.

LM4880 250mW STEREO AMPLIFIER

We chose to amplify our DAC output using a cheap amplifier chip. This chip biases the signal to VDD/2 and requires output capacitors to remove the DC bias. Since the output capacitor forms a high-pass filter with the speaker, and since the speaker has very little resistance, an unusually large capacitor is required to achieve decent bass response. If better bass response is desired, a better amplifier could be used. The automatic shutdown feature is disabled by connecting that pin to ground. We set up the amplifier for unit gain and used it to provide the extra current that the DAC cannot provide.

VOLTAGE REGULATORS

The STA013 runs off of a 3.3V supply. The ATmega103, the DAC, and the LM4880 all run off of 5V supplies. Also, the DAC and amplifier require a fairly clean supply voltage to prevent distortion in the analog signals. Therefore, we could not hook up these components to the 5V connections on the STK300. Instead, we used a 12V DC input with two voltage regulators to generate the 3.3V and 5V signals, respectively. Also, we added a number of larger and smaller supply capacitors to stabilize VDD, as without these capacitors VDD was noisy.

LEVEL SHIFTING

Due to the differences in operating voltages, it was necessary to consider options for level-shifting the inputs and outputs of the STA013. The connection to the DAC could be direct because 3.3V qualifies as a logic high for the DAC. Officially, 3.3V does not qualify as a logic high for the ATmega103, but we found that the ATmega103 had no problems detecting a logic high at that level, so it was possible to connect the STA013 outputs directly to the input lines of the ATmega103. To shift the voltage on the STA013 inputs from 5V to 3.3V, we rely on the built-in protection diodes of the STA013 and connect the inputs across a 4.7k resistor. We got this idea from a similar circuit on the web, for which the author guaranteed that the level-shift would be safe. For the bi-directional SDA pin, we were able to use this same scheme -- the ATmega103 could still read the 3.3V level from the STA013, and the output from the ATmega103 was reduced to an acceptable level across the connecting resisitor.