> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Peripheral registers

> Look up a register's address, fields, and reset value, check firmware against it, and compare with a live target value.

Use register lookup to find peripheral addresses, bit fields, access rules, and reset values for your project's MCU. It works from the register definitions for the project's selected [platform](/docs/core-concepts/hardware-catalog.md). When definitions are available, Inlay loads them when you open the project.

Register lookup describes the device. A live value comes from a separate debugger reading.

## Look up a definition

```text theme={"system"}
Look up RCC CR for the selected MCU. Show its address, width, access type,
reset value, and bit fields.
```

You can ask in three ways:

| Ask by | Example | You get |
| - | - | - |
| Peripheral and register | "Look up RCC CR" | The register's address, offset, width, access, reset value, and fields |
| Peripheral | "List the GPIOA registers" | The peripheral's base address and each register's address, width, and access |
| Purpose or keyword | "Find the reset-cause register for this MCU" | Matching registers, with full detail when there are only a few |

Field details include bit positions, field access, and named values when the definitions provide them. If a name is close but not exact, Inlay suggests the nearest match. Check the suggested register against the exact target before you read hardware.

When the project has several devices or cores, results are labeled with the device name. Name the one you mean.

## Read the live state

1. Look up the register's device, address, width, and access rules.
2. If a reset or programming would destroy evidence, use an existing debugger session, or review the [attachment precautions](/docs/debug-mode/gdb.md#attach-to-a-running-target) before asking for attach-only.
3. Read the live value. The target must be halted for the read, so a running target is interrupted first.
4. Decode the value using fields from the same device's definitions.

```text theme={"system"}
Attach without programming or resetting. Read the reset-cause register once,
decode the asserted fields, and leave them unchanged.
```

> [!WARNING]
>
> Some registers clear on read or have write-one-to-clear fields. Check the device reference before reading or modifying them. A generic read-modify-write can change unrelated flags.

## Check firmware against the definitions

When Inlay writes or edits C, C++, Rust, or Python source, it checks the changed lines against the register definitions. It flags:

* Writes to read-only registers.
* Reads from write-only registers.
* Peripheral names, register names, or addresses that don't match any known register.

You can also ask for a review of existing code:

```text theme={"system"}
Compare @src/clock.c with the selected MCU's clock-control fields. Identify
writes to reserved or read-only fields and explain any mismatch.
```

These checks find inconsistencies with the available definitions. They don't establish that clocks, synchronization, or power sequencing are correct.

## Troubleshoot

* **No register definitions:** Inlay can't look up registers until definitions load for the project's platform. Check the platform, then reopen the project. Some platforms have no definitions; use the device reference manual instead.
* **Name is missing:** search by function or keyword, then check the suggested device and register.
* **Address disagrees with the manual:** check the device, core, and revision before using it.
* **A field is absent:** consult the exact device reference rather than inventing a mask.
* **Reset value differs from hardware:** boot code, firmware, or debugger actions may already have changed it.

See [GDB debugging](/docs/debug-mode/gdb.md) for attachment and memory inspection.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.