This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PMP41006: pmp41006_ HAL_ setupECAP();

Part Number: PMP41006

Hi Team,

A customer is asking what is the function of the setting LLC in the reference of pmp41006_ HAL_ setupECAP(); Function.?

Kindly refer to the code below

void LLC_HAL_setupECAP(void)
{
//
// Disable ,clear all capture flags and interrupts
//
ECAP_disableInterrupt(ECAP1_BASE,
(ECAP_ISR_SOURCE_CAPTURE_EVENT_1 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_2 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_3 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_4 |
ECAP_ISR_SOURCE_COUNTER_OVERFLOW |
ECAP_ISR_SOURCE_COUNTER_PERIOD |
ECAP_ISR_SOURCE_COUNTER_COMPARE));
ECAP_clearInterrupt(ECAP1_BASE,
(ECAP_ISR_SOURCE_CAPTURE_EVENT_1 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_2 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_3 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_4 |
ECAP_ISR_SOURCE_COUNTER_OVERFLOW |
ECAP_ISR_SOURCE_COUNTER_PERIOD |
ECAP_ISR_SOURCE_COUNTER_COMPARE));

//
// Disable CAP1-CAP4 register loads
//
ECAP_disableTimeStampCapture(ECAP1_BASE);

//
// Configure eCAP
// Enable capture mode.
// Set polarity of the events to rising edge.
// Set capture in time difference mode.
// Select input from XBAR7.
// Enable eCAP module.
// Enable interrupt.
//
ECAP_stopCounter(ECAP1_BASE);
ECAP_enableCaptureMode(ECAP1_BASE);

ECAP_setCaptureMode(ECAP1_BASE, ECAP_CONTINUOUS_CAPTURE_MODE, ECAP_EVENT_1);

ECAP_setEventPolarity(ECAP1_BASE, ECAP_EVENT_1, ECAP_EVNT_RISING_EDGE);

ECAP_setEventPrescaler(ECAP1_BASE, 0); // prescale by 1

ECAP_enableCounterResetOnEvent(ECAP1_BASE, ECAP_EVENT_1);

//
// setup CMPSS5H as the ECAP input
//
ECAP_selectECAPInput(ECAP1_BASE, ECAP_INPUT_CMPSS5_CTRIP_HIGH);

ECAP_enableLoadCounter(ECAP1_BASE);
ECAP_startCounter(ECAP1_BASE);
ECAP_enableTimeStampCapture(ECAP1_BASE);

}

Thank you

Regards,

Marvin

  • Hi Marvin,

    This is initialized just for debug purpose and is not used for HHC control. 

    Regards,

    Chen

  • Hi Chen,

    Thank you for the explanation. I have a follow-up question regarding the code attached below:

    code.docx

    The follow up questions are also included on the document.

    Thanks for helping.

    Regards,

    Marvin

  • The first question is about the cmpss5h and cmpss6h operation highlighted in yellow and green

    Why is the configuration different during initialization and normal operation?

    [C] This is due to they are two different PWM modules. LLC_HAL_setupEPWM_SYNC_RAMP uses PWM8. LLC_HAL_setupEPWMActiveHighComplementary refers to PWM1. For more information on how PWM8 and PWM1 work, pls refer to the user guide in sdk.

    both functions are mainly for initializations.

    The second question is about the phase operation highlighted in purple

    Is the phase operation just to accomplish the synchronization of EPWM1 and EPWM8 under certain conditions?

    Or is there any other purpose?

    [C] Yes. Pls refer to figure 7 and figure 8 for more info.