Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jgroman/azsphere_rtcore_softpwm_example
Azure Sphere Software PWM for RTCore Application
https://github.com/jgroman/azsphere_rtcore_softpwm_example
azure-sphere mt3620 software-pwm
Last synced: about 1 month ago
JSON representation
Azure Sphere Software PWM for RTCore Application
- Host: GitHub
- URL: https://github.com/jgroman/azsphere_rtcore_softpwm_example
- Owner: jgroman
- License: mit
- Created: 2019-10-11T12:52:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-15T07:10:12.000Z (about 5 years ago)
- Last Synced: 2024-04-21T20:00:53.214Z (8 months ago)
- Topics: azure-sphere, mt3620, software-pwm
- Language: C
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generating Software PWM using Azure Sphere Real-Time Core Application
PWM (or Pulse Width Modulation) is basically a clock signal with a programmable duty cycle. PWM generator could then be decribed by using two values: clock frequency (or period) and current duty cycle percentage. This implementation uses real-time M4 core GPT timers for generating clock signal where timer duration is set depending on duty cycle value. GPT timer after running out generates interrupt and the interrupt handling routine flips GPIO state.
Since the original GPT timer setup routine supports only 1 kHz timer clock, which is probably too slow for PWM generating purposes, I have added support for GPT timer clock at maximum supported 32 kHz. See [mt3620-timer-user.c](https://github.com/jgroman/azsphere_rtcore_softpwm_example/blob/master/rtcore_softpwm_example/mt3620-timer-user.c) with added basic routines for previously unsupported GPT2 timer. GPT2 is a free-running timer and cannot be used for interrupts, but it can be very useful for time keeping as an Arduino's *millis()* and *delay()* function replacement. With this setup we can reach maximum software PWM frequencies around 5 kHz.
The repository contains complete real-time core application which demonstrates PWM function by dimming RGB LED after repeated button1 presses.