Part Number: TM4C1294NCPDT
Tool/software: TI-RTOS
Hi Everyone,
I am working on an application in which one task need to generate PWM signal with frequency ranging from 0.25Hz to 25Hz (Period value ranging from 40 to 4000 millisecond).
Following is my configuraion
1) PWM Hardware Attributes code snippet:
const PWMTiva_HWAttrs pwmTivaHWAttrs[EK_TM4C1294XL_PWMCOUNT] = {
{
.baseAddr = PWM0_BASE,
.pwmOutput = PWM_OUT_0,
.pwmGenOpts = PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN
},
{
.baseAddr = PWM0_BASE,
.pwmOutput = PWM_OUT_1,
.pwmGenOpts = PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN
},
{
.baseAddr = PWM0_BASE,
.pwmOutput = PWM_OUT_2,
.pwmGenOpts = PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN
},
};
const PWM_Config PWM_config[] = {
{
.fxnTablePtr = &PWMTiva_fxnTable,
.object = &pwmTivaObjects[0],
.hwAttrs = &pwmTivaHWAttrs[0]
},
{
.fxnTablePtr = &PWMTiva_fxnTable,
.object = &pwmTivaObjects[1],
.hwAttrs = &pwmTivaHWAttrs[1]
},
{
.fxnTablePtr = &PWMTiva_fxnTable,
.object = &pwmTivaObjects[2],
.hwAttrs = &pwmTivaHWAttrs[2]
},
{NULL, NULL, NULL}
};
2) PWM Pin Mux and GPIO configurations
void EK_TM4C1294XL_initPWM(void)
{
/* Enable PWM module 0 */
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
GPIOPinConfigure(GPIO_PF0_M0PWM0);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0);
GPIOPinConfigure(GPIO_PF1_M0PWM1);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOPinConfigure(GPIO_PF2_M0PWM2);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2);
PWM_init();
}
3) EK_TM4C1294XL.h enum updating with three PWM outputs.
typedef enum EK_TM4C1294XL_PWMName {
EK_TM4C1294XL_PWM0 = 0,
EK_TM4C1294XL_PWM1,
EK_TM4C1294XL_PWM2,
EK_TM4C1294XL_PWMCOUNT //=3
} EK_TM4C1294XL_PWMName;
4) PWM Configuration parameters
Tried these two modes:
1) PWM duty mode: PWM_DUTY_TIME: Period and duty cycle value assigned in microseconds.
2) PWM duty mode: PWM_DUTY_SCALAR: Calculation:
duty_cycle_percentage = ((On_time * 1000) / ((On_time + Off_time) *1000)) * 100
duty_cycle_scalar = (65535 * Duty_cycle_percentage) / 100
PWM_setDuty(pwmHandle, duty_cycle_scalar);
Problem: With Period value ranging from 40 to 68 milliseconds (Frequency 25Hz to 14.705Hz), I am able to generate PWM signal. But when I am trying for period value equal to 70 millisecond and above(Frequency 14.28Hz and below), PWM signal line becomes high and no change after that.
I wanted to know, Can PWM module generate this low frequency signal? If yes, what configurations do I need to do in TI-RTOS project to achieve this low frequency.
And PWM signal with 20 millisecond duty cycle, DSO shows value as 10ms duty cycle. I am not sure, why this is happening.
Any help will be really appreciated. Thanks in advance.