Component: I2C Multiplexer (TCA9548A) (Comms: System)

From Flowcode Help
Revision as of 19:47, 16 November 2021 by Wiki bot (talk | contribs)
Jump to navigationJump to search
Author MatrixTSL
Version 1.0
Category Comms: System


I2C Multiplexer (TCA9548A) component

An I2C multiplexing IC allowing up to 8 different I2C busses to be connected to a single I2C channel on your target microcontroller.

Detailed description

No detailed description exists yet for this component

Examples

Here we have a simple example showing how to use the multiplexer to connect multiple of the same I2C sensor IC to the microcontroller.

The multiplexer IC is connected directly to the microcontroller I2C pins and up to 8 temp/humidity sensors are connected to the CH0-CH7 I2C pins of the multiplexer.


FC6 Icon.png I2C Multiplex Example

Downloadable macro reference

Fc9-comp-macro.png SelectChannel
Selects a single output channel to multiplex the I2C output to (0-7). 
Fc9-u8-icon.png - BYTE Channel
Range: 0-7 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetChannelMask
Allows a user determined number of channels to be connected to the I2C bus. 
Fc9-u8-icon.png - BYTE Mask
Range: 0-255 / Bit0=CH0 EN / Bit1 = CH1 EN etc 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Startup the I2C bus ready for communications. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Transaction_Read
Attempt to read Length number of bytes from the I2C slave to the given Buffer. Ensure that the Buffer is large enough. Returns number of bytes read, caller should check that this matches requested Length 
Fc9-u8-icon.png - BYTE Buffer
Buffer to store the incoming byte data 
Fc9-u16-icon.png - UINT Length
Number of bytes to read 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png Start
Outputs a start condition onto the I²C bus. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Transaction_Initialise
Initialise the I2C interface to communicate with a Slave device at Address Returns 0 on fail, 1 on success 
Fc9-u8-icon.png - BYTE Address
7-bit I2C Address without the shift for the R/W bit 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Initialise
Enables the I²C hardware and performs some initialization. Should be called at the start of the program or at least before any of the other I²C functions are called. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Initialise the sensor configuration as set by the component properties. Sets the default intigration time and gain as well as enable the sensor. 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Address Bits
 
Fc9-type-7-icon.png Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Fc9-type-16-icon.png Baud Select
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
Baud rate to be used 
Fc9-type-7-icon.png Scope Traces
Selects if the component pin connections are automatically generated on the data recorder window or not. Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. No: Do not show the pin signals on the data recorder window. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-16-icon.png Injector
Specifies the injector component on the panel to interact with to provide comms simulation. 
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
Channel selection 
Fc9-type-5-icon.png SDA
Pin used for SDA (data signal) 
Fc9-type-5-icon.png SCL
Pin used for SCL (clock signal) 
Fc9-conn-icon.png Simulations
Fc9-type-7-icon.png Simulate Comms