How does it work?
I2C MUX 3 Click 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.
This 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.
I2C MUX 3 Click 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 labeled 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.
This 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
I2C MUX 3 Click 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
Feature
No ClickID
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 on I2C MUX 3 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
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 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.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.void i2cmux3_ch_sel ( uint8_t sel_ch );
– Function is used to select communication channel.
Examples 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 by reading device ID values from eight different click boards and displaying the readings via USART terminal. Some of the used click boards have the same I2C slave addresses, while others do not.
- Application Note – Click boards used in this example : 6DOF IMU 12 click – https://www.mikroe.com/6dof-imu-12-click RTC 10 click – https://www.mikroe.com/rtc-10-click Surface Temp click – https://www.mikroe.com/surface-temp-click Spectrometer click – https://www.mikroe.com/spectrometer-click Compass 3 click – https://www.mikroe.com/compass-3-click Color 3 click – https://www.mikroe.com/color-3-click 6DOF IMU 11 click – https://www.mikroe.com/6dof-imu-11-click Heart Rate 4 click – 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 informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click 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
This 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.
For more information about mikroSDK, visit the official page.