硬汉嵌入式论坛

 找回密码
 立即注册
查看: 974|回复: 12
收起左侧

[硬件异常黑盒子] 通过HT Tool 查找异常原因

[复制链接]
回帖奖励 10 个金币 回复本帖可获得 10 个金币奖励! 每人限 1 次

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
发表于 2022-11-8 12:41:58 | 显示全部楼层 |阅读模式
如标题,想请教各位老师,如何通过H7 Tool查找问题,我再说明书中没发现 关于此部分的描述.
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-8 12:42:26 | 显示全部楼层
留下没技术的泪水
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-8 12:44:06 | 显示全部楼层
我看到了, sorry ,
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-8 12:49:44 | 显示全部楼层
下载成功============================================================
=========寄存器值读取========================================
============================================================
R0 = 00000000
R1 = 00000015
R2 = 00000000
R3 = 000003ff
R4 = 2000ce50
R5 = 2000ce50
R6 = 00000000
R7 = 00000000
R8 = 00000000
R9 = 00000000
R10 = a5a5a5a5
R11 = a5a5a5a5
R12 = a5a5a5a5
R13(SP) = 200117e0
R14(LR) = 08039d7d
R15(PC) = 08021696
xPSR = 41000003


------------------------------------------------------------------
Read System Handler Control and State Register SHCSR = 0x00000000
------------------------------------------------------------------
MEMFAULTACT = 0
BUSFAULTACT = 0
USGFAULTACT = 0
SVCALLACT = 0
MONITORACT = 0
PENDSVACT = 0
SYSTICKACT = 0
USGFAULTPENDED = 0
MEMFAULTPENDED = 0
BUSFAULTPENDED = 0
SVCALLPENDED = 0
MEMFAULTENA = 0
BUSFAULTENA = 0
USGFAULTENA = 0


------------------------------------------------------------------
Read HardFault Status Register HSFR Register = 0x40000000
------------------------------------------------------------------
VECTBL = 0, 中断向量表无Bus Fault
FORCED = 1, forced Hard Fault
            Indicates a forced Hard Fault, generated by escalation of a fault with configurable
            priority that cannot be handled, either because of priority or because it is disabled
            When this bit is set, the Hard Fault handler must read the other fault status registers
            to find the cause of the fault


------------------------------------------------------------------
MemManage Status Register (MMFSR) = 0x00
------------------------------------------------------------------
IACCVIOL = 0, 无指令访问冲突错误
DACCVIOL = 0,  无数据访问异常
MUNSTKERR = 0,  出栈正常
MSTKERR = 0,  入栈正常
MLSPERR = 0,  浮点lazy stacking特性保存期间未发生故障
MMARVALID = 0,  SCB->MMFAR寄存器没有记录异常地址


------------------------------------------------------------------
MemManage Address Register (MMFAR) = 0xb4007480
------------------------------------------------------------------
Data address for a MemManage fault. This register is updated with the address of a location
that produced a MemManage fault. The MMFSR shows the cause of the fault. This field is valid
only when MMFSR.MMARVALID is set. In implementations without unique BFAR and MMFAR
registers, the value of this register is UNKNOWN if BFSR.BFARVALID is set


------------------------------------------------------------------
BusFault Status Register (BFSR) = 0x82
------------------------------------------------------------------
IBUSERR = 0, 指令总线正常
PRECISERR = 1, 精确的数据总线访问异常
            a data bus error has occurred, and the PC value stacked for the exception return points to
            the instruction that caused the fault.
            When the processor sets this bit, it writes the faulting address to BFAR.
IMPRECISERR = 0, 数据总线正常
UNSTKERR = 0, 中断出栈时正常
STKERR = 0, 中断入栈时正常
LSPERR = 0, 浮点lazy stacking特性保存期间未生故障
BFARVALID = 1, BFAR寄存器记录有效的异常地址
            The processor sets this bit after a BusFault where the address is known. Other faults can set this
            bit to 0, such as a MemManage fault occurring later. If a BusFault occurs and is escalated to a
            HardFault because of priority, the HardFault handler must set this bit to 0. This prevents
            problems if returning to a stacked active BusFault handler who is BFAR value has been
            overwritten.


------------------------------------------------------------------
BusFault Address Register (BFAR) = 0xb4007480
------------------------------------------------------------------
Data address for a precise BusFault. This register is updated with the address of a location that
produced a BusFault. The BFSR shows the reason for the fault. This field is valid only when
BFSR.BFARVALID is set. In implementations without unique BFAR and MMFAR registers, the
value of this register is UNKNOWN if MMFSR.MMARVALID is set


------------------------------------------------------------------
UsageFault Status Register (UFSR) = 0x0000
------------------------------------------------------------------
UNDEFINSTR = 0, 处理器访问指令正常
INVSTATE = 0, 没有无效状态
INVPC = 0, PC加载正常
NOCP = 0, 访问协处理正常
UNALIGNED = 0, 内存对齐访问正常
DIVBYZERO = 0,  无除数为0的异常, 或者没有使能除数为0的异常


============================================================
=========异常进一步分析======================================
============================================================
进入硬件异常前, 寄存器数值, 如果出现非精确异常, 这些值是不准确的:
R0 = 00000000
R1 = e000ef34
R2 = e000e400
R3 = 2000747c
R12 = 00000004
LR = 0804e34d
PC = 080041a8
PSR = 61000000
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106913
QQ
发表于 2022-11-8 14:36:26 | 显示全部楼层

