How does it work?
I2C MUX 6 Click as its foundation uses the PCA9518, an expandable four-channel bidirectional buffer controllable through the I2C serial interface from Texas Instruments. The primary SCL/SDA signal pair is directed to four channels where only one SCL/SDA channel can be selected at a time, determined on the state of the four Enable pins, routed to the AN, RST, CS, and PWM pins of the mikroBUS™ socket. The PCA9518 overcomes the restriction of maximum bus capacitance by separating and buffering the I2C data (SDA) and clock (SCL) lines into multiple groups of 400pF I2C channels.
The PCA9518 has several multi-directional open-drain buffers designed to support the standard low-level-contention arbitration of the I2C bus. Except during arbitration, the PCA9518 acts like a pair of non-inverting open-drain buffers, one for SDA and one for SCL. It can communicate with other PCA9518 hubs through a 4-wire inter-hub expansion bus, located on the onboard header with EXP labeled pins, i.e., permits extension of the I2C-bus by buffering both the data (SDA) and the clock (SCL) lines enabling virtually an unlimited number of buses of 400pF.
The PCA9518 communicates with MCU using the standard I2C interface that supports Standard-Mode (100 kHz) and Fast-Mode (400 kHz) operation. As mentioned before, each Enable pin, ENx, controls its associated SDAx and SCLx channels. When the ENx pin is in a low logic state, it isolates its corresponding SDAx and SCLx lines from the system by blocking the inputs from SDAx and SCLx and disabling the output drivers on these lines. It is essential that the ENx change state only when both the global bus and the local port are in an IDLE state to prevent system failures.
This Click board™ is designed for 3.3V operation. It also has onboard terminals labeled as VCC-I2C to supply a voltage, 3.3V or 5V, for PCA9518’s I2C lines, which are 5V-tolerant. However, the board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. The Click board™ comes equipped with a library containing functions and an example code that can be used, as a reference, for further development.
Specifications
Type
I2C
Applications
Can be used for various applications from industrial to medical, communications, and automotive systems
On-board modules
PCA9518 – four-channel bidirectional buffer controllable through the I2C serial interface from Texas Instruments
Key Features
Low power consumption, fast I2C interface, 5V tolerant I2C and enable pins to support mixed-mode signal operation, powered-off high-impedance I2C pins, expansion bus, and more
Interface
I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on I2C MUX 6 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 |
J1 | – | Populated | I2C Expansion Header |
I2C MUX 6 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
I2C Bus Voltage Range VCC-I2C | 3.3 | – | 5 | V |
Operating Temperature Range | -40 | +25 | +85 | °C |
Software Support
We provide a library for the I2C MUX 6 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for I2C MUX 6 Click driver.
Key functions
-
i2cmux6_set_channel
This function sets the desired channel active and configures its slave address. -
i2cmux6_generic_write
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface. -
i2cmux6_generic_read
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
Example Description
This example demonstrates the use of I2C MUX 6 Click board™ by reading the device ID of a 6DOF IMU 11 and Compass 3 Click boards™ connected to the channels 1 and 4 respectfully.
void application_task ( void )
{
uint8_t device_id;
if ( I2CMUX6_OK == i2cmux6_set_channel ( &i2cmux6, DEVICE0_POSITION, DEVICE0_SLAVE_ADDRESS ) )
{
log_printf( &logger, "rn Active Channel: - " );
for ( uint8_t cnt = 0; cnt < 4; cnt++ )
{
if ( ( DEVICE0_POSITION ) & ( 1 << cnt ) )
{
log_printf( &logger, "%u - ", ( uint16_t ) ( cnt + 1 ) );
}
}
if ( I2CMUX6_OK == i2cmux6_generic_read ( &i2cmux6, DEVICE0_REG_ID, &device_id, 1 ) )
{
log_printf( &logger, "rn %s - Device ID: 0x%.2Xrn", ( char * ) DEVICE0_NAME, ( uint16_t ) device_id );
}
Delay_ms( 1000 );
}
if ( I2CMUX6_OK == i2cmux6_set_channel ( &i2cmux6, DEVICE1_POSITION, DEVICE1_SLAVE_ADDRESS ) )
{
log_printf( &logger, "rn Active Channel: - " );
for ( uint8_t cnt = 0; cnt < 4; cnt++ )
{
if ( ( DEVICE1_POSITION ) & ( 1 << cnt ) )
{
log_printf( &logger, "%u - ", ( uint16_t ) ( cnt + 1 ) );
}
}
if ( I2CMUX6_OK == i2cmux6_generic_read ( &i2cmux6, DEVICE1_REG_ID, &device_id, 1 ) )
{
log_printf( &logger, "rn %s - Device ID: 0x%.2Xrn", ( char * ) DEVICE1_NAME, ( uint16_t ) device_id );
}
Delay_ms( 1000 );
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.I2CMUX6
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. UART terminal is available in all MikroElektronika compilers.
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.