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.
Hi,
I have enabled RTI and EPWM for ADC notification in the halcogen configuration. I can see the RTI Interupt being triggered in the RTI notification function ,but I cannot see the ADC notification is triggered by the EPWM event. We are trying with no RTOS option.
I am trying to read the ADC value in ADC notification.
following is the code init and while loop.
_enable_IRQ();
_enable_interrupt_();
/* Setup ADCs */
adcStartConversion(adcREG1, adcGROUP1);
adcStartConversion(adcREG2, adcGROUP1);
// adcStartConversion(adcREG1, adcGROUP2);
kickerReg->KICKER0 = 0x83E70B13U;
kickerReg->KICKER1 = 0x95A4F1E0U;
pinMuxReg->PINMMR35 = 0x0000;
kickerReg->KICKER0 = 0x00000000U;
kickerReg->KICKER1 = 0x00000000U;
/* setup etPWM */
etpwmSetCount(etpwmREG1, 1000);
etpwmSetCount(etpwmREG2,500);
etpwmSetCount(etpwmREG3, 300);
etpwmSetCounterMode(etpwmREG1, CounterMode_UpDown);
etpwmSetCounterMode(etpwmREG2, CounterMode_UpDown);
etpwmSetCounterMode(etpwmREG3, CounterMode_UpDown);
etpwmSetSyncOut(etpwmREG1,SyncOut_CtrEqZero);
etpwmSetSyncOut(etpwmREG2,SyncOut_EPWMxSYNCI);
etpwmSetSyncOut(etpwmREG3,SyncOut_EPWMxSYNCI);
etpwmREG2->TBCTL |= (uint16)2U << 1U; // PHSEN
etpwmREG3->TBCTL |= (uint16)2U << 1U;
/* Configure mthe module to set PWMA value as 1 when CTR=0 and as 0 when CTR=CmpA */
etpwmActionQualConfig_t configPWM;
configPWM.CtrEqPeriod_Action = ActionQual_Disabled;
configPWM.CtrEqZero_Action = ActionQual_Disabled;
configPWM.CtrEqCmpAUp_Action = ActionQual_Set;
configPWM.CtrEqCmpADown_Action = ActionQual_Clear;
configPWM.CtrEqCmpBUp_Action = ActionQual_Disabled;
configPWM.CtrEqCmpBDown_Action = ActionQual_Disabled;
etpwmSetActionQualPwmA(etpwmREG1, configPWM);
etpwmSetActionQualPwmA(etpwmREG2, configPWM);
etpwmSetActionQualPwmA(etpwmREG3, configPWM);
/* Enable trigger for SOC */
// etpwmEnableSOCA(etpwmREG1, CTR_PRD, EventPeriod_FirstEvent);
//etpwmEnableSOCA(etpwmREG2, CTR_ZERO, EventPeriod_FirstEvent);
etpwmEnableSOCA(etpwmREG1, CTR_PRD, EventPeriod_FirstEvent);
// etpwmClearEventFlag(etpwmREG1, Event_SOCA);
etpwmClearEventFlag(etpwmREG2, Event_SOCA);
// etpwmTriggerEvent(etpwmREG1,Event_SOCA);
etpwmTriggerEvent(etpwmREG2,Event_SOCA);
etpwmDisableCounterLoadOnSync(etpwmREG1);
etpwmEnableCounterLoadOnSync(etpwmREG2, 0, 0x2000);
etpwmEnableCounterLoadOnSync(etpwmREG3, 0, 0x2000);
etpwmEnableTimebasePeriodShadowMode(etpwmREG1);
etpwmEnableTimebasePeriodShadowMode(etpwmREG2);
etpwmEnableTimebasePeriodShadowMode(etpwmREG3);
etpwmEnableCmpAShadowMode(etpwmREG1, LoadMode_CtrEqZero);
etpwmEnableCmpAShadowMode(etpwmREG2, LoadMode_CtrEqZero);
etpwmEnableCmpAShadowMode(etpwmREG3, LoadMode_CtrEqZero);
etpwmDeadBandConfig_t deadbandconfig;
deadbandconfig.halfCycleEnable = true;
deadbandconfig.inputmode = PWMA_RED_FED;
deadbandconfig.outputmode = PWMB_FED_PWMA_RED;
deadbandconfig.polarity = Invert_PWMB;
etpwmSetDeadBandDelay(etpwmREG1,112,112);
etpwmSetDeadBandDelay(etpwmREG2,112,112);
etpwmSetDeadBandDelay(etpwmREG3,112,112);
etpwmEnableDeadBand(etpwmREG1, deadbandconfig);
etpwmEnableDeadBand(etpwmREG2, deadbandconfig);
etpwmEnableDeadBand(etpwmREG3, deadbandconfig);
// rti config
rtiCOMPARE2_PER = rtiGetPeriod(rtiCOMPARE2);
rtiCOMPARE1_PER_NEW = rtiGetPeriod(rtiCOMPARE1);
/* Start RTI Counter Block 0 */
// rtiStartCounter(rtiCOUNTER_BLOCK0);
etpwmStartTBCLK();
adcEnableNotification(adcREG1, adcGROUP1);
adcEnableNotification(adcREG2, adcGROUP1);
adcStartConversion(adcREG1, adcGROUP1);
adcStartConversion(adcREG2, adcGROUP1);
rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
while(1)
{
//user code
}
Hi Sachin,
Attached is my example project. The ADC is triggered using ePWM SCOA. This example was tested on TMS570LS0714PGE, and should work on TMS570LS1224PGE.
Hi QJ,
We replicated your config for our launchpad TMS570LS1224, ADC notification is not being triggered by the EPWM, only RTI notification is working as expected. Attaching the CCS prj and HAL prj for your refernce. Could you please help us?qjconfig_try.zip