当前位置:网站首页>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);
}
}
边栏推荐
- 2022 Nioke Multi-School League Game 4 Solution
- Addition and Subtraction of Scores in LeetCode Medium Questions
- Discourse 自定义头部链接(Custom Header Links)
- 【Android】Room —— SQLite的替代品
- [C language foundation] Solve C language error: expected ';', ',' or ')' before '&' token
- The simulation application of common mode inductance is here, full of dry goods for everyone
- 知识蒸馏7:知识蒸馏代码详解
- C primer plus学习笔记 —— 8、结构体
- 19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
- How to build a private yum source
猜你喜欢

Discourse Custom Header Links

Moxa NPort device flaw could expose critical infrastructure to devastating attack

CorelDRAW2022 streamlined Asia Pacific new features in detail

Graphical lower_bound & upper_bound

你们程序员为什么不靠自己的项目谋生?而必须为其他人打工?

SQL注入 Less54(限制次数的SQL注入+union注入)

VS QT——ui不显示新添加成员(控件)||代码无提示

Mathematics to solve the problem - circular linked list

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

关于 mysql8.0数据库中主键位id,使用replace插入id为0时,实际id插入后自增导致数据重复插入 的解决方法
随机推荐
Android's webview cache related knowledge collection
Uninstallation of mysql5.7.37 under CentOS7 [perfect solution]
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
Difference between CMOS and TTL?
工程(五)——小目标检测tph-yolov5
下载jar包的好地方
原子操作 CAS
YOLOV5 study notes (3) - detailed explanation of network module
Number 16, top posts
CorelDRAW2022精简亚太新增功能详细介绍
共模电感的仿真应用来了,满满的干货送给大家
10 权限介绍
15、网站统计数据
11. Redis implements follow, unfollow, and follow and follower lists
[Godot][GDScript] 二维洞穴地图随机生成
SQL injection Less47 (error injection) and Less49 (time blind injection)
【C语言基础】解决C语言error: expected ‘;‘, ‘,‘ or ‘)‘ before ‘&‘ token
Addition and Subtraction of Scores in LeetCode Medium Questions
YOLOV5 study notes (2) - environment installation + operation + training
execsnoop 工具