leocafonso opened a new pull request, #20426:
URL: https://github.com/apache/nuttx/pull/20426
## Summary
* Adds the General PWM Timer (GPT) as a generic `/dev/timerN` timer driver
for the RA8M1 (`arch/arm/src/ra8m1/ra_gpt.c`), registers GPT0 and GPT9
on the EK-RA8M1 board, and adds a GPIO expander board driver that
exposes the Arduino Uno shield header's D2-D13 as `/dev/gpio0-11`
(`boards/arm/ra8m1/ek-ra8m1/src/ra8m1_gpio.c`).
* Related NuttX Issue: N/A (no existing issue tracks this).
* Related NuttX Apps PR: N/A (no apps-repo changes; `timer_gpio` is a
pre-existing example, only its board-level Kconfig/defconfig wiring
is new).
## Impact
* Is new feature added? YES -- GPT generic timer driver
(`CONFIG_RA_GPT_TIMER`,
per-channel `CONFIG_RA_GPTn_GPT`), and a GPIO expander board driver
for the EK-RA8M1's Arduino header (`CONFIG_DEV_GPIO`).
* Impact on user? NO -- all new Kconfig options default to `n`; nothing
changes for configurations that don't enable them.
* Impact on build? NO -- new source files are conditionally compiled
only when their Kconfig option is enabled.
* Impact on hardware? YES -- arch/ra8m1 (new `ra_gpt.c`/`ra_gpt.h`/
`hardware/ra8m1_gpt.h`, and a restructured ICU event enum in
`ra8m1_irq.h` so GPT's events get their own slots without colliding
with SCI_B's) and boards/ek-ra8m1 (new `ra8m1_gpio.c`, GPT
registration in `ra8m1_bringup.c`) are changed. No other
architecture or board is affected.
* Impact on documentation? YES -- updated
`Documentation/platforms/arm/ra8m1/index.rst` (GPT section) and
`Documentation/platforms/arm/ra8m1/boards/ek-ra8m1/index.rst`
(Arduino shield GPIO mapping, Timers section, new `timer-gpio`
config entry).
* Impact on security? NO.
* Impact on compatibility? NO -- purely additive, opt-in via Kconfig.
## Testing
I confirm that changes are verified on local setup and works as intended:
* Build Host(s): Linux, x86_64, GCC (host), CMake 4.3.2 + Ninja 1.11.1
(NuttX's CMake build system).
* Target(s): arm (Cortex-M85), `ek-ra8m1:nsh`, `ek-ra8m1:timer-gpio`.
Toolchain: GNU Arm Embedded Toolchain (`arm-none-eabi-gcc`).
* Flashed via `rfp-cli` (Renesas Flash Programmer CLI) over SWD through
the board's on-board J-Link, i.e. real hardware, not QEMU/simulation.
* Tested with `apps/examples/timer_gpio` (GPT0 and GPT9, both toggling a
GPIO pin once per period, observed on a logic analyzer) and with
`apps/examples/timer_period`, which changes a *running* timer's
period and toggles a tick pin plus a marker pin -- this is what
caught the GTPBR corruption bug below.
* Also tested the GPIO board driver directly with `apps/examples/gpio`
on all 12 Arduino-header pins (`/dev/gpio0-11`)
nsh> timer_period -t /dev/timer0
Period A=10000 us, B=5000 us, 5 s each
Tick pin /dev/gpio5, marker pin /dev/gpio6
running at A flags=3 timeout=10000 timeleft=9988
tick flags=3 timeout=10000 timeleft=30797669
-> change to B while running
running at B flags=3 timeout=5000 timeleft=30797233
tick flags=3 timeout=5000 timeleft=25787669
-> change back to A while running
running at A again flags=3 timeout=10000 timeleft=25787235
tick flags=3 timeout=10000 timeleft=20777669
-> try an invalid timeout (0)
SETTIMEOUT 0 failed: 22
after invalid timeout flags=3 timeout=10000 timeleft=20777097
stopped flags=2 timeout=10000 timeleft=10000
(note the implausible `timeleft` values after the first "tick", and the
tick GPIO pin, observed separately on a scope, stuck high instead of
continuing to toggle.)
Testing after the fix: confirmed working correctly across multiple
sessions at 10 us, 30 us and 60 us periods, including live period
changes while running, with the tick pin continuing to toggle
normally and `GETSTATUS` reporting sane `timeleft` values throughout
(hands-on hardware confirmation; not re-pasted as a literal log here).
## PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [ ] My PR adheres to Contributing Guidelines and Documentation (git commit
title and message,
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]