当前位置:网站首页>[Teach you to use the serial port idle interrupt of the STM32HAL library]
[Teach you to use the serial port idle interrupt of the STM32HAL library]
2022-08-04 20:56:00 【xixiaohuanqaq】
I. Test environment
STM32H750VBTX development board
Second, Steps
1, open serial port idle interrupt
HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)// Open IDLE in front of the main function, this size is the size of the buffer array you set yourself, the file posted below has the definition of this function
This function is in stm32h7xx_hal_uart_ex.c, which has already opened the serial port idle interrupt. What I checked before is not correct. Only in a communication group did I know that it was so simple.
2. Use the serial port idle callback function directly
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_tspan> Size){if(huart->Instance == USART1){//Call the serial port idle callback function directly, this size is the number of bytes received by the serial port each time}HAL_UARTEx_ReceiveToIdle_IT() //Open serial port idle interrupt again}
3, HAL_UART_IRQHandler(&huart1);
void USART1_IRQHandler(void){/* USER CODE BEGIN USART1_IRQn 0 *//* USER CODE END USART1_IRQn 0 */HAL_UART_IRQHandler(&huart1);//The processing of the flag bit has helped us deal with it. We directly call the callback function, namelyCan!/* USER CODE BEGIN USART1_IRQn 1 *//* USER CODE END USART1_IRQn 1 */}
III. Summary
**Using the serial port idle interrupt through the HAL library is so simple. I have checked a lot of information before, but they are not using the HAL library. They are all rewritten.Stuff, it's a lot easier to actually use the HAL library.At present, only the serial port idle interrupt is used, and the update will continue after the subsequent use of DMA.Thank you to the big guys in the group who have carefully guided and answered questions!!!**
边栏推荐
- ts集成和使用
- 【debug】postgres数据存储错乱
- 【手把手教你使用STM32HAL库的串口空闲中断】
- vim clear last search highlighting
- 数据仓库(1)什么是数据仓库,数仓有什么特点
- [Academic related] Tsinghua professor persuaded to quit his Ph.D.:I have seen too many doctoral students have mental breakdowns, mental imbalances, physical collapses, and nothing!...
- 如何最简单、通俗地理解爬虫的Scrapy框架?
- 动态规划_双数组字符串
- js的new Function()常用方法
- Getting Started with Lattice Passwords
猜你喜欢
Web3时代的战争
Five Minutes Introductory Text Processing Three Musketeers grep awk sed
After the tester with 10 years of service "naked resignation" from the big factory...
微信小程序云开发 | 赠、删、改城市名称信息的应用实现
WIN10系统如何开启终端
1、File对象学习
多商户商城系统功能拆解22讲-平台端分销商品
【一起学Rust | 进阶篇 | Service Manager库】Rust专用跨平台服务管理库
Comic | Two weeks after the boss laid me off, he hired me back and doubled my salary!
Zero-knowledge proof notes - private transaction, pederson, interval proof, proof of ownership
随机推荐
MySQL stored procedure introduction, creation, case, delete, view "recommended collection"
【2022杭电多校5 1012题 Buy Figurines】STL的运用
动态规划_双数组字符串
二叉搜索树解决硬木问题
adb shell input keyevent 模拟按键事件
该如何训练好深度学习模型?
C#移动OA办公系统源码(基于微信企业号)
vehemently condemn
[21天学习挑战赛——内核笔记](二)——设备树基础
c语言小项目(三子棋游戏实现)
QT(41)-多线程-QTThread-同步QSemaphore-互斥QMutex
matlab 画图
How to train a deep learning model?
构建Buildroot根文件系统(I.MX6ULL)
Matlab画图2
WIN10系统如何开启终端
Chrome安装zotero connector 插件
多商户商城系统功能拆解22讲-平台端分销商品
链队
拒绝服务攻击DDoS介绍与防范