主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

连接性外设

配置和使用连接性外设,如 CAN、FDCAN、I2C、MQTT、SPI、UART/USART 和 TCP

使用连接性外设(例如 STM32 处理器可用的 CAN、FDCAN、I2C、SPI、UART/USART、TCP 及更多)创建 Simulink® 模型。使用模型配置参数配置 Simulink 模型以与支持的目标硬件对接。使用模型配置参数配置 Simulink 模型以与支持的目标硬件对接。

要支持在基于 STM32 处理器的板上运行 Simulink 模型,需要使用 STM32CubeMX 图形化工具。STM32CubeMX 工具采用图形界面,可用于配置 STM32 处理器的外设,并为所选的 STM32 处理器生成外设初始化代码。您可以配置基于 STM32 处理器的板,以将 STM32CubeMX 工程与 Simulink 结合使用来生成代码并将代码部署到硬件。

模块

全部展开

CAN ReadRead message from CAN network (自 R2023a 起)
CAN WriteWrite data to the CAN Bus (自 R2023a 起)
FDCAN ReadRead data from CAN FD Bus (自 R2023a 起)
FDCAN WriteWrite data to the FDCAN Bus (自 R2023a 起)
I2C Controller ReadRead data from I2C peripheral device or I2C peripheral device register
I2C Controller WriteWrite data to I2C peripheral device or I2C peripheral device register
SPI ReceiveReceive data through Serial Peripheral Interface (SPI) on target (自 R2023a 起)
SPI TransmitTransmit data through Serial Peripheral Interface (SPI) on target (自 R2023a 起)
SPI Controller TransferWrite data to and read data from SPI peripheral device (自 R2023a 起)
UART/USART Read从通用异步接收机/发射机 (UART/USART) 端口读取数据 (自 R2022a 起)
UART/USART WriteWrite serial data from the Universal Asynchronous Receiver Transmitter (UART/USART) port (自 R2022a 起)
Modbus ReadRead data from server device register(s) over RS485 network (自 R2025a 起)
Modbus WriteWrite data to server device register(s) over RS485 network (自 R2025a 起)
TCP ReceiveReceive data over TCP/IP network from remote host (自 R2022b 起)
TCP SendSend data over TCP/IP network to remote host (自 R2022b 起)
UDP ReceiveReceive UDP packets from UDP host (自 R2022b 起)
UDP SendSend UDP packets to UDP host (自 R2022b 起)
MQTT PublishPublish messages to MQTT broker on specified topic (自 R2024a 起)
MQTT SubscribeReceive messages from the MQTT broker for specified topic (自 R2024a 起)

主题

精选示例