Skip to main content
Glama

reset_reason

Read reset-cause flags and core state over hotplug to diagnose unexpected reboots or watchdog resets without resetting or halting the target.

Instructions

读复位原因(RCC_RSR 标志)与内核运行状态,走 hotplug:不复位、不停内核。

回答「板子为什么自己重启了」「是不是看门狗喂狗没喂上」这类问题。 RCC_RSR 会给出 PINRSTF(复位引脚)/ BORRSTF(欠压)/ SFTRSTF(软件)/ IWDGRSTF(独立看门狗)/ WWDGRSTF(窗口看门狗)/ LPWRRSTF(低功耗退出)。

★ 关键理解:这些标志是【累积】的,只有写 RMVF 或整片掉电才清。 所以「好几个位同时为 1」= 「自上次清零以来发生过这几类复位」, 不等于「最后一次是它们一起发生」。 要定位「这一次」:先 clear_flags=True + confirm=True 清零 → 复现 → 再读。 clear_flags 不可逆(销毁现场),受隔离层管辖且需 confirm=True。 then_reset 只在 clear_flags=True 时有意义:清零并读回验证后再复位一次, 让内核继续跑(默认 True)。

★ 哪些动作会自己置标志(实测,用来区分「真复位」与「读操作自带的噪声」): hotplug 连接(仅连接)→ 不置任何标志; normal 连接(仅连接)→ PINRSTF|SFTRSTF; hotplug + -rst → PINRSTF|SFTRSTF; hotplug + -hardRst → 仅 PINRSTF。 所以清零后读回还看到 PINRSTF/SFTRSTF 几乎总是命令自己造成的,不是 RMVF 没生效。

★ 为什么必须 hotplug:STM32CubeProgrammer 以 normal 档连接动作本身就会复位目标 并 halt 内核。用 normal 读复位原因,读到的第一个标志就是这次读操作自己造成的 —— 结论必然错。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
snNo
confirmNo
then_resetNo
clear_flagsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so richly: it explains that RCC_RSR flags are cumulative (only cleared by RMVF or power loss), warns against misreading simultaneous bits, discloses that clear_flags is irreversible/destructive and gated by an isolation layer requiring confirm=True, and lists which connection actions self-set flags to distinguish real resets from read noise.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Content is front-loaded with purpose before the ★ behavioral sections, and every section earns its place given the tool's complexity. It is long and somewhat repetitive in the flag-action examples, but the length is largely justified by the operational subtleties.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists so return-value explanation is unnecessary; the description fully covers purpose, usage routing, the destructive/irreversible nature of clear_flags, the confirm gating, and the cumulative-flag caveat. Nothing essential for a correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It richly documents clear_flags (irreversible, needs confirm), then_reset (only meaningful when clear_flags=True, default True), and confirm, but never explains the 'sn' parameter. Three of four parameters get strong semantics, which is substantial compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource ('读复位原因(RCC_RSR 标志)与内核运行状态') and immediately scopes it ('走 hotplug:不复位、不停内核'), which distinguishes it from reset/flash siblings. An agent can tell exactly what it does without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It names the concrete question this answers ('板子为什么自己重启了', watchdog issues) and gives an explicit when-not/alternative path: it explains that 'normal' connection resets the target and halts the kernel, so hotplug is mandatory. The clear-then-reproduce-then-read workflow is spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.