当前位置:网站首页>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
边栏推荐
- qlib架构
- (线段树) 基础线段树常见问题总结
- Database implements distributed locks
- 端口排查步骤-7680端口分析-Dosvc服务
- The els block moves the boundary to the right, and accelerates downward.
- (六)枚举、注解
- (4) Recursion, variable parameters, access modifiers, understanding main method, code block
- (Line segment tree) Summary of common problems of basic line segment tree
- Pytest电商项目实战(上)
- 安全20220722
猜你喜欢

Understanding and Using Unity2D Custom Scriptable Tiles (4) - Start to build a custom tile based on the Tile class (below)

强化学习:从入门到入坑再到拉屎

Component pass value provide/inject
![[C language] General method of base conversion](/img/28/954af5f47a79ff02d3cc0792ac8586.jpg)
[C language] General method of base conversion

Database implements distributed locks

安全20220712

idea工程明明有依赖但是文件就是显示没有,Cannot resolve symbol ‘XXX‘
![Summary of Huawei Distributed Storage FusionStorage Knowledge Points [Interview]](/img/83/e0163b324448c6ef5b106862673637.jpg)
Summary of Huawei Distributed Storage FusionStorage Knowledge Points [Interview]

endian mode

Mysql 45 study notes (twenty-four) MYSQL master-slave consistency
随机推荐
Redis 使用LIST做最新评论缓存
Why don't you programmers make a living off your own projects?And have to work for someone else?
Daily practice of LeetCode - 138. Copy a linked list with random pointers
errno错误码及含义(中文)
Good place to download jar packages
open failed: EACCES (Permission denied)
高等数学---第九章二重积分
Implementation of a sequence table
RESTful api interface design specification
Bubble sort, selection sort, insertion sort, binary search directly
TCP和UDP详解
Postgresql 15 source code analysis (5) - pg_control
安全20220712
(六)枚举、注解
[shell basics] determine whether the directory is empty
Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
[Paper reading] Mastering the game of Go with deep neural networks and tree search
微软 AI 量化投资平台 Qlib 体验
Can't load /home/Iot/.rnd into RNG
从滴滴罚款后数据治理思考