Use PWMs in real-time capable applications
Azure Sphere supports Pulse Width Modulation. Pulse-width modulation is achieved by varying the duty cycle (ratio of on-time to off-time) of a pulsed digital signal. Pulse-width modulators (PWMs) are used in a wide range of applications such as digital motor control, communication, and digital-to-analog conversion.
This topic describes how to use PWMs in real-time capable applications (RTApp). For information about using PWMs in high-level applications, see Using PWM in high-level applications.
Note
The Azure Sphere OS does not reset peripherals on start-up. Your applications should ensure that peripherals are in a known-good state on start-up or after restart.
MT3620 support for PWM on the real-time cores
This section describes the PWM options that only apply when running Azure Sphere on the MT3620.
The PWM features that the MT3620 supports are listed in MT3620 Support Status. The MT3620 development board user guide describes the pin layout and pin functions.
The MT3620 has 12 PWM channels, identified by PWM0-PWM11. They are organized into 3 groups of 4 channels. Each group is associated with a PWM controller (PWM-CONTROLLER-0, PWM-CONTROLLER-1, PWM-CONTROLLER-2). The PWM channels and GPIO pins GPIO0 through GPIO11 map to the same pins on the MT3620. If your application uses a PWM controller all of the pins associated with that controller are allocated for use as PWM outputs. None of them can be used for GPIO.
For register base addresses, interrupt numbers, clock rate, sampling frequency, and other details about the MT3620, see the MT3620 Datasheet and the MT3620 M4 User Manual; if questions remain, you can request details from Avnet by emailing Azure.Sphere@avnet.com.
Application manifest settings
To use a PWM in an RTApp you add the Pwm capability to the application manifest and specify the PWM controllers that will be used in the application. For example, the following line specifies PWM controller 0 for use in an RTApp that targets the MT3620 reference development board (RDB):
"Capabilities": {
"Pwm": [ "PWM-CONTROLLER-0" ] }
Azure Sphere application manifest has more details about the application manifest.
The PWM sample applications
The CodethinkLabs repository on GitHub contains a number of sample applications that demonstrate how to use MT3620 supported peripherals in Azure Sphere real-time capable applications. Specifically, the PWM_RTApp_MT3620_BareMetal sample demonstrates how to incorporate a PWM peripheral in a real-time capable application.
Povratne informacije
Pošalјite i prikažite povratne informacije za