Main Content

Connectivity Peripherals

R2026b
Connect to connectivity peripherals such as CAN, FDCAN, I2C, MQTT, SPI, UART/USART, TCP

Create Simulink® models with the connectivity peripherals such as CAN, FDCAN, I2C, SPI, UART/USART, TCP and more available with STM32™ Microcontroller Blockset. Configure the Simulink model to interface with supported target hardware using model configuration parameters. Configure the Simulink model to interface with supported target hardware using model configuration parameters.

Support for STM32 processor based boards with Simulink uses STM32CubeMX graphical tool. STM32CubeMX tool is a graphical interface that you can use to configure peripherals of STM32 processors and generate peripheral initialization code for the STM32 processors that you select. You can configure the STM32 processor based boards to use the STM32CubeMX project with Simulink to generate code and deploy the code to the hardware.

Blocks

expand all

CAN ReadCAN ReadRead message from CAN network (Since R2023a)
CAN WriteCAN WriteWrite data to the CAN Bus (Since R2023a)
FDCAN Read blockFDCAN ReadRead data from CAN FD Bus (Since R2023a)
FDCAN Write blockFDCAN WriteWrite data to the FDCAN Bus (Since R2023a)
I2C Controller Read blockI2C Controller ReadRead data from I2C peripheral device or I2C peripheral device register (Since R2022a)
I2C Controller Write blockI2C Controller WriteWrite data to I2C peripheral device or I2C peripheral device register (Since R2022a)
SPI ReceiveSPI ReceiveReceive data through Serial Peripheral Interface (SPI) on target (Since R2023a)
SPI TransmitSPI TransmitTransmit data through Serial Peripheral Interface (SPI) on target (Since R2023a)
SPI Controller TransferSPI Controller TransferWrite data to and read data from SPI peripheral device (Since R2023a)
UART read blockUART/USART ReadRead data from the Universal Asynchronous Receiver Transmitter (UART/USART) port (Since R2022a)
UART/USART Write blockUART/USART WriteWrite serial data from the Universal Asynchronous Receiver Transmitter (UART/USART) port (Since R2022a)
MODBUS ReadModbus ReadRead data from server device register(s) over RS485 network (Since R2025a)
MODBUS WriteModbus WriteWrite data to server device register(s) over RS485 network (Since R2025a)
TCP Receive blockTCP ReceiveReceive data over TCP/IP network from remote host (Since R2022b)
TCP Send blockTCP SendSend data over TCP/IP network to remote host (Since R2022b)
UDP Receive blockUDP ReceiveReceive UDP packets from UDP host (Since R2022b)
UDP Send blockUDP SendSend UDP packets to UDP host (Since R2022b)
MQTT publish blockMQTT PublishPublish messages to MQTT broker on specified topic (Since R2024a)
MQTT subscribe blockMQTT SubscribeReceive messages from the MQTT broker for specified topic (Since R2024a)

Topics

Featured Examples