Skip to main content
Glama

solve_timer

Computes timer Prescaler and Period (PSC/ARR) register values for a target update frequency using the solved TIMxCLK, returning exact or closest achievable frequency with ppm error.

Instructions

Solve a timer's Prescaler/Period (PSC/ARR) for a target update frequency (Pillar D Tier 3). Turns intent ('TIM3 at 1 kHz') into concrete register values using the timer input clock (TIMxCLK) derived from the solved clock tree. Record a target via design_framework(design={'TIM3': {'update_hz': 1000}}) then run solve_clock_tree first, or pass timer_clock_hz directly for a what-if. Deterministic and honest: an exact target yields zero-error PSC/ARR, an inexact one yields the closest pair plus the achieved frequency and ppm error, and an unrepresentable target or an unknown timer bus is surfaced, never guessed. Injects the result into the plan so render_framework emits concrete values instead of a TODO.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
busNoOverride the timer's APB bus: 'apb1' or 'apb2'.
loadNoPersist the solved PSC/ARR into the plan (default true).
timerNoTimer to solve, e.g. 'TIM3'. Omit to solve every timer that has a recorded target.
sessionNoTarget session id (default 'default').
arr_bitsNoARR width override: 16 or 32 (for 32-bit timers TIM2/TIM5).
target_hzNoTarget update frequency in Hz; overrides the recorded design target (requires timer).
timer_clock_hzNoExplicit TIMxCLK in Hz; bypasses the clock-solution + bus derivation (pure what-if).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.1

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations (readOnly=false), it discloses that the tool injects results into the plan (a mutation), how it handles exact/inexact/unrepresentable targets, and that unknown timers are surfaced rather than guessed. This is rich, non-obvious behavioral context that the structured fields do not provide.

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?

Front-loaded with the core purpose, then workflow and behavior. Mostly earns its space, though minor jargon ('Pillar D Tier 3') adds little. Slightly dense but well-organized.

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?

With no output schema, the description carries the return-value burden and does so: it explains the result shape (zero-error PSC/ARR, closest pair with achieved frequency and ppm error) and the downstream effect on render_framework. Nothing essential for 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 100%, so parameters are already documented (baseline 3). The description adds the relationship between parameters, describing timer_clock_hz as a what-if bypass of clock derivation and target_hz as an override path, which sharpens usage beyond the schema text.

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?

States a specific verb and resource ('Solve a timer's Prescaler/Period'), names the exact intent-to-registers transformation, and clearly distinguishes itself from siblings solve_clock_tree and design_framework. An agent can tell immediately what this produces.

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?

Gives explicit sequencing: record a target via design_framework, run solve_clock_tree first, or pass timer_clock_hz directly for a what-if. This routes the agent between prerequisites and an alternative path with no inference required.

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