I2C MUX 2 Click Board
I2C MUX 2 Click Board
The I2C MUX 2 Click Board™ is a quad bidirectional translating I2C and SMBus switch with reset and interrupt functions, intended for applications with I2C slave address conflicts. It features a quad bidirectional translating switch controlled via the I2C bus, labelled as TCA9545A from Texas Instruments. Four interrupt inputs (INT3–INT0), one for each of the downstream pairs, are provided on the click board. One interrupt (INT) output acts as an AND of the four interrupt inputs. Click has two address jumpers, allowing up to four TCA9545A devices on the same bus. The I2C MUX 2 Click Board™ allows voltage translation between 1.8V, 2.5V, 3.3V, and 5V buses, and also supports hot insertion. The TCA9546A can work on a 0 - 400 kHz clock frequency range and is ideal for communication with numerous devices that share the identical slave address on the same bus.
The I2C MUX 2 Click Board™ is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click Board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.
Software Support
We provide a library for the I2C MUX 2 Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library covers all the necessary functions to control the I2C MUX 2 Click Board™ board.
Key Functions
void i2cmux2_hw_reset ( void )
- Hardware reset functionvoid i2cmux2_set_channel ( uint8_t channel, uint8_t ch_slave_address )
- Set channel function.uint8_t i2cmux2_read_interrupt ( void )
- Read interrupt status function.
Example Description
The application is composed of three sections :
- System Initialization - Initializes I2C, set RST pin as output and start to write log.
- Application Initialization - Initialization driver enables - I2C, executes call hardware reset, also write log.
- Application Task - (code snippet) This is an example that demonstrates the use of the I2C MUX 2 Click Board™. In this example, we read "Who am I" ( or "State" ) register of the connected Click Board™ boards to the I2C MUX 2 Click Board™. Channel 0 : 6DOF IMU 11 Click Board™ [slave address: 0x0E; reg: 0x00; id val.: 0x2D], Channel 1 : Altintude Click Board™ [slave address: 0x60; reg: 0x0C; id val.: 0xC4], Channel 2 : 6DOF IMU 9 Click Board™ [slave address: 0x69; reg: 0x75; id val.: 0xA9], Channel 3 : RTC 10 Click Board™ [slave address: 0x68; reg: 0x0F; st val.: 0x88]. All data logs write on USB UART changes every 2 sec.
void application_task ( ) { mikrobus_logWrite( " CH | ID | INT " ,_LOG_LINE ); mikrobus_logWrite( "----------------------", _LOG_LINE ); // SET CHANNEL 0: 6DOF IMU 11 Click Board™ i2cmux2_set_channel( I2CMUX2_CMD_SET_CH_0, 0x0E ); Delay_ms( 100 ); i2cmux2_generic_read( 0x00, &rx_data, 1 ); mikrobus_logWrite( " 0 | 0x", _LOG_TEXT ); display_log( I2CMUX2_CMD_SET_CH_0 ); // SET CHANNEL 1: Altitude Click Board™ i2cmux2_set_channel( I2CMUX2_CMD_SET_CH_1, 0x60 ); Delay_ms( 100 ); i2cmux2_generic_read( 0x0C, &rx_data, 1 ); mikrobus_logWrite( " 1 | 0x", _LOG_TEXT ); display_log( I2CMUX2_CMD_SET_CH_1 ); // SET CHANNEL 2: 6DOF IMU 9 Click Board™ i2cmux2_set_channel( I2CMUX2_CMD_SET_CH_2, 0x69 ); Delay_ms( 100 ); i2cmux2_generic_read( 0x75, &rx_data, 1 ); mikrobus_logWrite( " 2 | 0x", _LOG_TEXT ); display_log( I2CMUX2_CMD_SET_CH_2 ); // SET CHANNEL 3: RTC 10 Click Board™ i2cmux2_set_channel( I2CMUX2_CMD_SET_CH_3, 0x68 ); Delay_ms( 100 ); i2cmux2_generic_read( 0x0F, &rx_data, 1 ); mikrobus_logWrite( " 3 | 0x", _LOG_TEXT ); display_log( I2CMUX2_CMD_SET_CH_3 ); mikrobus_logWrite( "----------------------", _LOG_LINE ); Delay_ms( 2000 ); }
Additional Functions :
void display_log ( uint8_t sel_ch )
- Display data logs.
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- I2C
- UART
- Conversions
Additional Notes and Information
Depending on the development board you are using, you may need USB UART Click Board™, USB UART 2 Click Board™ or RS232 Click Board™ to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
MIKROSDK
The I2C MUX 2 Click Board™ is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
I2C MUX 2 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.