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.

CCS/LAUNCHXL-F28069M: motor control ESC witch eCAP2

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: BOOSTXL-DRV8305EVM, TIDA-00643, MOTORWARE

Tool/software: Code Composer Studio

I designed my ESC board refering to the launchpad-28069M and the BoostXL-Drv8305EVM.

Now I want to add a PWM signal input into my board as the speed command,just like the usual ESC.

and I refer to the TIDA-00643 motorware .

Now my trouble is my board have no Ecap1,just have a Ecap2.

so I have no choice to select the Ecap2 as the PWM input.

Now I have done :
1. Set GPIO25 to eCAP function in HAL_setParams()->HAL_setupGpios() in hal.c, 
GPIO_setMode(obj->gpioHandle,GPIO_Number_25,GPIO_19_Mode_ECAP2);
2. Enable eCAP2clock in HAL_setParams()->HAL_setupPeripheralClks() in hal.c
CLK_enableEcap2Clock(obj->clkHandle);
3. Set up the eCAP2 module by adding below function in hal.c

// ECAP
void HAL_setupeCAP(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *) handle;

CAP_setModeCap(obj->capHandle); // set mode to CAP

//Disables counter synchronization
CAP_disableSyncIn(obj->capHandle);

//Sets the capture event polarity
CAP_setCapEvtPolarity(obj->capHandle, CAP_Event_1, CAP_Polarity_Rising);

//Sets the capture event polarity
CAP_setCapEvtPolarity(obj->capHandle, CAP_Event_2, CAP_Polarity_Falling);

//Sets the capture event counter reset configuration
CAP_setCapEvtReset(obj->capHandle, CAP_Event_1, CAP_Reset_Disable);

//Sets the capture event counter reset configuration (reset counting here)
CAP_setCapEvtReset(obj->capHandle, CAP_Event_2, CAP_Reset_Enable);

// continous timer
CAP_setCapContinuous(obj->capHandle);

//Set the stop/wrap mode to 2 events
CAP_setStopWrap(obj->capHandle, CAP_Stop_Wrap_CEVT2);

//Enables loading of CAP1-4 on capture event
CAP_enableCaptureLoad(obj->capHandle);

// Enables Time Stamp counter to running
CAP_enableTimestampCounter(obj->capHandle);

//Enables capture (CAP) interrupt source
CAP_enableInt(obj->capHandle, CAP_Int_Type_CEVT2);

// enable eCAP interrupt
PIE_enableInt(obj->pieHandle, PIE_GroupNumber_4, PIE_InterruptSource_ECAP1);

// enable CPU ECAP Group interrupts
CPU_enableInt(obj->cpuHandle, CPU_IntNumber_4);

return;
} // end of HAL_setupCAP() function

but the HAL_setupeCAP() function is use the eCAP1,if I use the eCAP2 ,I do not know how configue the REG in HAL_setupeCAP() .

other need to be changed if I use the eCAP2?for example in the _interrupt void ecapISR?

thanks