当前位置:网站首页>[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!!!**边栏推荐
猜你喜欢

Desthiobiotin-PEG4-Azide_脱硫生物素-叠氮化物 100mg

QT(41)-多线程-QTThread-同步QSemaphore-互斥QMutex

3. Byte stream and character stream of IO stream

伺服电机矢量控制原理与仿真(1)控制系统的建立

如何用好建造者模式

How to make good use of builder mode

web漏洞扫描器-awvs

How to carry out AI business diagnosis and quickly identify growth points for cost reduction and efficiency improvement?

Web3安全风险令人生畏,应该如何应对?

【学术相关】清华教授发文劝退读博:我见过太多博士生精神崩溃、心态失衡、身体垮掉、一事无成!...
随机推荐
文章复现:超分辨率网络-VDSR
链栈的应用
关于 SAP 电商云 Spartacus UI SSR 的 state transfer 问题
idea源码无法下载
【debug】postgres数据存储错乱
C语言小笔记+题
win10 uwp 使用 WinDbg 调试
uwp ScrollViewer content out of panel when set the long width
After encountering MapStruct, the conversion between PO, DTO and VO objects is no longer handwritten
vscode离线安装插件方法
两种白名单限流方案(redis lua限流,guava方案)
win10 uwp modify picture quality compress picture
xss课堂内容复现
项目难管理?先学会用好甘特图(内附操作方法及实用模板)
adb控制常用命令
node 的运行命令
LINQ to SQL (Group By/Having/Count/Sum/Min/Max/Avg操作符)
动态数组底层是如何实现的
run command for node
如何用好建造者模式