This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 0474b8d40628145c903414354bde5e6d00f45ab9 Author: Ulaş Sertan Kemeç <[email protected]> AuthorDate: Thu Sep 10 10:35:48 2026 +0300 Documentation/am67: Document eCAP APWM support on t3-gem-o1. Record the eCAP1 and eCAP2 APWM outputs in the board's Peripheral Support list. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Ulaş Sertan Kemeç <[email protected]> --- Documentation/platforms/arm/am67/boards/t3-gem-o1/index.rst | 2 ++ arch/arm/src/am67/am67_ecap.c | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/platforms/arm/am67/boards/t3-gem-o1/index.rst b/Documentation/platforms/arm/am67/boards/t3-gem-o1/index.rst index d0c276641aa..5b533d93db3 100644 --- a/Documentation/platforms/arm/am67/boards/t3-gem-o1/index.rst +++ b/Documentation/platforms/arm/am67/boards/t3-gem-o1/index.rst @@ -103,6 +103,8 @@ main-domain R5F core: - **I2C:** WKUP_I2C0 master, registered as /dev/i2c2. - **PWM:** EPWM0 and EPWM1, channels A and B each, registered as /dev/pwm0 and /dev/pwm1. +- **eCAP:** eCAP1 and eCAP2 in APWM mode, registered as /dev/ecap1 and + /dev/ecap2. Installation ============ diff --git a/arch/arm/src/am67/am67_ecap.c b/arch/arm/src/am67/am67_ecap.c index a820a37ca97..a8bfa70bb91 100644 --- a/arch/arm/src/am67/am67_ecap.c +++ b/arch/arm/src/am67/am67_ecap.c @@ -368,9 +368,8 @@ static void am67_ecap_park(struct am67_ecap_s *priv) * Name: am67_ecap_setup * * Description: - * First-open configuration: PID check, pad mux, frozen APWM mode, and a - * counter reset. All eCAP register access is here (on open) rather than - * Configure the output pad. No output until start(). + * First-open configuration: configure the output pad. No output until + * start(). * * Returned Value: * Zero (OK). @@ -431,8 +430,10 @@ static int am67_ecap_start(struct pwm_lowerhalf_s *dev, int8_t ch; int i; - am67_ecap_config_apwm(priv->base); - am67_ecap_reset_counter(priv->base); + /* config_apwm() clears TSCNTSTP (stops the counter) and reset_counter() + * zeroes it, so both run only on a frequency change below - a duty-only + * start() must not disturb the running counter. + */ /* Validate the channel array (only channel 1 exists) and read its duty. */ @@ -504,6 +505,7 @@ static int am67_ecap_start(struct pwm_lowerhalf_s *dev, if (freq_changed) { + am67_ecap_config_apwm(priv->base); am67_ecap_counter_freeze(priv->base); am67_ecap_write_immediate(priv->base, period - 1u, compare); am67_ecap_reset_counter(priv->base);
