当前位置:网站首页>[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 functionThis 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!!!**边栏推荐
猜你喜欢
随机推荐
经验分享|盘点企业进行知识管理时的困惑类型
Latex分章节、分段落编译:input{}与include{}的区别
【2022杭电多校5 1003 Slipper】多个超级源点+最短路
文章复现:超分辨率网络-VDSR
88.(cesium之家)cesium聚合图
Oreo domain name authorization verification system v1.0.6 public open source version website source code
QT(42)-QT线程-线程调用槽函数
jekyll 在博客添加流程图
简述@RequestParam与@RequestBody参数注解
Nuxt.js的优缺点和注意事项
【debug】postgres数据存储错乱
【一起学Rust | 进阶篇 | Service Manager库】Rust专用跨平台服务管理库
【1403. 非递增顺序的最小子序列】
推荐系统_刘老师
【手把手教你使用STM32HAL库的串口空闲中断】
QT(41)-多线程-QTThread-同步QSemaphore-互斥QMutex
Unreal 本地化 国家化 多语言
Zero-knowledge proof - zkSNARK proof system
遇到MapStruct后,再也不手写PO,DTO,VO对象之间的转换了
3. Byte stream and character stream of IO stream









