Repository navigation
test(renesas): pin POSR/PORR/PODR halfword addresses to the RA4M1 manual - #5409
Merged
Merged
Conversation
…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
enabled auto-merge
November 22, 2026 04:20
|
Warning Review limit reachedYou'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. View limit details
Note
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):PORTm + 0x08and POSR atPORTm + 0x0A. In the 32-bit PCNTR3 view, POSR is bits [15:0] and PORR bits [31:16].+0x00and PDR at+0x02, while the 32-bit view has PDR in [15:0] and PODR in [31:16].So the manual has exactly the split the BSP header
R7FA4M1AB.hhas: 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:SoftwareSerialwrites 32-bitPCNTR3 = (clr << 16) | set(TX) and reads PIDR from bits [15:0] of a 32-bitPCNTR2(RX). That matches the 32-bit bitfields.Arduino_LED_Matrixtri-states pins by clearing the low half of 32-bitPCNTR1. That is PDR in [15:0]; the charlieplexed matrix only works if those pins float.PODRat+0x00. Users report it drives WS2812 strips (Porting for Arduino UNO R4 please. #1538, Doesn't work with Uno R4 Minima #1507, UNO R4 WiFi NeoPixel interrupts(?) cause artifacts on a strip #1543). If+0x00were PDR, the data line would toggle direction, never drive high, and the strip would stay dark._ARMPIN::hi()therefore writes POSR (+0x0A),lo()writes PORR (+0x08) andport()is PODR (+0x00). That matches the manual's 16-bit address list. Thesport()/cport()software-SPI path and the clocklessPODRwrite are correct.Test
tests/unit/platforms/arm/renesas/renesas_pin.cpp:R_PORT0_Typenow mirrors the BSP halfword layout (PODR, PDR, EIDR, PIDR, PORR, POSR).port(),cport()andsport()resolve toPORT1 + 0x0,+ 0x8and+ 0xA.Evidence:
sport()/cport()swapped inrenesas_pin.h, the new case fails (FAIL: Renesas hi, lo and port use the RA4M1 halfword addresses, 6/7 passed).bash test renesas_pinand--debugpass, andbash lint --cppis 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