TOP Contributors

  1. MIKROE (2658 codes)
  2. Alcides Ramos (355 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136934 times)
  2. FAT32 Library (70053 times)
  3. Network Ethernet Library (56013 times)
  4. USB Device Library (46328 times)
  5. Network WiFi Library (41936 times)
  6. FT800 Library (41252 times)
  7. GSM click (29043 times)
  8. mikroSDK (26447 times)
  9. PID Library (26435 times)
  10. microSD click (25391 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

I2C MUX 7 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.10

mikroSDK Library: 2.0.0.0

Category: I2C

Downloaded: 77 times

Not followed.

License: MIT license  

I2C MUX 7 Click is a compact add-on board representing a bidirectional selector dedicated to applications with I2C slave address conflicts. This board features the PI4MSD5V9547, an octal bidirectional translating multiplexer controlled by the I2C-bus from Texas Instruments. Only one SCL/SDA channel can be selected at a time, determined by the contents of the programmable control register. The board powers up with Channel 0 connected, allowing immediate communication between the Master and downstream devices on that channel.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "I2C MUX 7 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "I2C MUX 7 click" changes.

Do you want to report abuse regarding "I2C MUX 7 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


I2C MUX 7 click

I2C MUX 7 Click is a compact add-on board representing a bidirectional selector dedicated to applications with I2C slave address conflicts. This board features the PI4MSD5V9547, an octal bidirectional translating multiplexer controlled by the I2C-bus from Texas Instruments. Only one SCL/SDA channel can be selected at a time, determined by the contents of the programmable control register. The board powers up with Channel 0 connected, allowing immediate communication between the Master and downstream devices on that channel.

i2cmux7_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jan 2022.
  • Type : I2C type

Software Support

We provide a library for the I2C MUX 7 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 7 Click driver.

Standard key functions :

  • i2cmux7_cfg_setup Config Object Initialization function.

    void i2cmux7_cfg_setup ( i2cmux7_cfg_t *cfg );
  • i2cmux7_init Initialization function.

    err_t i2cmux7_init ( i2cmux7_t *ctx, i2cmux7_cfg_t *cfg );
  • i2cmux7_default_cfg Click Default Configuration function.

    err_t i2cmux7_default_cfg ( i2cmux7_t *ctx );

Example key functions :

  • i2cmux7_set_channel This function sets the desired channel active and configures its slave address.

    err_t i2cmux7_set_channel ( i2cmux7_t *ctx, uint8_t ch_sel, uint8_t ch_slave_addr );
  • i2cmux7_read_channel This function reads the currently selected channel value.

    err_t i2cmux7_read_channel ( i2cmux7_t *ctx, uint8_t *ch_sel );
  • i2cmux7_generic_read This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

    err_t i2cmux7_generic_read ( i2cmux7_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len );

Example Description

This example demonstrates the use of I2C MUX 7 click board by reading the device ID of a 6DOF IMU 11 and Compass 3 click boards connected to the channels 0 and 7 respectfully.

The demo application is composed of two sections :

Application Init

Initializes the driver and resets the device.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    i2cmux7_cfg_t i2cmux7_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    i2cmux7_cfg_setup( &i2cmux7_cfg );
    I2CMUX7_MAP_MIKROBUS( i2cmux7_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == i2cmux7_init( &i2cmux7, &i2cmux7_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    i2cmux7_reset_device ( &i2cmux7 );

    log_info( &logger, " Application Task " );
}

Application Task

Reads the device ID of the connected click boards. Channel 0 : 6DOF IMU 11 click [slave address: 0x0E; reg: 0x00; id: 0x2D], Channel 7 : Compass 3 click [slave address: 0x30; reg: 0x2F; id: 0x0C]. All data is being logged on the USB UART where you can check the device ID.

void application_task ( void )
{
    uint8_t channel, device_id;
    if ( I2CMUX7_OK == i2cmux7_set_channel ( &i2cmux7, DEVICE0_POSITION, DEVICE0_SLAVE_ADDRESS ) )
    {
        if ( I2CMUX7_OK == i2cmux7_read_channel ( &i2cmux7, &channel ) )
        {
            log_printf( &logger, " --- Channel %u --- \r\n", ( uint16_t ) ( channel & I2CMUX7_CHANNEL_NUM_MASK ) );
        }
        if ( I2CMUX7_OK == i2cmux7_generic_read ( &i2cmux7, DEVICE0_REG_ID, &device_id, 1 ) )
        {
            log_printf( &logger, " %s - Device ID: 0x%.2X \r\n\n", ( char * ) DEVICE0_NAME, ( uint16_t ) device_id );
        }
        Delay_ms ( 1000 );
    }
    if ( I2CMUX7_OK == i2cmux7_set_channel ( &i2cmux7, DEVICE1_POSITION, DEVICE1_SLAVE_ADDRESS ) )
    {
        if ( I2CMUX7_OK == i2cmux7_read_channel ( &i2cmux7, &channel ) )
        {
            log_printf( &logger, " --- Channel %u --- \r\n", ( uint16_t ) ( channel & I2CMUX7_CHANNEL_NUM_MASK ) );
        }
        if ( I2CMUX7_OK == i2cmux7_generic_read ( &i2cmux7, DEVICE1_REG_ID, &device_id, 1 ) )
        {
            log_printf( &logger, " %s - Device ID: 0x%.2X \r\n\n", ( 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.I2CMUX7

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.


ALSO FROM THIS AUTHOR

DC Motor 23 click

0

DC Motor 23 Click is a compact add-on board with a brushed DC motor driver. This board features the TB67H480FNG, a dual-channel, H-bridge, brushed DC motor driver from Toshiba Semiconductor. Fabricated with the BiCD process (DMOSFET is used for output power transistor), it covers a wide operating voltage range of 8.2V to 44V with a maximum output current capacity of 2A. It also offers many helpful features that support a robust and reliable operation, like the decay modes selection function, several protection features, and one anomaly detection indicator.

[Learn More]

Smoke click

6

Smoke click carries the MAX30105 high-sensitivity optical sensor for smoke detection. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target MCU over I2C interface with additional functionality provided by the INT pin on the mikroBUS line.

[Learn More]

RTC 11 click

0

RTC 11 Click is a compact add-on board that contains a real-time clock IC designed to maximize battery life and reduce overall battery requirements in wearable applications. This board features the AB0815, an ultra-low-power coupled with a highly sophisticated feature set the real-time clock from Abracon LLC.

[Learn More]