Using the MAXQ2000 with the MAX4397 to Create an Inexpensive Audio/Video Source Selector
Abstract
This application note shows an application circuit and provides all the firmware required to interface the MAXQ2000 microcontroller (MAXQ20 core) to the MAX4397. The example assembly program was written and assembled specifically for the MAXQ2000 using the free MAX-IDE version 1.0 (Build Date: Nov 18 2004). Download the free MAX-IDE from Analog's website.
MAX4397 Overview
The MAX4397 is a dual, SCART, switch-matrix IC that routes audio and video signals between an MPEG encoder and two external SCART connectors for the European consumer market. Using this application note, the MAX4397 can be used as an inexpensive and simple audio/video source selector at a fraction of the cost of commercial products.
Hardware Overview
The application circuit utilizes the MAX4397EVKIT and MAXQ2000-KIT.
The MAX4397 EV kit consists of the MAX4397, all required passive components, and a proven PCB layout. The MAX4397EV kit schematic is shown in Figure 1. The MAXQ2000 is not present on the MAX4397 EV kit board; it was, however, added to the system by connecting SCL, SDA, and GND from the MAXQ2000 EV kit to the MAX4397 EV kit. In addition, +5V must be applied to VDIG (J3-1) of the MAX4397 EV kit.
Figure 1. MAX4397EV kit schematic.
The MAXQ2000 EV kit contains a complete set of software, hardware, sample code and documentation needed to start designing with MAXQ2000. Schematics for the MAXQ2000-KIT are available in the data sheet. The MAXQ2000 EV kit contains three pushbutton switches used in this application for selecting audio/video source 1 (SW5), audio/video source 2 (SW4), and reset (SW2).
Audio and Video Ground Planes
It is good practice to separate the audio and video ground planes, as shown in Figure 2. Connect both ground planes together by shorting the GNDAUD and GNDVID pads at the lower edge of the board on the top side. The digital ground should be star-connected where the audio and video grounds connect. If the J3 connector is used for connecting the I2C interface from the MAXQ2000 EV kit to the MAX4397 EV kit, then the digital ground will already be starred in the proper location, as shown in Figure 3.
Figure 2. Separating audio and video grounds.
Figure 3. Starring the digital ground.
Firmware Overview
The example assembly program shown in Listing 1 communicates to the MAX4397 by bit-banging an I2C interface on the MAXQ2000's general-purpose input/output (GPIO) ports. The MAXQ2000's 16MHz system clock allows the bit-banged I2C interface to run up to 400KHz; the firmware's default I2C clock speed is 100KHz. Table 1 shows the I²C WriteByte operations required to initialize the MAX4397 after power-up.
Once the MAX4397 is initialized, the program waits for the user to press one of the MAXQ2000 EV kit's three pushbutton switches. Press pushbutton switch SW5 to route the video source 1 (TV_Y/CVBS_IN) to the output (TV_Y/CVBS_OUT) and the audio source 1 (TV_IN_) to the output (TV_OUT_). Table 2 shows the I²C WriteByte operations that occur after SW5 is pressed. Press pushbutton switch SW4 to route the video source 2 (VCR_Y/CVBS_IN) to the output (TV_Y/CVBS_OUT) and the audio source 2 (VCR_IN_) to the output (TV_OUT_). Table 3 shows the I²C WriteByte operations that occur after SW4 is pressed. Pressing pushbutton switch SW2 resets the firmware to the power-on reset state.
Download: Listing 1
Listing 1. An assembly example program that interfaces the MAXQ2000 to the MAX4397 by implementing a bit-banged I2C interface.
Download: Source Code
I2C/SMBusBus Protocol | Device Slave Address | Register Address | 8-BitData |
WriteByte#1 |
0x96 | 0x0D | 0x04 |
10010110b | 00001101b | 00000100b | |
WriteByte#2 |
0x96 | 0x00 | 0x46 |
10010110b | 00000000b | 01000110b |
The I2C WriteByte operations initialize the MAX4397 by enabling the TV_Y/CVBS_OUT output and disabling the TV_OUT_ mute.
I2C/SMBusBus Protocol | Device Slave Address | Register Address | 8-BitData |
WriteByte#1 |
0x96 | 0x06 | 0x1B |
10010110b | 00000110b | 00011011b | |
WriteByte#2 |
0x96 | 0x01 | 0x0E |
10010110b | 00000001b | 00001110b |
The I2C WriteByte operations route the video source 1 (TV_Y/CVBS_IN) to the output (TV_Y/CVBS_OUT) and the audio source 1 (TV_IN_) to the output (TV_OUT_).
I2C/SMBusBus Protocol | Device Slave Address | Register Address | 8-BitData |
WriteByte#1 |
0x96 | 0x06 | 0x1A |
10010110b | 00000110b | 00011010b | |
WriteByte#2 |
0x96 | 0x01 | 0x0D |
10010110b | 00000001b | 00001101b |
The I2C WriteByte operations route the video source 2 (VCR_Y/CVBS_IN) to the output (TV_Y/CVBS_OUT) and the audio source 2 (VCR_IN_) to the output (TV_OUT_).
{{modalTitle}}
{{modalDescription}}
{{dropdownTitle}}
- {{defaultSelectedText}} {{#each projectNames}}
- {{name}} {{/each}} {{#if newProjectText}}
-
{{newProjectText}}
{{/if}}
{{newProjectTitle}}
{{projectNameErrorText}}