Skip to content

boards/arm/ht32f491x3: Add PWM support for the HT32F49163 Starter Kit board#18649

Open
FelipeMdeO wants to merge 1 commit intoapache:masterfrom
FelipeMdeO:feature/esk32-add-pwm
Open

boards/arm/ht32f491x3: Add PWM support for the HT32F49163 Starter Kit board#18649
FelipeMdeO wants to merge 1 commit intoapache:masterfrom
FelipeMdeO:feature/esk32-add-pwm

Conversation

@FelipeMdeO
Copy link
Copy Markdown
Contributor

@FelipeMdeO FelipeMdeO commented Mar 30, 2026

Summary

This PR adds PWM support for the HT32F491x3 ESK32 board.

Changes included:

add HT32F491x3 TMR3 PWM lower-half driver support
register /dev/pwm0 on the ESK32 board
add board-level PWM pin mapping for TMR3 channels 1 to 4
add esk32:pwm configuration for board-level PWM validation
document PWM support, pin mapping, and test procedure for ESK32

Impact

Is new feature added? Yes
Impact on user: esk32:pwm now provides /dev/pwm0 and the pwm example application for board-level PWM testing
Impact on build: No global build changes
Impact on hardware: Yes, ARM/HT32F491x3 ESK32 board support
Impact on documentation: Yes
Impact on security: No

Testing

./tools/configure.sh -l esk32:pwm
make olddefconfig
make -j all
/dev/pwm0 registered successfully
PWM generation tested by invoking the pwm example from NSH
command used: `pwm -f 1000 -d 50 -t 5`
PWM output probed on PA6 with a logic analyzer
1 kHz PWM generated on PA6 with 50% duty cycle as expected
PWM start and stop behavior matched the requested command duration

@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Arch: arm Issues related to ARM (32-bit) architecture Size: L The size of the change in this PR is large Board: arm labels Mar 30, 2026
@FelipeMdeO
Copy link
Copy Markdown
Contributor Author

Hello @xiaoxiang781216 , @acassis , @linguini1 . I am working with this board daily, so I am porting drivers step by step.
I hope add pwm, pulse counter, i2c, dma and usb drivers during the next weeks.

@simbit18
Copy link
Copy Markdown
Contributor

Hi @FelipeMdeO please fix

====================================================================================
Configuration/Tool: esk32/pwm,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-03-30 03:54:15
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
  [1/1] Normalize esk32/pwm
24,26d23
< CONFIG_EXAMPLES_PWM_DEVPATH="/dev/pwm0"
< CONFIG_EXAMPLES_PWM_DUTYPCT=50
< CONFIG_EXAMPLES_PWM_DURATION=5
33d29
< CONFIG_HT32F491X3_TMR3_CHANNEL=1
Saving the new configuration file
HEAD detached at pull/18649/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/arm/ht32f491x3/esk32/configs/pwm/defconfig

no changes added to commit (use "git add" and/or "git commit -a")
====================================================================================

@FelipeMdeO FelipeMdeO force-pushed the feature/esk32-add-pwm branch from 9dbbd23 to ffb5c68 Compare March 30, 2026 11:41
@FelipeMdeO FelipeMdeO marked this pull request as draft March 31, 2026 02:29
@FelipeMdeO FelipeMdeO force-pushed the feature/esk32-add-pwm branch from ffb5c68 to 9c3c69c Compare March 31, 2026 02:44
@github-actions github-actions bot added Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. and removed Size: L The size of the change in this PR is large labels Mar 31, 2026
@FelipeMdeO FelipeMdeO force-pushed the feature/esk32-add-pwm branch 2 times, most recently from 6d8b785 to 12a7ad2 Compare March 31, 2026 11:44
acassis
acassis previously approved these changes Mar 31, 2026
@acassis acassis requested review from linguini1 and raiden00pl March 31, 2026 11:46
@FelipeMdeO
Copy link
Copy Markdown
Contributor Author

Hello @acassis , I can't understand pipeline issue, can you help me, please?

@acassis
Copy link
Copy Markdown
Contributor

acassis commented Mar 31, 2026

@FelipeMdeO I think you need to normalize this config:
boards/arm/ht32f491x3/esk32/configs/pwm/defconfig

More info: https://nuttx.apache.org/docs/latest/components/tools/refresh.html

@simbit18 could you please take a look too?

The CI is not clear what the issue is

linguini1
linguini1 previously approved these changes Mar 31, 2026
Use static lower-half instances per timer and select the channel
through Kconfig and board data instead of passing runtime PWM
routing into the driver.

This keeps the HT32 PWM support aligned with the existing NuttX
pattern and documents the esk32 single-device TMR3 routing.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
@FelipeMdeO FelipeMdeO dismissed stale reviews from linguini1 and acassis via f5dd77e April 2, 2026 02:45
@FelipeMdeO FelipeMdeO force-pushed the feature/esk32-add-pwm branch from 12a7ad2 to f5dd77e Compare April 2, 2026 02:45
@FelipeMdeO FelipeMdeO marked this pull request as ready for review April 2, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: Documentation Improvements or additions to documentation Board: arm Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants