This design example shows the capability of Altera® MAX® II, MAX V and MAX 10 devices to
implement a Secure Digital (SD) or Secure Digital Input Output (SDIO)
device multiplexer. The SD or SDIO has the capability to multiplex two or more SD/SDIO devices to an
SD/SDIO host equipped with a single SD interface. This document also
illustrates how the select line of this multiplexer can be controlled
through an I2C interface.
The supported Altera devices are an excellent choice
to implement SD/SDIO device multiplexers. The supported devices’ low power,
high I/O pin count, and ability to tolerate any possible power-on
sequence on their core and I/O banks make them an ideal choice in this
It may often be required for an SD host controller with a single SD
interface to support more than one SD device. The SD protocol and
standards recommend doing this using one of following two methods:
Use a bidirectional multiplexer between the SD host and the multiple
SD devices and use this multiplexer to multiplex the data lines. This is
performed while the clock line is connected to each of the multiple SD
Retain the data lines connected to the
multiple SD devices while multiplexing the unidirectional clock line.
This design example uses the second method described above.
Figure 1. Implementing a Clock-Based SD MUX
I2C Select Line Multiplexer Using MAX II Devices
The detailed description of the implementation is based on the MAX II devices. This application can also be implemented in
MAX V and MAX 10 devices.
The “MUX” in Figure 1 represents a unidirectional multiplexer
that is implemented using a MAX II device. The select line for the
multiplexer is controlled through an I2C interface, which is also
implemented in the same device. The multiplexer is thus an I2C slave, and
the clock line from the host controller is either connected to the
SD Device A or the SD Device B, depending on the I2C data received.
Figure 2. I2C Select Line MUX Implementation in a MAX II Device
The I2C interface implementation in the MAX II device (I2C slave) has a 7-bit
address and follows the general I2C protocol. The start signal is sent by
the master, followed by the 7-bit address and an R/W bit. When the
address broadcast on the I2C bus matches with the slave device’s address,
an ACK (acknowledge) signal is sent by the device. This is followed by a
DATA byte, as per the select line selection that is required by the master.
This is then followed by another ACK signal by the slave. The end of a
session of data transaction is when the Stop (P) signal is sent by the
Table 1. I2C Interface Pin Description
I2C Serial Data
Figure 3. I2C Signal Format
This design example can be implemented with the EPM240G or EPM240
device or any other MAX II device. It is demonstrated in an I2C bus
environment. Implementation involves using this design example source
code and allocating I2C bus lines, the SD host controller clock line, the
eject line, and the clock lines for the SD Device A and SD Device B. An
LED indicator that is used to indicate the current selection is connected to
an output port assigned to display the select line status. This SD
multiplexer is demonstrated on the MDN-B2 demo board and with the
help of an I2C simulator. The simulator is created using a PC parallel port
and interfacing hardware to create an I2C-compliant two-wire bus. The
MDN-B2 features two SD sockets to accommodate two SD devices (to be
multiplexed) and an SD card-shaped PCB adapter that fits into a standard
SD socket of an SD host.
The utility program, which uses the parallel port, and its hardware
interface with the MAX II-based multiplexer and provide the SDA and
SCL connections as required on an I2C two-wire system. When
implemented, this design allows the I2C master (or the control panel of
the Maxim utility) to control the select line of the MAX II-based
multiplexer on the MDN-B2. The following table lists the EPM240G pin assignments for this
Table 2. EPM240G Pin Assignments for Design Example Using the MDN-B2 Demo Board. Assign unused pins As input-tristated in the Quartus® II software. You
must also enable the Auto Open-Drain setting on the SCLK and SDA pins.
To do this, on the Assignments menu, click Settings and then select
Analysis and Synthesis Settings to enable the Auto Open-Drain setting.
These settings are followed by a compilation cycle.
To demonstrate this design on the MDN-B2 demo board, perform the
Turn on the power to the demo board (using slide switch SW1).
Download the design onto the MAX II device through the JTAG
header JP5 on the demo board and a conventional programming
cable (ByteBlaster™ II or USB-Blaster™).
Keep SW4 on the demo board pressed before and during the start of
the programming process.
Once completed, turn off the power and
remove the JTAG connector.
Setting up a Parallel Port Driven I2C Environment on PC
To set up a parallel port driven I2C environment on your PC, perform the
Download a software utility, such as the Maxim parallel port utility,
to communicate with the slave in the I2C defined protocol. Install
the parallel port software. (The ParDS2W.exe program is used in
You must install a parallel port driver to enable access to the parallel
port in Windows XP or Windows 2000 for this parallel port utility.
After installation, you must configure the Direct-IO program. Open
the Windows control panel and click the Direct IO icon.
Begin and End addresses of your parallel port (normally, this is 378
through 37F; however, confirm your PC’s parallel port address by
looking at the settings in Control Panel/System/Hardware/Device
Manager/Ports/ECP Printer Port (LPT)/Resources.
Configure the parallel port to ECP by changing the BIOS settings
when you start your PC.
Next, select the Security tab of the Direct IO control panel and
browse to the directory path of the ParDS2W.exe program.
Open and then click Add to add the program. The path of this
utility is shown in the Allowed Processes field. Click OK.
Attach the parallel port I2C dongle that is supplied along with the
MDN-B2 demo board. Use an extension cord, if necessary, to extend
the parallel port connection closer to your demo board.
Attach the 4-pin socket on the pigtail of the I2C parallel port dongle
to the I2C header (JP3) of the demo board so that the red mark on the
socket meets pin 1 on the JP3 header.
Open the ParDS2W program, select the appropriate parallel port
address of your PC (as seen when configuring Direct IO) and set the
2-Wire Device Address to 00h.
Finally, you can test the I2C setup on the Test Circuit tab to see if
you have a Test PASS message in the Status window. If you do, the
I2C environment is set.