
DE10-Standard
User Manual
99
www.terasic.com
January 19, 2017
how to switch the I2C multiplexer for HPS to access the I2C bus.
Function Block Diagram
Figure 6-9
s
hows the function block diagram of this demonstration. The I2C bus from both FPGA
and HPS are connected to an I2C multiplexer. It is controlled by HPS_I2C_CONTROL, which is
connected to the
GPIO1
controller in HPS. The HPS I2C is connected to the
I2C0
controller in
HPS, as well as the G-sensor.
Figure 6-9 Block diagram of the I2C MUX test demonstration
HPS_I2C_CONTROL Control
HPS_I2C_CONTROL is connected to HPS_GPIO48, which is bit-19 of the
GPIO1
controller.
Once HPS gets access to the I2C bus, it can then access Audio CODEC and TV Decoder when the
HPS_I2C_CONTROL signal is set to high.
The following mask in the demo code is defined to control the direction and output value of
HPS_I2C_CONTROL.
#define HPS_I2C_CONTROL
( 0x00080000 )
The following statement is used to configure the HPS_I2C_CONTROL associated pins as output
pin.
alt_setbits_word( ( virtua
( ( uint32_t )( ALT_GPIO1_SWPORTA_DDR_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ),
HPS_I2C_CONTROL
);
The following statement is used to set HPS_I2C_CONTROL high.
alt_setbits_word( ( virtua
( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ),
HPS_I2C_CONTROL
);
The following statement is used to set HPS_I2C_CONTROL low.