当前位置:网站首页>RT thread changes the print serial port (add other functions on the basis of BSP)
RT thread changes the print serial port (add other functions on the basis of BSP)
2022-07-28 04:03:00 【Chaser Bridge】
Preface
The chips used :STM32F407ZG, Punctual atomic Explorer board
The configuration and of the environment on the official website BSP There are detailed descriptions of the production of , Of course, I am in the process of learning , Also made a simple note : How to see RT-Thread file 、RT Project establishment and BSP Fast build _ Chaser - Bridge blog -CSDN Blog
And refer to it yourself BSP The production process can be established on your own board LED Light flashing .
But if you want to use other functions , You need to add BSP The new function , Turn on the bottom drive , And add RT in menucongfig Select function .
The original RT-Thread Is the default USART1 Print information , Open here USART2 And through the serial port 2 Print the information .
One 、RT-Thread Of BSP Make
Here is a simple description of the steps :
1、 Copy generic template

2、 Use CubeMX Tool configuration Engineering
STM32CubeMX Project establishment _ Chaser - Bridge blog -CSDN Blog
Be careful , In the use of RT It is clear that do not generate corresponding .c/.h file
3、board File modification in folder (board.c/h、Kconfig)、 see

4、ENV Tools menuconfig、package
5、ENV Tools scons
scons --target=...、scons、scons --dist: Build project 、 compile 、 Replication Engineering
Two 、 increase BSP The function of
At the beginning, the template only opened one serial port and two GPIO, But in reality, it is impossible to use only these two functions , How to add BSP Function has become a very practical problem .
RT Of BSP It can be divided into three parts ( in the light of STM32 Speaking of , Own opinion ):RT-Thread brief introduction
- CubeMX structure BSP The bottom driver of
- RT Take the underlying drivers to form the component and service layer , Provides the function of API, And introduces the real-time operation kernel
- Developers use RT Of API Development application layer , And form your own application package (App)
2.1、CubeMX add to BSP The underlying driver of
For the convenience of study , First, add similar functions :USART1/2、UART4, Others will be updated gradually later BSP Construction of functions .



Here, the serial port usually uses asynchronous two-wire communication , After generating the file, you can open stm32f1xx_hal_msp.c File view driver .

Above, UART4 Add to complete , such BSP The underlying driver has been configured , You can also try other functions first , You can also check other blogs in this column to learn .
2.2、RT Add BSP function
2.2.1、 add to Kcongfig file
Kconfig (rt-thread.org):Kcongfig Of RT Working mechanism


config sentence :config A new set of configuration options is defined
menu/endmenu sentence : Used to generate menus
if/endif sentence : It's a conditional judgment
choice/endchoice sentence : Combine several similar configuration options , Users can select a set of configuration items
comment sentence : It appears on the first line of the interface , Used to define some prompt messages
source sentence : Used to read... In another file Kconfig file
- Add serial port 2 After Kconfig file ( stay board In the folder )

2.2.2、ENV in menuconfig Select the corresponding function from the menu
- Use menuconfig Interface , Serial port 2 The choice of

2.2.3、 View and configure rtconfig.h
- Select a good function to automatically update after exiting rtconfig.h Corresponding macro in

- stay rtconfig.h Change the serial port printing mode to serial port 2

2.2.4、 Change the main function
2.2.5、 Hardware link serial port 2 And open the debugging assistant

边栏推荐
- Build an "industrial brain" and improve the park's operation, management and service capabilities with "digitalization"!
- Do Netease and Baidu have their own tricks for seizing the beach AI learning machine?
- Data rich Computing: m.2 meets AI at the edge
- Dynamic planning - 62. Different paths
- STC timer is abnormal (how to modify the initial value, the timing time is 100ms)
- 常用的弱网测试工具
- 月薪28K学员 自动化测试经验分享
- Data mining-01
- 【图像分类】2021-MLP-Mixer NIPS
- Chinese Remainder Theorem of X problem
猜你喜欢

ServletContext、request、response

cookie与Session

Iterator function operation of iterator learning

Machine learning 07: Bayesian learning

Program life | test engineers only know a little? Seven shortcuts teach you to learn new technology quickly

Combination of Oracle and Premier League statistics and presentation

JDBC usage

Monotonic stack - 739. Daily temperature

Data rich Computing: m.2 meets AI at the edge

Ch340 RTS DTR pin programming drives OLED
随机推荐
月薪28K学员 自动化测试经验分享
CV2. Threshold(), CV2. Findcontours(), CV2. Findcontours image contour processing
Program life | test engineers only know a little? Seven shortcuts teach you to learn new technology quickly
Advanced Mathematics (Seventh Edition) Tongji University exercises 3-4 personal solutions (first 8 questions)
Data rich Computing: m.2 meets AI at the edge
Dynamic programming - 509. Fibonacci number
Dynamic planning - 62. Different paths
Error no matching function for call to 'std:: exception:: exception (const char [15])' problem solving
Chinese Remainder Theorem of X problem
Cookies and session
Summary and interpretation of CONDA virtual environment
7/27 (board) dyeing method to determine bipartite graph + find combination number (recursive formula)
[P4] solve the conflict between local file modification and library file
LeetCode_409_最长回文串
Basic knowledge of day08 redis
Un7.27: how to successfully build a ruoyi framework project in idea?
Dynamic planning - 1049. Weight of the last stone II
Interface automation test, complete introduction
[prototype and prototype chain] get to know prototype and prototype chain~
Protocols in swift