回帖奖励 +10 个金币

在这个帖子里面,还没有正式整理到PDF手册里面。

基于H7-TOOL的硬件异常黑盒子功能V1.0版本操作说明,持续更新(2022-08-17)
https://www.armbbs.cn/forum.php? ... 4792&fromuid=58
(出处: 硬汉嵌入式论坛)
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-8 14:37:11 | 显示全部楼层
eric2013 发表于 2022-11-8 14:36
在这个帖子里面,还没有正式整理到PDF手册里面。

基于H7-TOOL的硬件异常黑盒子功能V1.0版本操作说明,持 ...

看到了, 老师 ,老瞎眼了 哈哈哈哈
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106913
QQ
发表于 2022-11-8 15:11:27 | 显示全部楼层
312456990 发表于 2022-11-8 14:37
看到了, 老师 ,老瞎眼了 哈哈哈哈

是我没有及时回复,及时回复就好了
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-8 15:27:02 | 显示全部楼层
eric2013 发表于 2022-11-8 14:36
在这个帖子里面,还没有正式整理到PDF手册里面。

基于H7-TOOL的硬件异常黑盒子功能V1.0版本操作说明,持 ...

老师, 我用H7 TOOL按照老师的方法, 是 prvStartFirstTask 导致进入硬件中断,
顺藤摸瓜,我的FreeRTOS配置如下:

一共有30个任务,祖传代码,我真的会谢!

#define configUSE_PREEMPTION                        1
#define configUSE_IDLE_HOOK                                0
#define configUSE_TICK_HOOK                                0
#define configCPU_CLOCK_HZ                                ( SystemCoreClock )
#define configTICK_RATE_HZ                                ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES                        ( 30 )
#define configMINIMAL_STACK_SIZE                ( ( unsigned short ) 127 )
#define configTOTAL_HEAP_SIZE                        ( ( size_t ) ( 38 * 1024 ) )
#define configMAX_TASK_NAME_LEN                        ( 15 )
#define configUSE_TRACE_FACILITY                1
#define configUSE_16_BIT_TICKS                        0
#define configIDLE_SHOULD_YIELD                        1
#define configUSE_MUTEXES                                1
#define configQUEUE_REGISTRY_SIZE                8
#define configCHECK_FOR_STACK_OVERFLOW        0
#define configUSE_RECURSIVE_MUTEXES                1
#define configUSE_MALLOC_FAILED_HOOK        0
#define configUSE_APPLICATION_TASK_TAG        0
#define configUSE_COUNTING_SEMAPHORES        1


/* Co-routine definitions. */
#define configUSE_CO_ROUTINES                 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Software timer definitions. */
#define configUSE_TIMERS                                0
#define configTIMER_TASK_PRIORITY                ( 2 )
#define configTIMER_QUEUE_LENGTH                10
#define configTIMER_TASK_STACK_DEPTH        ( configMINIMAL_STACK_SIZE * 2 )

#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY        5


现象是 在有的设备会出现,有的却不会, 是相同的固件,老师能否指点个方向,我现在毫无头绪
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-8 15:28:07 | 显示全部楼层
eric2013 发表于 2022-11-8 15:11
是我没有及时回复,及时回复就好了

实力这么强,还能如此谦虚, 永远向老师学习!!
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106913
QQ
发表于 2022-11-8 15:42:57 | 显示全部楼层
312456990 发表于 2022-11-8 15:27
老师, 我用H7 TOOL按照老师的方法, 是 prvStartFirstTask 导致进入硬件中断,
顺藤摸瓜,我的FreeRTOS配置 ...

出现这个的话,是上电就出现了,加个任务栈大小看下。

还是不行的话,分享你的工程到百度云,我看看
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-10 15:33:45 | 显示全部楼层
eric2013 发表于 2022-11-8 15:42
出现这个的话,是上电就出现了,加个任务栈大小看下。

还是不行的话,分享你的工程到百度云,我看看

老师, 我排查出问题了, prvStartFirstTask()  这个函数里面  执行完 svc 0 就死机了( 死机的设备永远是死机, 不死机的也永远不死机 ), 我再这之前 加了很多个 nop
就好了, 怀疑是 晶振 或者 系统时钟没初始化好,导致启动第一个任务失败, 加了多个 nop, 给电路足够的时间, 然后就成功了,   之前一直死机的设备, 再也没有出现死机, 特此跟老师分享我的心路历程, 哈哈哈哈 ,  md国产晶振害人
回复

使用道具 举报

8

主题

155

回帖

179

积分

初级会员

H7 TOOL 大法好!

积分
179
 楼主| 发表于 2022-11-10 15:35:09 | 显示全部楼层
eric2013 发表于 2022-11-8 15:42
出现这个的话,是上电就出现了,加个任务栈大小看下。

还是不行的话,分享你的工程到百度云,我看看

这次我能定位到 prvStartFirstTask()   , 还是依靠 H7 TOOL, 真的很强 , 永远支持安富莱
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106913
QQ
发表于 2022-11-10 15:59:44 | 显示全部楼层
312456990 发表于 2022-11-10 15:35
这次我能定位到 prvStartFirstTask()   , 还是依靠 H7 TOOL, 真的很强 , 永远支持安富莱

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-10 04:40 , Processed in 0.272156 second(s), 26 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表