PWM driver implementation for Low Power F3 devices.
The general PWM API should be used in application code, i.e. PWM_open() should be used instead of PWMTimerLPF3_open(). The board file will define the device specific config, and casting in the general API will ensure that the correct device specific functions are called.
Before using PWM on LPF3:
If unsupported arguments are provided to an API returning an error code, the PWM configuration will not be updated and PWM will stay in the mode it was already configured to.
The SimpleLink power management framework will try to put the device into the most power efficient mode whenever possible. Please see the technical reference manual for further details on each power mode.
The PWMTimerLPF3.h driver is not explicitly setting a power constraint when the PWM is running to prevent standby as this is assumed to be done in the underlying LGPTimer driver. The following statements are valid:
The PWM output period and duty cycle are limited by the underlying timer. The LGPT peripherals have the following counter widths:
Note that some LPF3 device types do not support all four LGPT peripherals.
The frequency of the underlaying timer counter can be divided by configuring the preScalerDivision element of the PWMTimerLPF3_HwAttrs struct. This configuration can be used to extend the PWM signal period but will decrease the accuracy. The minimum obtainable PWM signal frequency is dependent on the width of the counter for the LGPT peripheral used and the configured preScalerDivision value. When using the LGPT3 peripheral with the default preScalerDivision value of 1, the minimal frequency is 48MHz / (2^24-1) = 2.86Hz (349.525ms).
When using high output frequencies the duty cycle resolution is reduced correspondingly. For a 24MHz PWM only a 0%/50%/100% duty is available as the timer uses only counts 0 and 1. Similarly for a 12MHz period the duty cycle will be limited to a 12.5% resolution.
The below example will output a 8MHz PWM signal with 50% duty cycle.
#include <stdint.h>
#include <stdbool.h>
#include <ti/drivers/PWM.h>
#include <ti/drivers/timer/LGPTimerLPF3.h>
Go to the source code of this file.
Data Structures | |
struct | PWMTimerLPF3_HwAttrs |
PWMTimerLPF3 Hardware attributes. More... | |
struct | PWMTimerLPF3_Object |
PWMTimerLPF3 Object. More... | |
Macros | |
PWMTimerLPF3 specific control commands and arguments | |
#define | PWMTimerLPF3_CMD_DEBUG_STALL |
Arguments for PWMTimerLPF3_CMD_DEBUG_STALL | |
#define | CMD_ARG_DEBUG_STALL_OFF |
#define | CMD_ARG_DEBUG_STALL_ON |
Typedefs | |
typedef struct PWMTimerLPF3_HwAttrs | PWMTimerLPF3_HwAttrs |
PWMTimerLPF3 Hardware attributes. More... | |
typedef struct PWMTimerLPF3_Object | PWMTimerLPF3_Object |
PWMTimerLPF3 Object. More... | |
Variables | |
const PWM_FxnTable | PWMTimerLPF3_fxnTable |
#define PWMTimerLPF3_CMD_DEBUG_STALL |
Timer debug stall mode (stop PWM output debugger halts CPU) When enabled, PWM output will be HIGH when CPU is halted
#define CMD_ARG_DEBUG_STALL_OFF |
#define CMD_ARG_DEBUG_STALL_ON |
typedef struct PWMTimerLPF3_HwAttrs PWMTimerLPF3_HwAttrs |
PWMTimerLPF3 Hardware attributes.
These fields are used by the driver to set up the underlying LGPTimer driver statically.
typedef struct PWMTimerLPF3_Object PWMTimerLPF3_Object |
PWMTimerLPF3 Object.
These fields are used by the driver to store and modify PWM configuration during run-time. The application must not edit any member variables of this structure. Appplications should also not access member variables of this structure as backwards compatibility is not guaranteed.
const PWM_FxnTable PWMTimerLPF3_fxnTable |