Test your Ears:    Design Specifications


Communication between PC/Laptop and Attenuator Unit.
Using the driver software for the FT chips (see the System User Manual for details) the Attenuator Unit presents itself as a device with a serial port. Generally the portnumber will be 3 or higher.
The communication parameters are: 19200 Baud, 8 bit, No parity, 1 stop bit. No hardware- or software handshaking is used and also there are no checksums or other data-integrity controls.

Between the PC/Laptop and the Attenuator Unit only two messages are exchanged.
From the PC to the Attenuator a 3-byte message is sent:

The PC takes the initiative to send this message, the attenuator returns a response message.
Byte 1: The volume setting for the left channel of the PGA2311. (tip of the stereo jack plug)
Byte 2: The volume setting for the right channel of the PGA2311. (ring of the stereo jack plug)
Byte 3:  Control byte for the Led's and some other functions:
            Bit 0:             Right Led control.
           
Bit 1:             Right Led control.
           
Bit 2:             Middle Led control.
            Bit 3:             Middle Led control.
            Bit 4:             Left Led control.
            Bit 5:             Left Led control.
            Bit 6:             0 = no effect. 1 = Reset the peakdetector.   
            See detailed description of the operation of the peakdetector below.
            Bit 7:             0 = no effect. 1 = Reset button history.
            See detailed description of the operation of the buttons below.

The control bits of the leds have the following functions:
            Bit 1/3/5 = 0   Bit 0/2/4 = 0:    Led off.
            Bit 1/3/5 = 0   Bit 0/2/4 = 1:    Led continuously on.
            Bit 1/3/5 = 1   Bit 0/2/4 = 0:    Led slow blinking.
            Bit 1/3/5 = 1   Bit 0/2/4 = 1:    Led fast blinking.
  

From the Attenuator to the PC a 2-byte return message is sent:
This message is sent directly after the receipt of the first byte of the message to the attenuator.
Byte 1:  The peakvalue of the signal on the analog input.
            See detailed description of the operation of the peakdetector below.
Byte 2:  Status byte from attenuator:
            Bit 0:  1 = Right Button is actually pressed. 0 = not pressed.
            Bit 1:  1 = Right Button has been pressed since last clearing. 0 = not pressed.
            Bit 2:  1 = Middle Button is actually pressed. 0 = not pressed.
            Bit 3:  1 = Middle Button has been pressed since last clearing. 0 = not pressed.
            Bit 4:  1 = Left Button is actually pressed. 0 = not pressed.
            Bit 5:  1 = Left Button has been pressed since last clearing. 0 = not pressed.
            Bit 6:  no meaning.
            Bit 7:  no meaning.

Operation of te peakdetector.
The peakdetector is used only during the calibration of the PC/Laptop's sound output level, using an analog input channel (A/D converter) of the microprocessor. During this procedure the Attenuator Unit is set to the Mute Mode.
The analog signal is presented to the analog input channel on a DC-level approximately half-way of the 3V3 supply voltage.
Directly after receipt of a message with byte 3, bit 6 set, "Clear Peakdetector", the stored peak values are cleared.
From then on the firmware will determine and register the maxima and minima of the input signal.
Scaling is 1 bit = 3V3 / 255, so 217 units correpond to 1 Volt RMS = 2.82 Volt peak-to-peak. 
The sampling rate for the A/D conversion is approximately 100 Hz. The PC produces a tone of 3000 Hz for 1 second, so it is very likely that there will be hits on the positive and negative peak values.
When the A/D converter output is 0 or 255, this will be interpreted as an overflow. The reported peak value will be 255, and this will persist until a command "Clear Peakdetector" is given.
Normally you won't have to deal with these details because it is covered by the automatic calibration procedure. 

Operation of the buttons.
The signals from the pushbuttons are presented to the microprocessor via lowpass filters with a time constant of approximately 1 millisecond.  A logic low (near zero volts) means that the button is pressed.
The firmware samples these inputs at a 10 msec rate. If an input is found in the same state during 4 successive samples than that state will be the state registered. 
If the state is "pressed" then also the program variable "button x has been pressed" will be set. These variables are reset by a message from the PC with bit 7 of the control byte set, "Clear Button History". 

Pin functions of the microprocessor. 
Pin 1     Not used. Not to be connected.
Pin 2     Not used. Not to be connected.
Pin 3     VDD 3.3 Volt supply voltage.
Pin 4     VSS, GND connection.
Pin 5     PTB7, Input, Button Left. Low if button is pressed.
Pin 6     PTB6, Input, Button Middle. Low if button is pressed.
Pin 7     PTB5, Input, Button Right. Low if button is pressed.
Pin 8     PTB4, Output, Led Right. High for Led on.
Pin 9     PTB3, Output, Led Middle. High for Led on.
Pin 10   PTB2, Output, Led Left. High for Led on.
Pin 11   TxD.  Transmit data to PC/Laptop.
Pin 12   RxD.  Receive data from PC/Laptop.
Pin 13   PTA3.  Serial clock for PGA 2311.
Pin 14   PTA2.  Serial data for PGA 2311.
Pin 15   PTA2.  /Chip select for PGA 2311.
Pin 16   Analog channel 0. Input for calibration of the PC/Laptop's analog sound signal output. 

Pin functions of K1,  USB connector
Pin 1     +5V power supply.  See Power budget for details
Pin 2     USB-DM       USB data signal
Pin 3     USB-DP        USB data signal
Pin 4     GND
Case     GND

Note Pin3, USB-DP is pulled high by the RSTOUT signal from the FT232 chip. That is to identify the device as a USB version 2 device.  

Pin functions of K2,  RJ45 connector.
The colors are for a standard straight-through CAT-5 cable. 
Pin 1     + 5V Power              orange/white
Pin 2     Led-Left                    orange
Pin 3     Led-Middle                green/white
Pin 4     Led-Right                  blue
Pin 5     Button-Left                blue/white
Pin 6     Button-Middle            green
Pin 7     Button-Right              brown/white
Pin 8     GND                         brown

The Led's must be connected with the anode on +5V and the cathode on the cable.
The Pushbuttons must be connected between GND and the cable.

Pin functions of K3 and K4, 3mm stereo jack receptacles.
K3: Audio signal from PC/Laptop
K4: Audio signal to Headphones or stereo amplifier.

Tip: Left signal.
Ring: Right signal.
GND: GND

Power Budget (all values in mA):

Load

Spec / Calculated

Measured on Prototype

Remark

FT232chip

25

t.b.d.

 

EEPROM

1

t.b.d.

 

Microprocessor

5

t.b.d.

 

PGA2311 V+

10

t.b.d.

 

PGA2311 V-

12

t.b.d.

 

ICL7660 / MAX660

1

t.b.d.

inverter losses

Headphones full pwr

5

t.b.d.

 

Power Led

5

t.b.d.

 

Communication Led

5

t.b.d.

 

Indicator Leds

3 x 5 = 15

t.b.d.

 

Total

84

 50 - 60  mA  varying  with (quite loud) sound level