Part Number: AM263P4
Other Parts Discussed in Thread: AM2634, TIDM-02018
Hi,
I am using the AM2634 MCU and have three GPIO inputs (U, V, W) that determine which of three ePWM channels should be active.
I am currently reading the GPIO states in a continuous loop and changing the ePWM configuration based on the GPIO combination.
The basic implementation is:
while (1)
{
gpioValue = GPIO_pinRead(gGpioBaseAddr, pinNum); /* U */
gpioValue2 = GPIO_pinRead(gGpioBaseAddr2, pinNum2); /* V */
gpioValue3 = GPIO_pinRead(gGpioBaseAddr3, pinNum3); /* W */
if ((gpioValue == 1) && (gpioValue2 == 0) && (gpioValue3 == 0))
{
EPWM_configureSignal(gEpwm1Base, &pwmSignal_off);
EPWM_configureSignal(gEpwm2Base, &pwmSignal);
EPWM_configureSignal(gEpwm3Base, &pwmSignal_off);
/* GPIO outputs are also updated here */
}
/* Other GPIO combinations are handled similarly */
else if ((gpioValue == 0) &&
(gpioValue2 == 0) &&
(gpioValue3 == 0))
{
EPWM_configureSignal(gEpwm1Base, &pwmSignal_off);
EPWM_configureSignal(gEpwm2Base, &pwmSignal_off);
EPWM_configureSignal(gEpwm3Base, &pwmSignal_off);
}
ClockP_usleep(375);
}
Problem
The ePWM output does not switch reliably or as expected when I remove the:
ClockP_usleep(375);
When the 375 µs delay is present, I can observe the expected PWM output. However, the switching response is slow.
If I remove the delay, I expect the PWM channels to switch immediately according to the GPIO input states, but the PWM output does not behave as expected.
I would like to understand why this delay appears to be necessary.
Questions
-
Why is
ClockP_usleep(375)required for the PWM output to appear correctly? -
Is
EPWM_configureSignal()intended to be called repeatedly during runtime, or should it only be used during ePWM initialization? -
What is the recommended AM2634 ePWM API/function for fast runtime switching between PWM channels?
-
Should the ePWM modules be configured once and then controlled using lower-level ePWM functions/registers for fast switching?
-
What type of ePWM configuration is recommended if I need to change the active PWM channel based on GPIO inputs with minimum latency?
-
Is there a recommended way to update the ePWM output using shadow registers, compare registers, Action Qualifier, Trip Zone, or another ePWM hardware mechanism?
-
Is there a recommended function flow for achieving fast GPIO-state-to-PWM switching without using a software delay such as
ClockP_usleep()?
The main issue I am trying to resolve is the latency and dependency on ClockP_usleep(375). I would appreciate guidance on the appropriate AM2634 ePWM configuration and runtime API for this use case.
Thank you,
ANBURAJA A.