Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
Hardfault
hard fault on thread: lte?
发布于 2022-06-16 17:02:46 浏览:517
订阅该版
rtt studio环境,运行一段时间出现这个线程错误,实在想不明白,第一次接触RTT,求助各位大神。 ``` [16:55:39.596]收←◆ !at! [16:55:39.799]收←◆psr: 0x21000000 r00: 0x5ff7f06b r01: 0x2000a8d0 r02: 0x08014798 r03: 0x00000025 r04: 0x2000a8d0 r05: 0x00000025 r06: 0x2000a96c r07: 0x20001e70 r08: 0x0000000a r09: 0x2000a624 r10: 0x080162a1 r11: 0x08014798 r12: 0x00000000 lr: 0x08010903 pc: 0x08010fa6 hard fault on thread: lte thread pri status sp stack size max used left tick error -------- --- ------- ---------- ---------- ------ ---------- --- serial8 20 suspend 0x000000a0 0x00000400 27% 0x00000006 000 lte 18 running 0x000000c0 0x00001000 23% 0x00000008 000 serial4 20 suspend 0x000000a0 0x00000400 15% 0x0000000a 000 serial3 20 suspend 0x000000a0 0x00000400 15% 0x0000000a 000 serial2 25 suspend 0x000000a0 0x00000400 15% 0x0000000a 000 at_clnt 9 suspend 0x000000f8 0x00000600 16% 0x00000005 000 tshell 20 suspend 0x000000cc 0x00001000 05% 0x0000000a 000 sys_work 23 suspend 0x00000084 0x00000800 06% 0x0000000a 000 tidle0 31 ready 0x00000074 0x00000400 14% 0x0000000e 000 timer 4 suspend 0x00000080 0x00000200 25% 0x00000009 000 bus fault: SCB_CFSR_BFSR:0x82 PRECISERR SCB->BFAR:5FF7F06C ``` ```c #include "lte.h" #include "at.h" #include "stdlib.h" #include "string.h" #include "stdio.h" lte_para_typedef lte_para = {0}; at_response_t resp = RT_NULL; /******************************************************************************* *4G模块配置 */ void lte_cfg_init(void) { rt_pin_mode(power_en_Pin, PIN_MODE_OUTPUT); rt_pin_mode(power_key_Pin, PIN_MODE_OUTPUT); at_client_init("uart7",1024); resp = at_create_resp(1024, 0, rt_tick_from_millisecond(5000)); } /******************************************************************************* *4G模块联网前状态检查 */ void lte_checkstate_init(void) { int ret;rt_uint8_t count; //参数 __reset_function_entry: rt_memset(<e_para,0,sizeof(lte_para_typedef)); lte_para.current_state = State_PowerOff_Restart; rt_kprintf("\r\n!init!\r\n"); //开启 power_enOFF;power_keyOFF;rt_thread_mdelay(2500); power_EnON;rt_thread_mdelay(10000); lte_para.current_state = State_AT; rt_kprintf("\r\n!poweron!\r\n"); //AT ret=-RT_ETIMEOUT;count = 0; do { count++;ret=at_client_wait_connect(5000);rt_thread_mdelay(100); }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_ATE0; rt_kprintf("\r\n!at!\r\n"); //关闭回显 ret=-RT_ETIMEOUT;count = 0; do { count++; ret=at_exec_cmd(resp,"ATE0"); rt_thread_mdelay(100); if(ret == RT_EOK) { ret=-RT_ETIMEOUT; if(rt_strstr("\r\nOK\r\n",at_resp_get_line(resp,2))!=RT_NULL) { ret = RT_EOK; } } }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_CGMM; //模块型号 ret=-RT_ETIMEOUT;count = 0; do { count++; ret=at_exec_cmd(resp,"AT+CGMM"); rt_thread_mdelay(100); if(ret == RT_EOK) { at_resp_parse_line_args(resp,2,"%s",lte_para.M_Model); rt_kprintf("\r\nM_Model:%s!\r\n",lte_para.M_Model); } }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_CGMR; //模块固件版本号 ret=-RT_ETIMEOUT;count = 0; do { count++; ret=at_exec_cmd(resp,"AT+CGMR"); rt_thread_mdelay(100); if(ret == RT_EOK) { at_resp_parse_line_args(resp,2,"%s",lte_para.Firmware_version); rt_kprintf("\r\nFirmware_version:%s!\r\n",lte_para.Firmware_version); } }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_QCCID; //请求SIM卡的ICCID ret=-RT_ETIMEOUT;count = 0; do { count++; ret=at_exec_cmd(resp,"AT+QCCID"); rt_thread_mdelay(100); if(ret == RT_EOK) { at_resp_parse_line_args(resp,2,"+QCCID: %s",lte_para.SIM_CCID); rt_kprintf("\r\nSIM_CCID:%s!\r\n",lte_para.SIM_CCID); } }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_CIMI; //请求SIM卡的IMSI ret=-RT_ETIMEOUT;count = 0; do { count++; ret=at_exec_cmd(resp,"AT+CIMI"); rt_thread_mdelay(100); if(ret == RT_EOK) { at_resp_parse_line_args(resp,2,"%s",lte_para.IMSI); rt_kprintf("\r\nIMSI:%s!\r\n",lte_para.IMSI); } }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_CGSN; //产品IMEI ret=-RT_ETIMEOUT;count = 0; do { count++; ret=at_exec_cmd(resp,"AT+CGSN"); rt_thread_mdelay(100); if(ret == RT_EOK) { at_resp_parse_line_args(resp,2,"%s",lte_para.IMEI); rt_kprintf("\r\nIMEI:%s!\r\n",lte_para.IMEI); } }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_CPIN; //是否附着网络 ret=-RT_ETIMEOUT;count = 0; do { count++; ret=at_exec_cmd(resp,"AT+CPIN?"); rt_thread_mdelay(100); if(ret == RT_EOK) { ret=-RT_ETIMEOUT; if(rt_strstr(at_resp_get_line(resp,2),"READY")!=RT_NULL) { ret = RT_EOK; } rt_kprintf("\r\nAT+CPIN?back:%s!\r\n",at_resp_get_line(resp,2)); } }while((ret != RT_EOK)&&(count<3)); if(ret != RT_EOK){goto __reset_function_entry;} lte_para.current_state = State_CSQ; } /******************************************************************************* *4G模块工作 */ void lte_thread_entry(void *parameter) { while(1) { lte_checkstate_init(); } } ``` ```c /* * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2022-05-18 RT-Thread first version */ #include
#define DBG_TAG "main" #define DBG_LVL DBG_LOG #include
#include
#include "uartx.h" #include "systemrunx.h" #include "lte.h" int main(void) { rt_thread_t thread; rt_timer_t systemLed; hardware_gpio_cfg(); uartx_config(); lte_cfg_init(); syspara_cfg(); /*debug*/ thread = rt_thread_create("serial2", serial2_thread_entry, RT_NULL, 1024, 25, 10); if(thread != RT_NULL){rt_thread_startup(thread);} /*驱动板*/ thread = rt_thread_create("serial3", serial3_thread_entry, RT_NULL, 1024, 20, 10); if(thread != RT_NULL){rt_thread_startup(thread);} /*LCD*/ thread = rt_thread_create("serial4", serial4_thread_entry, RT_NULL, 1024, 20, 10); if(thread != RT_NULL){rt_thread_startup(thread);} /*4g moudle*/ thread = rt_thread_create("lte", lte_thread_entry, RT_NULL, 4096, 18, 20); if(thread != RT_NULL){rt_thread_startup(thread);} /*wifi*/ thread = rt_thread_create("serial8", serial8_thread_entry, RT_NULL, 1024, 20, 10); if(thread != RT_NULL){rt_thread_startup(thread);} /*sys_led*/ systemLed = rt_timer_create("led", system_led_entry, RT_NULL, 2000, RT_TIMER_FLAG_PERIODIC); if(systemLed != RT_NULL) rt_timer_start(systemLed); /*ec20_step*/ return RT_EOK; } ``` ```c /* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2022-05-20 Administrator the first version */ #include "systemrunx.h" #include "uartx.h" //系统运行指示灯GPIO配置 void sysled_gpio_cfg(void) { rt_pin_mode(LED_Pin, PIN_MODE_OUTPUT); } //GPIO初始化 void hardware_gpio_cfg(void) { sysled_gpio_cfg(); } //参数初始化 void syspara_cfg(void) { } void system_led_entry(void *parameter) { static u_int8_t flag = PIN_LOW; rt_pin_write(LED_Pin, flag); if(flag == PIN_LOW){flag = PIN_HIGH;} else{flag = PIN_LOW;} } ``` 一下是串口打印信息 ``` [16:54:44.165]收←◆\0 [16:54:47.476]收←◆ \ | / - RT - Thread Operating System / | \ 4.0.3 build Jun 16 2022 2006 - 2020 Copyright by rt-thread team [32m[I/sal.skt] Socket Abstraction Layer initialize success.[0m [32m[I/at.clnt] AT client(V1.3.1) on device uart7 initialize success.[0m !init! msh > [16:54:59.862]收←◆ !poweron! [16:54:59.965]收←◆ !at! [16:55:00.170]收←◆ M_Model:EC20F! [16:55:00.276]收←◆ Firmware_version:EC20CEHDLGR06A07M1G! [16:55:00.383]收←◆ SIM_CCID:89861118211034912320! [16:55:00.490]收←◆ IMSI:460113307674877! [16:55:00.596]收←◆ IMEI:865396055663872! [16:55:00.704]收←◆ AT+CPIN?back:+CPIN: READY! !init! [16:55:13.070]收←◆ !poweron! [16:55:13.174]收←◆ !at! [16:55:13.379]收←◆ M_Model:EC20F! [16:55:13.484]收←◆ Firmware_version:EC20CEHDLGR06A07M1G! [16:55:13.593]收←◆ SIM_CCID:89861118211034912320! [16:55:13.703]收←◆ IMSI:460039521054241! [16:55:13.810]收←◆ IMEI:865396055663872! [16:55:13.918]收←◆ AT+CPIN?back:+CPIN: READY! !init! [16:55:26.286]收←◆ !poweron! [16:55:26.390]收←◆ !at! [16:55:26.596]收←◆ M_Model:EC20F! [16:55:26.700]收←◆ Firmware_version:EC20CEHDLGR06A07M1G! [16:55:26.809]收←◆ SIM_CCID:89861118211034912320! [16:55:26.919]收←◆ IMSI:460039521054241! [16:55:27.026]收←◆ IMEI:865396055663872! [16:55:27.132]收←◆ AT+CPIN?back:+CPIN: READY! !init! [16:55:39.495]收←◆ !poweron! [16:55:39.596]收←◆ !at! [16:55:39.799]收←◆psr: 0x21000000 r00: 0x5ff7f06b r01: 0x2000a8d0 r02: 0x08014798 r03: 0x00000025 r04: 0x2000a8d0 r05: 0x00000025 r06: 0x2000a96c r07: 0x20001e70 r08: 0x0000000a r09: 0x2000a624 r10: 0x080162a1 r11: 0x08014798 r12: 0x00000000 lr: 0x08010903 pc: 0x08010fa6 hard fault on thread: lte thread pri status sp stack size max used left tick error -------- --- ------- ---------- ---------- ------ ---------- --- serial8 20 suspend 0x000000a0 0x00000400 27% 0x00000006 000 lte 18 running 0x000000c0 0x00001000 23% 0x00000008 000 serial4 20 suspend 0x000000a0 0x00000400 15% 0x0000000a 000 serial3 20 suspend 0x000000a0 0x00000400 15% 0x0000000a 000 serial2 25 suspend 0x000000a0 0x00000400 15% 0x0000000a 000 at_clnt 9 suspend 0x000000f8 0x00000600 16% 0x00000005 000 tshell 20 suspend 0x000000cc 0x00001000 05% 0x0000000a 000 sys_work 23 suspend 0x00000084 0x00000800 06% 0x0000000a 000 tidle0 31 ready 0x00000074 0x00000400 14% 0x0000000e 000 timer 4 suspend 0x00000080 0x00000200 25% 0x00000009 000 bus fault: SCB_CFSR_BFSR:0x82 PRECISERR SCB->BFAR:5FF7F06C ```
查看更多
1
个回答
默认排序
按发布时间排序
大龙哥哥
2022-06-17
这家伙很懒,什么也没写!
已经解决!
撰写答案
登录
注册新账号
关注者
0
被浏览
517
关于作者
大龙哥哥
这家伙很懒,什么也没写!
提问
2
回答
1
被采纳
0
关注TA
发私信
相关问题
1
RTT1.0,STM32调试时会跑到HardFault【已解决】,出现新问题
2
新手请教关于hardfault怎么查
3
github最新版本库中stm32f0X分支,运行切换任务时候出现hardfault[已解决]
4
实现iap功能,bootloader使用了rtt操作系统,在跳转到app代码的时候提示出现hardfault的问题
5
ymodem在on_begin内发送can无法断开连接,而且RTT会报hardfault
6
挂载UFFS文件系统执行到退出_BuildTreeStepOne函数时hardfault异常
7
STM32F1+RTT串口接收中断进入hardfault
8
STM32F746NG随机进入hardfault(已解决)
9
[已解决]自已建了个STM32F103的MDK工程,初始化时总是进入HardFault,求教!
10
将 Cortex M3 的 hardfault 处理与 M4、M7、M0 保持一致?
推荐文章
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
【NXP-MCXA153】 定时器驱动移植
2
GD32F450 看门狗驱动适配
3
【NXP-MCXA153】看门狗驱动移植
4
RT-Thread Studio V2.2.9 Release Note
5
CherryUSB的bootuf2配置
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
I2C_IIC
UART
WIZnet_W5500
ota在线升级
PWM
freemodbus
flash
cubemx
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
中断
编译报错
Debug
rt_mq_消息队列_msg_queue
SFUD
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
踩姑娘的小蘑菇
7
个答案
2
次被采纳
a1012112796
16
个答案
1
次被采纳
Ryan_CW
5
个答案
1
次被采纳
红枫
4
个答案
1
次被采纳
张世争
4
个答案
1
次被采纳
本月文章贡献
YZRD
3
篇文章
6
次点赞
catcatbing
3
篇文章
6
次点赞
lizimu
2
篇文章
9
次点赞
qq1078249029
2
篇文章
2
次点赞
xnosky
2
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部