We have written the following code for generating 3 PWMs, synching all of them and using EPWMA for ADC Conversion(ADC1 group1, ADC 2 Group1). How can we verify that the ADC conversion is being triggered at the centre of the up-down counter as we have done all the configuration for counter up- down? Is there any event or flag that gives us the reference when the ADC conversion is being triggered?
Our code initization:
*/ Start
_enable_interrupt_();
adcStartConversion(adcREG1, adcGROUP1);
adcStartConversion(adcREG2, adcGROUP1);
//etpwmStartTBCLK();
kickerReg->KICKER0 = 0x83E70B13U;
kickerReg->KICKER1 = 0x95A4F1E0U;
pinMuxReg->PINMMR35 = 0x1000;
kickerReg->KICKER0 = 0x00000000U;
kickerReg->KICKER1 = 0x00000000U;
/* setup etPWM */
etpwmSetCounterMode(etpwmREG1, CounterMode_UpDown);
etpwmSetCounterMode(etpwmREG2, CounterMode_UpDown);
etpwmSetCounterMode(etpwmREG3, CounterMode_UpDown);
etpwmSetSyncOut(etpwmREG1,SyncOut_CtrEqZero);
etpwmSetSyncOut(etpwmREG2,SyncOut_EPWMxSYNCI);
etpwmSetSyncOut(etpwmREG3,SyncOut_EPWMxSYNCI);
etpwmDisableCounterLoadOnSync(etpwmREG1);
etpwmEnableCounterLoadOnSync(etpwmREG2, 0, 0x2000);
etpwmEnableCounterLoadOnSync(etpwmREG3, 0, 0x2000);
etpwmREG2->TBCTL |=(uint16)4U;
etpwmREG3->TBCTL |=(uint16)4U;
/* 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(etpwmREG2, CTR_PRD, EventPeriod_FirstEvent);
etpwmClearEventFlag(etpwmREG2, Event_SOCA);
etpwmTriggerEvent(etpwmREG2,Event_SOCA);
etpwmEnableCmpAShadowMode(etpwmREG1, LoadMode_CtrEqZero);
etpwmEnableCmpAShadowMode(etpwmREG2, LoadMode_CtrEqZero);
etpwmEnableCmpAShadowMode(etpwmREG3, LoadMode_CtrEqZero);
etpwmStartTBCLK();
adcEnableNotification(adcREG1, adcGROUP1);
adcEnableNotification(adcREG2, adcGROUP1);
*/ end