Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/gd32v: add periph_pwm support #19209

Merged
merged 8 commits into from
Jan 29, 2023
Merged

Conversation

gschorcht
Copy link
Contributor

Contribution description

This PR provides the periph_pwm support for GD32VF103.

It includes a bug fix (2c6e527) of periph_timer which clears pending interrupts on setting the timer before the interrupt is enabled. This avoids that a pending interrupt is triggered immediately when the timer is set. The bug caused tests/periph_timer and tests/periph_timer_periodic to crash. (I could split-off this bug fix if necessary).

Furthermore, the default timer configuration has been extended and reordered. TIMER0 can be used now as timer device (0dfbdeb). The default timer configuration has been changed (377b5b3) so that TIMER0 and TIMER1 are always timer devices. TIMER2 can only be used as timer device if it is not used for PWM devices. TIMER3 and TIMER4 are only available as timer devices if they are supported by the CPU model and not used for PWM devices.

Testing procedure

  • tests/periph_timer and tests/periph_timer_periodic should work now. Without the PR, these tests lead to kernel panic.
  • tests/periph_pwm should work on any GD32VF103 board. Command osci should also let LED1 and LED2 oscillate.

Issues/PRs references

When a timer is set, any pending interrupts must be cleared before the interrupt is enabled for the channel. Otherwise the interrupt would be triggered immediately when the timer is set.
The default timer configuration has been changed so that `TIMER0` and `TIMER1` are always timer devices. `TIMER2` can only be used as timer device if it is not used for PWM devices. `TIMER3` and `TIMER4` are only available as timer devices if they are supported by the CPU model and not used for PWM devices.
@github-actions github-actions bot added Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: tools Area: Supplementary tools labels Jan 28, 2023
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 29, 2023
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors merge

@bors
Copy link
Contributor

bors bot commented Jan 29, 2023

🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@riot-ci
Copy link

riot-ci commented Jan 29, 2023

Murdock results

✔️ PASSED

608a412 dist/tools/doccheck: add PWM config to generic exclude pattern

Success Failures Total Runtime
6796 0 6796 07m:01s

Artifacts

@bors
Copy link
Contributor

bors bot commented Jan 29, 2023

Build succeeded:

@bors bors bot merged commit 4c1e5c7 into RIOT-OS:master Jan 29, 2023
@gschorcht
Copy link
Contributor Author

@benpicco Thanks for reviewing and merging

@gschorcht gschorcht deleted the cpu/gd32v/periph_pwm branch January 29, 2023 11:03
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.04 milestone Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants