I2C MUX 3 Click-Platine
I2C MUX 3 Click-Platine
Overview
Das I2C MUX 3 Click Board™ ist eine kompakte Zusatzplatine, die acht bidirektionale Übersetzungsschalter enthält, die für Anwendungen mit I2C-Slave-Adresskonflikten vorgesehen sind. Diese Platine verfügt über den TCA9548APWR, einen Niederspannungs-8-Kanal-I2C-Busschalter mit einem Active-Low-Reset-Eingang von Texas Instruments. Es verfügt über drei programmierbare Adressstifte, die bis zu acht TCA9548APWR-Geräte ermöglichen, unterstützt Hot Insertion, hat einen niedrigen Standby-Strom und keine Störungen beim Einschalten, wenn alle Schaltkanäle abgewählt sind. Dieses Click Board™ eignet sich für die Arbeit mit I2C-Schnittstellen für Anwendungen wie Fehlerisolierung, Adresskonflikte, Pegelübersetzung oder Broadcast-Kommunikation (Server, Router usw.).
Das I2C MUX 3 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 3 Click Board™ Work?
The I2C MUX 3 Click Board™ is based on the TCA9548APWR, a low voltage eight bidirectional translating switches with an active-low reset input controlled through the I2C serial interface from Texas Instruments. The master SCL/SDA signal pair is directed to eight channels of slave devices, SC0/SD0-SC7/SD7, where any individual downstream channel can be selected as well as any combination of the eight channels. It features I2C control using a single 8-bit control register in which each bit controls the enabling and disabling of one of the corresponding 8 switch channels for I2C data flow.
The I2C MUX 3 Click Board™ includes a low dropout linear regulator AP7331 from Diodes Incorporated to provide the 2.45V supply voltage for the TCA9548APWR. When the TCA9548APWR is turned on for the first time or anytime the device needs to be reset by cycling the power supply, which means that the Power-On reset requirements must be followed to ensure the I2C bus logic is initialized properly. Additionally, if communication on the I2C bus enters a fault state, the TCA9548APWR can be reset to resume normal operation using the RST pin feature or by a Power-On reset which results from cycling power to the device.
The I2C MUX 3 Click Board™ communicates with MCU using the standard I2C 2-Wire interface that supports Standard-Mode (100 kHz) and Fast-Mode (400 kHz) operation. The TCA9548APWR has a 7-bit slave address with the first five MSBs fixed to 1110. The address pins A0, A1 and A2 are programmed by the user and determines the value of the last three LSBs of the slave address which can be selected by onboard SMD jumpers labelled as ADDR SEL allowing selection of the slave address LSBs. It also has an active-low reset signal routed on the RST pin of the mikroBUS™ socket used to recover from a bus-fault condition. When this signal is asserted low the TCA9548APWR resets its registers alongside with I2C state machine and deselects all channels.
The I2C MUX 3 Click Board™ is designed to be operated with both 3.3V and 5V logic voltage levels that can be selected via VCC SEL jumper. This allows for both 3.3V and 5V capable MCUs to use the I2C communication lines properly. More information about the TCA9548APWR can be found in the attached datasheet. However, the Click board™ comes equipped with a library that contains easy to use functions and a usage example that may be used as a reference for further development.
SPECIFICATIONS
Type | I2C |
Applications | Can be used with I2C interfaces for applications such as fault isolation, address conflict, level translation, or broadcast communication (servers, routers...). |
On-board modules | The I2C MUX 3 Click Board™ is based on the TCA9548APWR, a low voltage eight bidirectional translating switches with an active-low reset input controlled through the I2C serial interface from Texas Instruments. |
Key Features | 1-to-8 bidirectional translating switches, low Stand-By current, support hot insertion, deselected channels during Power-Up, and more. |
Interface | I2C |
Compatibility | mikroBUS |
Click board size | L (57.15 x 25.4 mm) |
Input Voltage | 3.3V or 5V |
PINOUT DIAGRAM
This table shows how the pinout of the I2C MUX 3 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 | RST | 2 | RST | INT | 15 | NC | |
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-JP4 | ADDR SEL | Left | Communication interface selection: Left position 0, Right position 1 |
J1-J8 | - | - | Output I2C Channel Pins |
I2C MUX 3 CLICK ELECTRICAL SPECIFICATIONS
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | -0.5 | - | 7 | V |
Maximum Output Current | -25 | - | - | mA |
Maximum Frequency | - | - | 400 | kHz |
Operating Temperature Range | -40 | - | +125 | °C |
Software Support
We provide a library for the I2C MUX 3 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 that enables the usage of the I2C MUX 3 Click Board™. User can set one of 8 channels by writing to devices control register and check it by reading, or use the function to set it directly. User can also use sequential read and write function to comunicate with the devices sonnected to the selected channel.
Key Functions
uint8_t n_bytes );
- Function is used to write a sequential data starting from the targeted 8-bit register address of the device connected to the desired channel of the I2C MUX 4 Click Board™ board.uint8_t n_bytes )
- Function is used to read a sequential data starting from the targeted 8-bit register address of the device connected to the desired channel of the I2C MUX 4 Click Board™ board.void i2cmux3_ch_sel ( uint8_t sel_ch );
- Function is used to select communication channel.
Example Description
The application is composed of three sections :
- System Initialization - Initializes I2C module, LOG structure and sets RST pin as output.
- Application Initialization - Initalizes I2C driver, preforms hardware reset and makes an initial log.
- Application Task - This example shows the capabilities of the I2C MUX 3 Click Board™ by reading device ID values from eight different Click Board™ boards and displaying the readings via USART terminal. Some of the used Click Board™ boards have the same I2C slave addresses, while others do not.
- Application Note - Click boards used in this example : 6DOF IMU 12 Click Board™ - https://www.mikroe.com/6dof-imu-12-click RTC 10 Click Board™ - https://www.mikroe.com/rtc-10-click Surface Temp Click Board™ - https://www.mikroe.com/surface-temp-click Spectrometer Click Board™ - https://www.mikroe.com/spectrometer-click Compass 3 Click Board™ - https://www.mikroe.com/compass-3-click Color 3 Click Board™ - https://www.mikroe.com/color-3-click 6DOF IMU 11 Click Board™ - https://www.mikroe.com/6dof-imu-11-click Heart Rate 4 Click Board™ - https://www.mikroe.com/heart-rate-4-click
void application_task ( ) { mikrobus_logWrite( "-------------------------", _LOG_LINE ); mikrobus_logWrite( "ID values by click board:", _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); i2cmux3_ch_sel( 0 ); i2cmux3_rd_slv ( 0x68, 0x00, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " 6DOF IMU 12 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 1 ); i2cmux3_rd_slv ( 0x68, 0x0F, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " RTC 10 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 2 ); i2cmux3_rd_slv ( 0x48, 0x0B, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Surface Temp : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 3 ); i2cmux3_rd_slv ( 0x39, 0x92, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Spectrometer : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 4 ); i2cmux3_rd_slv ( 0x30, 0x2F, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Compass 3 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 5 ); i2cmux3_rd_slv ( 0x29, 0x12, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Color 3 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 6 ); i2cmux3_rd_slv ( 0x0E, 0x00, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " 6DOF IMU 11 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 7 ); i2cmux3_rd_slv ( 0x57, 0xFF, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Heart Rate 4 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); mikrobus_logWrite( "", _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 3000 ); }
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 3 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 3 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 that enables the usage of the I2C MUX 3 Click Board™. User can set one of 8 channels by writing to devices control register and check it by reading, or use the function to set it directly. User can also use sequential read and write function to comunicate with the devices sonnected to the selected channel.
Key Functions
uint8_t n_bytes );
- Function is used to write a sequential data starting from the targeted 8-bit register address of the device connected to the desired channel of the I2C MUX 4 Click Board™ board.uint8_t n_bytes )
- Function is used to read a sequential data starting from the targeted 8-bit register address of the device connected to the desired channel of the I2C MUX 4 Click Board™ board.void i2cmux3_ch_sel ( uint8_t sel_ch );
- Function is used to select communication channel.
Example Description
The application is composed of three sections :
- System Initialization - Initializes I2C module, LOG structure and sets RST pin as output.
- Application Initialization - Initalizes I2C driver, preforms hardware reset and makes an initial log.
- Application Task - This example shows the capabilities of the I2C MUX 3 Click Board™ by reading device ID values from eight different Click Board™ boards and displaying the readings via USART terminal. Some of the used Click Board™ boards have the same I2C slave addresses, while others do not.
- Application Note - Click boards used in this example : 6DOF IMU 12 Click Board™ - https://www.mikroe.com/6dof-imu-12-click RTC 10 Click Board™ - https://www.mikroe.com/rtc-10-click Surface Temp Click Board™ - https://www.mikroe.com/surface-temp-click Spectrometer Click Board™ - https://www.mikroe.com/spectrometer-click Compass 3 Click Board™ - https://www.mikroe.com/compass-3-click Color 3 Click Board™ - https://www.mikroe.com/color-3-click 6DOF IMU 11 Click Board™ - https://www.mikroe.com/6dof-imu-11-click Heart Rate 4 Click Board™ - https://www.mikroe.com/heart-rate-4-click
void application_task ( ) { mikrobus_logWrite( "-------------------------", _LOG_LINE ); mikrobus_logWrite( "ID values by click board:", _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); i2cmux3_ch_sel( 0 ); i2cmux3_rd_slv ( 0x68, 0x00, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " 6DOF IMU 12 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 1 ); i2cmux3_rd_slv ( 0x68, 0x0F, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " RTC 10 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 2 ); i2cmux3_rd_slv ( 0x48, 0x0B, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Surface Temp : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 3 ); i2cmux3_rd_slv ( 0x39, 0x92, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Spectrometer : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 4 ); i2cmux3_rd_slv ( 0x30, 0x2F, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Compass 3 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 5 ); i2cmux3_rd_slv ( 0x29, 0x12, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Color 3 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 6 ); i2cmux3_rd_slv ( 0x0E, 0x00, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " 6DOF IMU 11 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); i2cmux3_ch_sel( 7 ); i2cmux3_rd_slv ( 0x57, 0xFF, &id_val, 1 ); ByteToHex( id_val, log_txt ); Ltrim( log_txt ); mikrobus_logWrite( " Heart Rate 4 : 0x", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 100 ); mikrobus_logWrite( "", _LOG_LINE ); mikrobus_logWrite( "-------------------------", _LOG_LINE ); Delay_ms( 3000 ); }
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 3 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.
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.