I2C MUX 2 Click-Platine
I2C MUX 2 Click-Platine
Das I2C MUX 2 Click Board™ ist ein vierfacher bidirektionaler I2C- und SMBus-Umsetzer mit Reset- und Interrupt-Funktionen, der für Anwendungen mit I2C-Slave-Adresskonflikten vorgesehen ist. Es verfügt über einen vierfachen bidirektionalen Umsetzer, der über den I2C-Bus gesteuert wird und als TCA9545A von Texas Instruments bezeichnet wird. Auf dem Click Board sind vier Interrupt-Eingänge (INT3–INT0) vorgesehen, einer für jedes der nachgeschalteten Paare. Ein Interrupt-Ausgang (INT) fungiert als UND der vier Interrupt-Eingänge. Click verfügt über zwei Adressbrücken, sodass bis zu vier TCA9545A-Geräte auf demselben Bus verwendet werden können. Das I2C MUX 2 Click Board™ ermöglicht die Spannungsumsetzung zwischen 1,8-V-, 2,5-V-, 3,3-V- und 5-V-Bussen und unterstützt auch Hot Insertion. Das TCA9546A kann in einem Taktfrequenzbereich von 0 bis 400 kHz arbeiten und ist ideal für die Kommunikation mit zahlreichen Geräten, die die gleiche Slave-Adresse auf demselben Bus verwenden.
Das I2C MUX 2 Click Board™ wird von einer mikroSDK-kompatiblen Bibliothek unterstützt, die Funktionen enthält, die die Softwareentwicklung vereinfachen. Dieses Click Board™ wird als vollständig getestetes Produkt geliefert und ist bereit für den Einsatz auf einem System, das mit der mikroBUS™-Buchse ausgestattet ist.
How Does The I2C MUX 2 Click Board™ Work?
The I2C MUX 2 Click Board™ uses the TCA9545A, a 4-channel, bidirectional translating I2C switch. The master SCL/SDA signal pair is directed to four channels of slave devices, SC0/SD0-SC3/SD3. Any individual downstream channel can be selected as well as any combination of the four channels. The TCA9545A also supports interrupt signals in order for the master to detect an interrupt on the INT output terminal that can result from any of the slave devices connected to the INT3-INT0 input terminals. The device offers an active-low RESET input which resets the state machine and allows the TCA9545A to recover should one of the downstream I2C buses get stuck in a low state. The state machine of the device can also be reset by cycling the power supply, VCC, also known as a power-on reset (POR). Both the RESET function and a POR will cause all channels to be deselected.
The connections of the I2C data path are controlled by the same I2C master device that is switched to communicate with multiple I2C slaves. The I2C slave address can be configured by soldering SMD jumpers labelled as ADDR SEL to set the least significant bit (LSB). After the successful acknowledgment of the slave address, a single 8-bit control register is written to or read from to determine the selected channels and state of the interrupts. The TCA9545A may also be used for voltage translation, allowing the use of different bus voltages on each SCn/SDn pair such that 1.8-V, 2.5-V, or 3.3-V parts can communicate with 5-V parts. This is achieved by using external pull-up resistors to pull the bus up to the desired voltage for the master and each slave channel.
One or several SCn/SDn downstream pairs, or channels, are selected by the contents of the control register. After the TCA9545A has been addressed, the control register is written. The four LSBs of the control byte are used to determine which channel or channels are to be selected. When a channel is selected, it becomes active after a stop condition has been placed on the I2C bus. This ensures that all SCn/SDn lines are in a high state when the channel is made active so that no false conditions are generated at the time of connection. A stop condition must occur always right after the acknowledge cycle.
The TCA9545A provides four interrupt inputs (one for each channel) and one open-drain interrupt output. When an interrupt is generated by any device, it is detected by the TCA9545A and the interrupt output is driven low. The channel does not need to be active for the detection of the interrupt. A bit also is set in the control register. Bits 4–7 of the control register correspond to channels 0–3 of the TCA9545A, respectively. Therefore, if an interrupt is generated by any device connected to channel 1, the state of the interrupt inputs is loaded into the control register when a read is accomplished. Likewise, an interrupt on any device connected to channel 0 would cause bit 4 of the control register to be set on the read. The master then can address the TCA9545A and read the contents of the control register to determine which channel contains the device generating the interrupt. The master then can reconfigure the TCA9545A to select this channel and locate the device generating the interrupt and clear it. It should be noted that more than one device can provide an interrupt on a channel, so it is up to the master to ensure that all devices on a channel are interrogated for an interrupt. The interrupt inputs can be used as general-purpose inputs if the interrupt function is not required. If unused, interrupt input(s) must be connected to VCC.
The I2C MUX 2 Click Board™ can be supplied and interfaced with both 3.3V and 5V without the need for any external components. The onboard SMD jumper labelled as VCC SEL allows voltage selection for interfacing with both 3.3V and 5V microcontrollers.
SPECIFICATIONS
Type | I2C |
Applications | Servers, Routers (telecom switching equipment), Factory automation, Products with I2C slave address conflicts (multiple, identical temp sensors) |
On-board modules | The I2C MUX 2 Click Board™ uses the TCA9545A IC, a quad bidirectional translating switch, from Texas Instruments |
Key Features | The 1-of-4 Bidirectional translating switches, Allows voltage-level translation between 1.8-V, 2.5-V, 3.3-V, and 5-V buses |
Interface | I2C |
Compatibility | mikroBUS |
Click board size | L (57.15 x 25.4 mm) |
Input Voltage | 3.3V,5V |
PINOUT DIAGRAM
This table shows how the pinout of the I2C MUX 2 Click Board™ corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes | Pin | Pin | Notes | ||||
---|---|---|---|---|---|---|---|
NC | 1 | AN | PWM | 16 | NC | ||
Reset | RTS | 2 | RST | INT | 15 | INT | Interrupt |
NC | 3 | CS | RX | 14 | NC | ||
NC | 4 | SCK | TX | 13 | NC | ||
NC | 5 | MISO | SCL | 12 | SCL | I2C Clock | |
NC | 6 | MOSI | SDA | 11 | SDA | I2C Data | |
Power Supply | 3.3V | 7 | 3.3V | 5V | 10 | 5V | Power Supply |
Ground | GND | 8 | GND | GND | 9 | GND | Ground |
ONBOARD SETTINGS AND INDICATORS
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | - | Power LED Indicator |
JP1 | VCC SEL | Left | Power Supply Voltage Selection 3V3/5V, left position 3v3, right position 5v |
JP2-3 | ADDR SEL | Right | Slave address LSB selection: left position 1, right position 0 |
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.
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-Platine
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.