Skip to Content
Block descriptionsI2CI2C Transmit & Receive

I2C Transmit and Receive Block Description

This block supports the I2C peripheral interface in Transmit and Receive mode. It is used to directly transmit and immediately receive a data stream from the microcontroller (acting as Master) to a peripheral device (Slave). This block combines the functionalities of both the I2C Transmit and I2C Receive blocks.



I2C Transmit and Receive block

Table of Contents

Inputs

Input NameTypeDescription
TX Data[ ]uint8[ ]Data to be transmitted via the I2C interface. The size of the input depends on the value of the Transmit size parameter.

Outputs

Output NameTypeDescription
Statusuint8Transmission status. Returns:
1 transmission successful
0 transmission failed
RX data[ ]uint8[ ]Data received via the I2C interface. The size of the output depends on the value of the Receive size parameter.

Block Parameters

ParameterDescription
I2C NumberI2C module number (for a single MCU I2C, this should be set to 0)
Slave addressAddress of the slave device
ModeBlock operating mode
Transmit sizeSize of the data to be transmitted. Determines the amount of data read from the TX Data input.
Receive sizeSize of the data to be received. Determines the amount of data read from the RX Data output.
TimeoutHow long the system will wait for the block execution
Sample time [s]Function refresh rate


Block parameters for I2C

CubeMX Configuration for a Given MCU

The configuration for the interface can be found on the subpage CubeMX Configuration for a Given MCU.

See Also

Last updated on