Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
UART
串口中断发送在rt_show_version()时发生发送非空时,程序挂掉
发布于 2019-07-30 17:33:18 浏览:1620
订阅该版
当Finsh串口工作在中断发送时,在运行到`rt_show_version()`里打印信息时, ```c if (serial->ops->putc(serial, *(char*)data) == -1)
//当put由于发送非空返回-1时
{ rt_completion_wait(&(tx->completion), RT_WAITING_FOREVER); //运行到这里 continue; } ``` ```c rt_err_t rt_completion_wait(struct rt_completion *completion, rt_int32_t timeout) { rt_err_t result; rt_base_t level; rt_thread_t thread; RT_ASSERT(completion != RT_NULL); result = RT_EOK; thread = rt_thread_self(); //由于此时在rt_show_version()处,尚未建立任务这里返回0x00000 level = rt_hw_interrupt_disable(); if (completion->flag != RT_COMPLETED) { /* only one thread can suspend on complete */ RT_ASSERT(rt_list_isempty(&(completion->suspended_list))); if (timeout == 0) { result = -RT_ETIMEOUT; goto __exit; } else { /* reset thread error number */ thread->error = RT_EOK; /* suspend thread */ rt_thread_suspend(thread); //这里会报错 /* add to suspended list */ rt_list_insert_before(&(completion->suspended_list), &(thread->tlist)); /* current context checking */ RT_DEBUG_NOT_IN_INTERRUPT; /* start timer */ if (timeout > 0) { /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &timeout); rt_timer_start(&(thread->thread_timer)); } /* enable interrupt */ rt_hw_interrupt_enable(level); /* do schedule */ rt_schedule(); /* thread is waked up */ result = thread->error; level = rt_hw_interrupt_disable(); } } /* clean completed flag */ completion->flag = RT_UNCOMPLETED; __exit: rt_hw_interrupt_enable(level); return result; } ``` 程序会运行出错。。 解决方法: finsh控制台不使用中断发送
查看更多
2
个回答
默认排序
按发布时间排序
Berte_Yu
2019-07-30
这家伙很懒,什么也没写!
回复代码里的注释不能加颜色的呢
Berte_Yu
2019-07-30
这家伙很懒,什么也没写!
1、if (serial->ops->putc(serial, *(char*)data) == -1) //当put由于发送非空返回-1时 { rt_completion_wait(&(tx->completion), RT_WAITING_FOREVER); //运行到这里 2、rt_err_t rt_completion_wait(struct rt_completion *completion,rt_int32_t timeout) 中 thread = rt_thread_self(); //由于此时在rt_show_version()处,尚未建立任务这里返回0x00000 下面的程序中有队thread的断言,断言一直过不去
撰写答案
登录
注册新账号
关注者
0
被浏览
1.6k
关于作者
Berte_Yu
这家伙很懒,什么也没写!
提问
2
回答
2
被采纳
0
关注TA
发私信
相关问题
1
rt thread 2.0.2 usart 接收缓存问题
2
关于STM32串口通信的问题
3
STM32F1+RTT串口接收终端数据丢失问题
4
UART TX丢数据?
5
RTT打开串口的时候如何自定义波特率呢?
6
STM32F4的USART数据接收问题
7
串口1234使用问题
8
串口接收回调函数
9
LPC18xx UART问题讨论
10
x1000串口配置的失败问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
RT-Thread动态模块
2
RT-Thread项目助手v0.3 | Ubuntu与MacOS平台的RT-Thread Env
3
【FRA156测评DM-MCX】- 环境配置篇
4
【基于HPM6750+RW007的网页服务器】---SD卡文件系统
5
有关RT_thread studio使用WDT的一点经验
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
rt-smart
RTC
FAL
I2C_IIC
ESP8266
UART
cubemx
WIZnet_W5500
ota在线升级
PWM
BSP
flash
freemodbus
packages_软件包
潘多拉开发板_Pandora
GD32
定时器
ADC
flashDB
编译报错
socket
中断
rt_mq_消息队列_msg_queue
Debug
keil_MDK
SFUD
msh
ulog
C++_cpp
MicroPython
本月问答贡献
lchnu
3
个答案
2
次被采纳
张世争
1
个答案
2
次被采纳
a1012112796
9
个答案
1
次被采纳
三世执戟
8
个答案
1
次被采纳
聚散无由
5
个答案
1
次被采纳
本月文章贡献
jinchanchan
9
篇文章
13
次点赞
ssdd45555
3
篇文章
2
次点赞
聚散无由
1
篇文章
4
次点赞
rvcore
1
篇文章
1
次点赞
lvdongchina
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部