当前位置:网站首页>MATLAB/Simulink & & STM32CubeMX tool chain completes model-based design development (MBD) (three)
MATLAB/Simulink & & STM32CubeMX tool chain completes model-based design development (MBD) (three)
2022-07-31 04:01:00 【Junior Brother 1995】
Foreword
Based on the previous two articles, this blog completes model-based development with the help of the MATLAB hardware support package provided by STM32.The tools used in this tool chain are MATLAB/Simulink and STM32CubeMX, and the steps of manual code integration with Keil tools are omitted. All work is only done in MATLAB/Simulink and STM32CubeMX.
Note: Applying this toolchain requires installing the STM32 hardware support package, STM32CubeMX and STM32CubeProgrammer, and configuring the hardware environment.
I. Overview
Design requirements: Control the status of the two LEDs by pressing the button. Press the button once and the two LEDs will light up. Press the button again and the two LEDs will flash alternately at 1s intervals. Press the button again, and the two LEDs will turn off.
Controller: STM32F407ZG
Application layer development: MATLAB/Simulink
Bottom configuration: STM32CubeMX
Second, use steps
1. Hardware Design
Indicator: LED0, LED1
Button: KEY0
2. Software Design
1. MATLAB->APP->Run on Hardware Board, select the target development board.My board is STM32F407ZG, so I choose STM32F4xx Based
2. Create a new STM32CubeMX project and configure the bottom layer.Configure PF9, PF10 as output, PE4 as input, set Project Manager, save the project
3. Open the settings in MATLAB to load the STM32CubeMX project, and enter MATLAB/Simulink for application layer programming.
4. MATLAB programming is as follows
4.1 After installing the STM32 hardware support package, the hardware resources of the support package will appear in Simulink
4.2 Read the state of PE4, when a drop is generatedThe edge indicates that the key KEY0 is pressed, triggering the subsystem to run.Trigger the first time, the subsystem output 0; trigger the second time, the subsystem output 1; trigger the third subsystem output 3, repeat the cycle.
4.2 When triggering subsystem output 0, turn off LED0, LED1, PF9, PF10 output 1.
4.3 When the subsystem output 1 is triggered, turn on LED0, LED1, PF9, PF10 output 0.
4.4 When the subsystem output 2 is triggered, LED0 andLED1 is in flow state, 1s interval period
5. SettingSolver that automatically handles rate conversion for data transfer
6, Open the development board, click Build Deploy & Start, wait for the download to complete to observe the experimental phenomenon.
7. Experimental phenomenon
0730
边栏推荐
- Detailed explanation of TCP and UDP
- 识Flutter 基本组件之showTimePicker 方法
- Golang中的addressable
- How Zotero removes auto-generated tags
- IIR filter and FIR filter
- Safety 20220718
- 微软 AI 量化投资平台 Qlib 体验
- A brief introduction to the CheckboxListTile component of the basic components of Flutter
- [AUTOSAR-RTE]-5-Explicit (explicit) and Implicit (implicit) Sender-Receiver communication
- ClickHouse: Setting up remote connections
猜你喜欢
Why don't you programmers make a living off your own projects?And have to work for someone else?
Understanding and Using Unity2D Custom Scriptable Tiles (4) - Start to build a custom tile based on the Tile class (below)
C语言从入门到如土——数据的存储
Notes on the establishment of the company's official website (6): The public security record of the domain name is carried out and the record number is displayed at the bottom of the web page
IDEA常用快捷键与插件
(八)Math 类、Arrays 类、System类、Biglnteger 和 BigDecimal 类、日期类
pom文件成橘红色未加载的解决方案
LeetCode每日一练 —— 138. 复制带随机指针的链表
IDEA comment report red solution
[Swift] Customize the shortcut that pops up by clicking the APP icon
随机推荐
安全20220712
(tree) Last Common Ancestor (LCA)
[AUTOSAR-RTE]-5-Explicit (explicit) and Implicit (implicit) Sender-Receiver communication
errno error code and meaning (Chinese)
从滴滴罚款后数据治理思考
Database implements distributed locks
qlib架构
(树) 最近公共祖先(LCA)
Regarding the primary key id in the mysql8.0 database, when the id is inserted using replace to be 0, the actual id is automatically incremented after insertion, resulting in the solution to the repea
Mysql 45 study notes (twenty-four) MYSQL master-slave consistency
Automation strategies for legacy systems
【小土堆补充】Pytorch学习笔记_Anaconda虚拟环境使用
[Dynamic programming] Maximum sum of consecutive subarrays
addressable in Golang
The els block moves the boundary to the right, and accelerates downward.
interprocess communication
some of my own thoughts
Redis 使用 sorted set 做最新评论缓存
(5) final, abstract class, interface, inner class
How to develop a high-quality test case?