Skip to content

test(renesas): pin POSR/PORR/PODR halfword addresses to the RA4M1 manual - #5409

Merged
zackees merged 1 commit into
masterfrom
fix/5107-renesas-posr-porr
Nov 22, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/5107-renesas-posr-porr

Conversation

@zackees

@zackees zackees commented Nov 22, 2026

Copy link
Copy Markdown
Member

Resolves #5107: the polarity on master is correct, so no code change. This adds a host test that pins the halfword addresses.

Finding

RA4M1 hardware manual R01UH0887EJ0110 Rev.1.10 (FastLED/datasheets renesas/mcu/RA4M1/user-manual.pdf):

  • sec. 19.2.3, p. 359 (PCNTR3/PORR/POSR): PORR is at PORTm + 0x08 and POSR at PORTm + 0x0A. In the 32-bit PCNTR3 view, POSR is bits [15:0] and PORR bits [31:16].
  • sec. 19.2.1, p. 357 (PCNTR1/PODR/PDR): the same pattern. PODR is at +0x00 and PDR at +0x02, while the 32-bit view has PDR in [15:0] and PODR in [31:16].
  • Table 2.1 (p. 77) and sec. 14.2.4 (p. 254): the RA4M1 is little-endian only.

So the manual has exactly the split the BSP header R7FA4M1AB.h has: the 32-bit bitfields put the set/direction half low, and the 16-bit addresses put PODR/PORR at the lower address. On a little-endian part both can only hold if the port block decodes halfword accesses by the documented addresses. Shipping code agrees with both views:

_ARMPIN::hi() therefore writes POSR (+0x0A), lo() writes PORR (+0x08) and port() is PODR (+0x00). That matches the manual's 16-bit address list. The sport()/cport() software-SPI path and the clockless PODR write are correct.

Test

tests/unit/platforms/arm/renesas/renesas_pin.cpp:

  • The fake R_PORT0_Type now mirrors the BSP halfword layout (PODR, PDR, EIDR, PIDR, PORR, POSR).
  • A new case checks that port(), cport() and sport() resolve to PORT1 + 0x0, + 0x8 and + 0xA.

Evidence:

  • RED (mutation): with sport()/cport() swapped in renesas_pin.h, the new case fails (FAIL: Renesas hi, lo and port use the RA4M1 halfword addresses, 6/7 passed).
  • GREEN: after the mutation was reverted, bash test renesas_pin and --debug pass, and bash lint --cpp is clean.

Limitation

Not measured on a device: no UNO R4 is attached. The halfword decode is inferred from the manual's address tables plus the behaviour of shipped code, not from a scope capture.

Closes #5107

…ual (#5107)

RA4M1 manual sec. 19.2.1/19.2.3 place 16-bit PODR at +0x0, PORR at +0x8
and POSR at +0xA. hi()/lo()/port() already use those; the new case
compares the real accessors' addresses so a polarity swap fails.
@zackees
zackees enabled auto-merge November 22, 2026 04:20
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3e47d49 and 78e32d7.

Files selected for processing: 1

  • tests/unit/platforms/arm/renesas/renesas_pin.cpp

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 22, 2026
@github-actions github-actions Bot added the sanitized Title, body and conversation screened; review text requires separate screening. label Nov 22, 2026
@zackees
zackees added this pull request to the merge queue Nov 22, 2026
Merged via the queue into master with commit efa3226 Nov 22, 2026
127 of 128 checks passed
@zackees
zackees deleted the fix/5107-renesas-posr-porr branch November 22, 2026 04:29
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanitized Title, body and conversation screened; review text requires separate screening.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Renesas RA: confirm POSR/PORR halfword polarity on hardware

1 participant