当前位置:网站首页>STM32 problem collection
STM32 problem collection
2022-07-31 03:02:00 【yyhnet.cn】
KeilDownloader crashes
删除当前目录下的.uvoptx后缀文件,Just reconfigure the magic wand
HALThe library serial port interrupt is not called
STM32采用HAL库HAL_UART_Receive_IT()只调用一次,The first thing to do is to enable global interrupts,Then make sure to call it after the serial port initialization is completeHAL_UART_Receive_IT()确定返回HAL_OK,Then add it to the receive interrupt callback function,And make sure the received byte length is 1,因为采用HAL库,Receive serial port in interrupt mode,只有当RxXferCount == 0 时,也就是调用这个函数,When receiving the specified amount of data size is complete,才会调用回调函数HAL_UART_RxCpltCallback().所以紧接着,In the serial port interrupt service function,又调用了一次,继续接收,This will not cause the specified data frame length to be received and will not enter the interrupt.
uint8_t uart1_rxbuf[10];
uint8_t uart2_rxbuf[10];
if(HAL_UART_Receive_IT(&huart1, uart1_rxbuf, 1)==HAL_OK)
{
HAL_UART_Transmit(&huart1, (uint8_t *)"ok", 2,0xffff);
}
if(HAL_UART_Receive_IT(&huart2, uart2_rxbuf, 1)==HAL_OK)
{
HAL_UART_Transmit(&huart2, (uint8_t *)"ok", 2,0xffff);
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if(huart->Instance == USART1)
{
HAL_UART_Transmit(&huart2, uart1_rxbuf, 1,0xffff); // 把收到的字节原样发送出去
HAL_UART_Receive_IT(&huart1, uart1_rxbuf, 1); // 重新注册一次,Otherwise, you won't receive it next time
}
if(huart->Instance == USART2)
{
HAL_UART_Transmit(&huart1, uart2_rxbuf, 1,0xffff);
HAL_UART_Receive_IT(&huart2, uart2_rxbuf, 1);
}
}
边栏推荐
- TCP详解(二)
- 12 Disk related commands
- Clustering index, and what is the difference between a clustering index
- 下载jar包的好地方
- 【C语言基础】解决C语言error: expected ‘;‘, ‘,‘ or ‘)‘ before ‘&‘ token
- 8、统一处理异常(控制器通知@ControllerAdvice全局配置类、@ExceptionHandler统一处理异常)
- SQALE 是什么
- 【异常】The field file exceeds its maximum permitted size of 1048576 bytes.
- 6. Display comments and replies
- Multilingual settings of php website (IP address distinguishes domestic and foreign)
猜你喜欢

Pythagorean tuple od js

分布式系统架构需要解决的问题

【编译原理】递归下降语法分析设计原理与实现

Project (5) - Small target detection tph-yolov5

LeetCode简单题之找到和最大的长度为 K 的子序列

YOLOV5学习笔记(三)——网络模块详解

【C语言】进制转换一般方法

分布式与集群是什么 ? 区别是什么?

Graphical lower_bound & upper_bound

Is interprofessional examination difficult?Low success rate of "going ashore"?Please accept this practical guide!
随机推荐
Maximum area of solar panel od js
PMP微信群日常习题
10 Permission introduction
CentOS7下mysql5.7.37的卸载【完美方案】
刚出道“一战成名”,安全、舒适一个不落
VS QT——ui不显示新添加成员(控件)||代码无提示
【Cocos Creator 3.5】缓动系统停止所有动画
golang GUI for nuxui — HelloWorld
Project (5) - Small target detection tph-yolov5
Map.Entry理解和应用
MultipartFile file upload
7、私信列表
Multilingual settings of php website (IP address distinguishes domestic and foreign)
4、敏感词过滤(前缀树)
10. Redis implements likes (Set) and obtains the total number of likes
工程(五)——小目标检测tph-yolov5
【C语言】进制转换一般方法
开题报告之论文框架
品牌广告投放平台的中台化应用与实践
【异常】The field file exceeds its maximum permitted size of 1048576 bytes.