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.
There are some observations related to the buffer updation in the ADC Result register and the SW buffer collected using Adc_ReadGroup API.
Both HW and SW triggered SoCs for the ADC groups have the below configurations:
Group access and conversion modes : Single One-Shot
Streaming buffer mode : Linear.
Streaming samples : 1
Scenario 1 : HW and SW SoC enabled and triggered
Case 1: Adc_ReadGroup API not called
ADC Result register has as many entries as the HW and SW channels mapped to the group
Case 2: HW and SW SoC trigger enabled; Adc_ReadGroup API called
Query : More number of result registers are getting updated (for the HW triggered group) only when Adc_ReadGroup API is called. Is it a valid behavior?
Scenario 2 : SW buffer collected does not match the ADC result register values for the HW triggered SoC (using Adc_ReadGroup API)
Case 1: Only HW triggered SoC. Read results do not match
Case 2: Only SW triggered SoC. Read results match
Scenario 3 : Adc_GetGroupStatus does not seem to show a change in the ADC group status. Always remains in ADC_BUSY state after initiation of SoC (both HW and SW triggered). Hence we are unable to get to a confirmed state for collecting ADC results in polling mode.
Can we have short alignment to discuss the observed behaviors please.
Hi Ashish,
We are checking on this and will get back to you if need to align.
Thanks,
Sunil
Thanks for the quick update Sunil. The main control boards have arrived now and we would need to start validating the peripheral drivers on them. If any inputs are needed from my end (incase the scenarios are not clear and so on..) to speed up the process do let me know.
Hi Sunil,
Any update from your side related to the issue. Do you think we could have a short alignment today?
Hello Ashish,
Please find the updates:
Scenario 1 and Scenario 3 :
<<
We were able to reproduce the issue.
We shall update on it.
>>
Scenario 2 : SW buffer collected does not match the ADC result register values for the HW triggered SoC (using Adc_ReadGroup API)
<<
We are able to get correct result.
Please confirm the HW triggering rate to ADC module.
Please check by providing voltage.
>>
Regards,
Pratik
Hello Ashish,
Please find the updated MCAL Code for ADC module.
Please verify at your end and confirm the same.
Regards,
Pratik
I am able to get the correct results for the HW triggered channels on giving the voltage inputs on the LP eval board.
Hello Pratik,
I would suggest that we could have a quick meeting to check things quickly; as I am in the middle of HW testings; and I am a bit short of time. So, it would be faster over the call i feel. Can we have a call tomorrow please?
Hello Ashish,
As per Changes we updated:
Scenario 1 is fixed, where the High Priority SW Groups were getting converted twice.
This was leading GROUP status to BUSY always. (Scenario 3 ).
We can schedule a call for brief understanding. Tomorrow 3PM IST afternoon would be fine. Hope this is fine.
Hi Pratik/Sunil,
Could you kindly suggest in which MCAL release would this fix be planned?
Also, I had discussed with Pratik, that there were some deviations of the current implementation from the Autosar Spec and hence the ADC data collection in polling mode for HW and SW triggered SoCs is a bit tricky in terms of the confirmation of the EoC.
@Sunil Please do discuss and let us know what would be your suggestion based on the discussion with Pratik.
Hello Ashish,
We discussed internally and decided to provide the extra API "Adc_PollingMainFunction".
This API should be called periodically to monitor the status of all ADC groups (configured for POLLING mode).
The Protype of new API is as shown below:
"FUNC(void, ADC_CODE) Adc_PollingMainFunction (void)".
This API "Adc_PollingMainFunction", shall check the status of all the Group's (that are configured as POLLING mode).
If status in register provides as completed, then the results shall be transferred to ADC software buffer from ADC result register and status of particular Group shall be changed to ADC_STREAM_COMPLETED or ADC_COMPLETED accordingly.
The Function "Adc_PollingMainFunction", shall be called for update in status of ADC Channel Groups(POLLING Groups only) periodically or using API "Adc_GetStatus".
Once the status of particular Group is changed, API "Adc_ReadGroup" to be called to get the results of particular ADC Group conversion.
Regards,
Pratik
Hi Pratik,
Once you have this implementation ready, could you please provide me the AdcApp.c example implementation to understand the expected code flow. Once I am clear with the expected usage, I could take a patch delivery and integrate it locally and test. It would be better that we do it the same way over a call as we did with the previous patch delivery.
Also, could you confirm in which release is this feature included? October/December delivery??
Hi Sunil,
Can you please confirm in which release could we find the fix to the multiple result register buffer updatoin; please?
Hello Ashish,
We planned to provide feature in October release.
Sample application, we shall provide in within October 6, for verification.
Regards,
Pratik
Hi Ashish,
We will discuss this during tomorrow's meeting.
Thanks And Regards,
Sunil Kumar M S
Hello Ashish,
Please find the attached file sample application.
/* ====================================================================== * Copyright (C) 2022-2023 Texas Instruments Incorporated * * All rights reserved. Property of Texas Instruments Incorporated. * Restricted rights to use, duplicate or disclose this code are * granted through contract. * * The program may not be used without the written permission * of Texas Instruments Incorporated or against the terms and conditions * stipulated in the agreement under which this program has been * supplied. * ==================================================================== */ /** * \file AdcApp.c * * \brief This file contains the ADC test example * */ /* ========================================================================== */ /* Include Files */ /* ========================================================================== */ /*LDRA_NOANALYSIS*/ #include "string.h" /*LDRA_ANALYSIS*/ #include "assert.h" /*LDRA_NOANALYSIS*/ #include "Std_Types.h" #include "SchM_Port.h" /*LDRA_ANALYSIS*/ #include "Det.h" #include "Dem.h" #include "Adc.h" #include "Adc_Cfg.h" #include "Adc_Irq.h" #include "SchM_Adc.h" #include "Mcu.h" #include "Port_Cfg.h" #include "Port.h" #include "Mcu_Cfg.h" #include "app_utils.h" #include "sys_common.h" #include "Epwm_Platform.h" #include "sys_vim.h" #include "AdcApp_Startup.h" #include "AdcApp.h" #include "trace.h" /* For PRCM base addresses */ #include "soc.h" /* ========================================================================== */ /* Macros & Typedefs */ /* ========================================================================== */ #define GROUP_TEMP_SENSORS (0) /* ========================================================================== */ /* Structures and Enums */ /* ========================================================================== */ /* None */ /* ========================================================================== */ /* Internal Function Declarations */ /* ========================================================================== */ static void AdcApp_mainTest(AdcApp_Obj *appObj, const AdcApp_TestParams *testPrms); static void AdcApp_procIsr(uint32 grpIdx); static void AdcApp_printResult(const AdcApp_TestParams *testPrms); extern void AdcApp_interruptConfig(void); void Epwm_Enable(uint32 baseAddr); void Adc_DisableTrigger(uint32 baseAddr); void Adc_Trigger(uint32 baseAddr); /* ========================================================================== */ /* Global Variables */ /* ========================================================================== */ uint32 gTestPassed = E_OK; uint32 gSwTriggerCount = 0; volatile boolean gAdcAppGroupDone[ADC_MAX_GROUP]; volatile uint32 gAdcAppConversionCount[ADC_MAX_GROUP]; /**< Number of times App runs */ Adc_ValueGroupType Adc_AppBuffer[ADC_MAX_GROUP][ADC_APP_BUF_SIZE_WORD]; /**< SetUp Result Buffer passed to driver */ Adc_ValueGroupType Adc_AppReadBuffer[ADC_MAX_GROUP][ADC_APP_READ_BUF_SIZE_WORD]; /* Test application object */ AdcApp_Obj gAdcAppObj; /* ========================================================================== */ /* Function Definitions */ /* ========================================================================== */ #if defined CLANG void SchM_Enter_Adc_ADC_EXCLUSIVE_AREA_0(void) { AppUtils_SchM_Enter_EXCLUSIVE_AREA_0(); return; } void SchM_Exit_Adc_ADC_EXCLUSIVE_AREA_0(void) { AppUtils_SchM_Exit_EXCLUSIVE_AREA_0(); return; } void SchM_Enter_Mcu_MCU_EXCLUSIVE_AREA_0() { AppUtils_SchM_Enter_EXCLUSIVE_AREA_0(); } void SchM_Exit_Mcu_MCU_EXCLUSIVE_AREA_0() { AppUtils_SchM_Exit_EXCLUSIVE_AREA_0(); } void SchM_Enter_Port_PORT_EXCLUSIVE_AREA_0() { AppUtils_SchM_Enter_EXCLUSIVE_AREA_0(); } void SchM_Exit_Port_PORT_EXCLUSIVE_AREA_0() { AppUtils_SchM_Exit_EXCLUSIVE_AREA_0(); } void SchM_Enter_Cdd_Dma_DMA_EXCLUSIVE_AREA_0() { AppUtils_SchM_Enter_EXCLUSIVE_AREA_0(); } void SchM_Exit_Cdd_Dma_DMA_EXCLUSIVE_AREA_0() { AppUtils_SchM_Exit_EXCLUSIVE_AREA_0(); } #endif int main(void) { AdcApp_Obj *appObj = &gAdcAppObj; AdcApp_TestParams *testPrms; gTestPassed = E_OK; /* Setup Interrupt. */ AdcApp_Startup(); AppUtils_printf(APP_NAME ": Sample Application - STARTS !!!\r\n"); appObj->traceMask = (GT_INFO1 | GT_TraceState_Enable); testPrms = &gAdcAppTestPrms[0]; AdcApp_mainTest(appObj, testPrms); AppUtils_printf(APP_NAME ": Sample Application - DONE !!!\r\n"); if (E_OK == gTestPassed) { AppUtils_logTestResult(APP_UTILS_TEST_STATUS_PASS); } else { AppUtils_logTestResult(APP_UTILS_TEST_STATUS_FAIL); } AdcApp_TimerDeinit(); return (0); } static void AdcApp_mainTest(AdcApp_Obj *appObj, const AdcApp_TestParams *testPrms) { uint32 grpIdx; uint32 testPassed = E_OK; Adc_StatusType status; Std_ReturnType retVal; #if (ADC_VERSION_INFO_API == STD_ON) Std_VersionInfoType versioninfo; #endif /* #if (ADC_VERSION_INFO_API == STD_ON) */ memcpy(&appObj->testPrms, testPrms, sizeof (appObj->testPrms)); /* Print test case information */ GT_3trace( appObj->traceMask, GT_INFO, APP_NAME ": GROUPs %d: HWUNIT %d: LOOP COUNT %d:!!!\r\n", (appObj->testPrms.adcConfig)->maxGroup, (appObj->testPrms.adcConfig)->maxHwUnit, appObj->testPrms.loopCount); GT_0trace(appObj->traceMask, GT_INFO, " \r\n"); GT_0trace(appObj->traceMask, GT_INFO, "--------------------------------------\r\n"); Adc_Print_applyvoltage(appObj); GT_0trace(appObj->traceMask, GT_INFO, "--------------------------------------\r\n"); GT_0trace(appObj->traceMask, GT_INFO, " \r\n"); /* Init */ #if(ADC_VARIANT_PRE_COMPILE == STD_ON) Adc_Init(NULL_PTR); #endif #if(ADC_VARIANT_POST_BUILD == STD_ON) Adc_Init(testPrms->adcConfig); Epwm_Enable(0x50009000ul); #endif //AdcApp_interruptConfig(); /* Do interrupt config after init to avoid interrupts at start-up when * reloading program in CCS */ #if (ADC_VERSION_INFO_API == STD_ON) /* Get and print version */ Adc_GetVersionInfo(&versioninfo); GT_0trace(appObj->traceMask, GT_INFO, " \r\n"); GT_0trace(appObj->traceMask, GT_INFO, " ADC MCAL Version Info\r\n"); GT_0trace(appObj->traceMask, GT_INFO, " ---------------------\r\n"); GT_1trace(appObj->traceMask, GT_INFO, " Vendor ID : %d\r\n", versioninfo.vendorID); GT_1trace(appObj->traceMask, GT_INFO, " Module ID : %d\r\n", versioninfo.moduleID); GT_1trace(appObj->traceMask, GT_INFO, " SW Major Version : %d\r\n", versioninfo.sw_major_version); GT_1trace(appObj->traceMask, GT_INFO, " SW Minor Version : %d\r\n", versioninfo.sw_minor_version); GT_1trace(appObj->traceMask, GT_INFO, " SW Patch Version : %d\r\n", versioninfo.sw_patch_version); GT_0trace(appObj->traceMask, GT_INFO, " \r\n"); #endif /* #if (ADC_VERSION_INFO_API == STD_ON) */ for (grpIdx = 0U; grpIdx < testPrms->adcConfig->maxGroup; grpIdx++) { memset(&Adc_AppReadBuffer[grpIdx][0], 0xFFU, (sizeof (Adc_ValueGroupType) * ADC_NUM_CHANNEL)); /* Check group status - it should be idle */ status = Adc_GetGroupStatus(grpIdx); if (status != ADC_IDLE) { testPassed = E_NOT_OK; GT_1trace(appObj->traceMask, GT_ERR, " ADC Group %d is not IDLE!!\r\n", grpIdx); } /* Memset result buffer and give to driver */ memset(&Adc_AppBuffer[grpIdx][0], 0U, (sizeof (Adc_ValueGroupType) * ADC_NUM_CHANNEL)); retVal = Adc_SetupResultBuffer(grpIdx, &Adc_AppBuffer[grpIdx][0]); if (retVal != E_OK) { testPassed = E_NOT_OK; GT_1trace(appObj->traceMask, GT_ERR, " ADC Group %d setup buffer failed!!\r\n", grpIdx); } gAdcAppGroupDone[grpIdx] = FALSE; #if (ADC_GRP_NOTIF_CAPABILITY_API == STD_ON) /* Enable notification */ Adc_EnableGroupNotification(grpIdx); #endif /* #if (ADC_GRP_NOTIF_CAPABILITY_API == STD_ON) */ } gSwTriggerCount = 1; /* Trigger the HW Group. */ Adc_EnableHardwareTrigger(AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot); /* Enable the Trigger. */ Adc_Trigger(0x50009000ul); /* Wait for group conversion. */ while (gAdcAppConversionCount[AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot] != 50000) { Adc_PollingMainFunction(); if ( (gAdcAppConversionCount[AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot] == (gSwTriggerCount*1000)) && (gAdcAppConversionCount[AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot] >= 1000) ) { Adc_StartGroupConversion(AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup1_SwOneShot); gSwTriggerCount++; } /* Check group status - it should be COMPLETED state */ status = Adc_GetGroupStatus(AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot); /* Check the status of Group. */ if ((status == ADC_STREAM_COMPLETED) || (status == ADC_COMPLETED)) { Adc_ReadGroup(AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot, &Adc_AppReadBuffer[AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot][0]); gAdcAppConversionCount[AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot]++; } /* Check group status - it should be COMPLETED state */ status = Adc_GetGroupStatus(AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup1_SwOneShot); if ((status == ADC_STREAM_COMPLETED) || (status == ADC_COMPLETED)) { Adc_ReadGroup(AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup1_SwOneShot, &Adc_AppReadBuffer[AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup1_SwOneShot][0]); } } /* Trigger the HW Group. */ Adc_DisableHardwareTrigger(AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot); for (grpIdx = 0U; grpIdx < testPrms->adcConfig->maxGroup; grpIdx++) { /* Note: Stop not required as read group API we are calling from * ISR callback will move state to idle automatically */ #if (ADC_GRP_NOTIF_CAPABILITY_API == STD_ON) Adc_DisableGroupNotification(grpIdx); #endif /* #if (ADC_GRP_NOTIF_CAPABILITY_API == STD_ON) */ /* Check group status - it should be idle */ status = Adc_GetGroupStatus(grpIdx); if (status != ADC_IDLE) { testPassed = E_NOT_OK; GT_1trace(appObj->traceMask, GT_ERR, " ADC Group %d is not IDLE!!\r\n", grpIdx); } } AdcApp_printResult(testPrms); AppUtils_delay(100); #if (ADC_READ_TEMPERATURE_API == STD_ON) AdcTempTest(appObj, GROUP_TEMP_SENSORS); #endif #if (ADC_DEINIT_API == STD_ON) /* DeInit */ Adc_DeInit(); #endif /* #if (ADC_DEINIT_API == STD_ON) */ if (E_OK == gTestPassed) { gTestPassed = testPassed; } if (E_OK == testPassed) { GT_0trace(McalAppTrace, GT_INFO, "All tests have passed\n"); } else { GT_0trace(McalAppTrace, GT_ERR, "Some tests have failed\n"); } return; } void AdcApp_Group0EndNotification(void) { AdcApp_procIsr(0U); } void AdcApp_Group1EndNotification(void) { AdcApp_procIsr(1U); } void AdcApp_Group2EndNotification(void) { AdcApp_procIsr(2U); } void AdcApp_Group3EndNotification(void) { AdcApp_procIsr(3U); } static void AdcApp_procIsr(uint32 grpIdx) { Adc_StatusType status; AdcApp_Obj *appObj; #if (ADC_READ_GROUP_API == STD_ON) Std_ReturnType retVal; #endif /* #if (ADC_READ_GROUP_API == STD_ON) */ appObj = &gAdcAppObj; /* Check group status - it should be COMPLETED state */ status = Adc_GetGroupStatus(grpIdx); if ((status == ADC_STREAM_COMPLETED) || (status == ADC_COMPLETED)) { #if (ADC_READ_GROUP_API == STD_ON) /* Read and store the result */ retVal = Adc_ReadGroup(grpIdx, &Adc_AppReadBuffer[grpIdx][0]); if (retVal != E_OK) { gTestPassed = E_NOT_OK; GT_1trace(appObj->traceMask, GT_ERR, "ADC Group %d read buffer failed!!\r\n", grpIdx); } #endif /* #if (ADC_READ_GROUP_API == STD_ON) */ } else { gTestPassed = E_NOT_OK; GT_1trace(appObj->traceMask, GT_ERR, "ADC Group %d is not in read state!!\r\n", grpIdx); } gAdcAppGroupDone[grpIdx] = TRUE; gAdcAppConversionCount[grpIdx]++; return; } void Dem_ReportErrorStatus(Dem_EventIdType eventId, Dem_EventStatusType eventStatus) { if (DEM_EVENT_STATUS_FAILED == eventStatus) { gTestPassed = E_NOT_OK; GT_assert(McalAppTrace, FALSE); } return; } static void AdcApp_printResult(const AdcApp_TestParams *testPrms) { uint32 grpIdx; const Adc_GroupConfigType *grpCfg; AdcApp_Obj *appObj; appObj = &gAdcAppObj; GT_0trace(appObj->traceMask, GT_INFO1, " \r\n"); GT_0trace(appObj->traceMask, GT_INFO1, " Read Buffer Content\r\n"); GT_0trace(appObj->traceMask, GT_INFO1, " -------------------\r\n"); for (grpIdx = 0U; grpIdx < testPrms->adcConfig->maxGroup; grpIdx++) { grpCfg = &testPrms->adcConfig->groupCfg[grpIdx]; GT_1trace(appObj->traceMask, GT_INFO1, " ADC Group %d Log:\r\n", grpIdx); GT_0trace(appObj->traceMask, GT_INFO1, " ----------------\r\n"); AdcApp_printChannelResult(grpIdx, grpCfg, appObj); } return; } void Adc_Trigger(uint32 baseAddr) { //baseAddr = 0x50000000ul; EPWM_setTimeBaseCounterMode(baseAddr, EPWM_COUNTER_MODE_UP); } void Adc_DisableTrigger(uint32 baseAddr) { //baseAddr = 0x50000000ul; EPWM_disableADCTrigger(baseAddr, EPWM_SOC_A); EPWM_disableADCTrigger(baseAddr, EPWM_SOC_B); EPWM_setTimeBaseCounterMode(baseAddr, EPWM_COUNTER_MODE_STOP_FREEZE); } void Epwm_Enable(uint32 baseAddr) { /* CONFIG_EPWM0 initialization */ uint32 CONFIG_EPWM0_BASE_ADDR = 0x50000000ul; CONFIG_EPWM0_BASE_ADDR = baseAddr; /* Time Base */ EPWM_setClockPrescaler(CONFIG_EPWM0_BASE_ADDR, EPWM_CLOCK_DIVIDER_4, EPWM_HSCLOCK_DIVIDER_1); EPWM_setTimeBasePeriod(CONFIG_EPWM0_BASE_ADDR, 10000); EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_TBPRD_TBPRDHR); EPWM_setPeriodLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_PERIOD_SHADOW_LOAD); EPWM_setTimeBaseCounter(CONFIG_EPWM0_BASE_ADDR, 0); EPWM_setTimeBaseCounterMode(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_MODE_STOP_FREEZE); EPWM_setCountModeAfterSync(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNT_MODE_DOWN_AFTER_SYNC); EPWM_disablePhaseShiftLoad(CONFIG_EPWM0_BASE_ADDR); EPWM_setPhaseShift(CONFIG_EPWM0_BASE_ADDR, 0); EPWM_enableSyncOutPulseSource(CONFIG_EPWM0_BASE_ADDR, 0); EPWM_setSyncInPulseSource(CONFIG_EPWM0_BASE_ADDR, EPWM_SYNC_IN_PULSE_SRC_DISABLE); EPWM_setOneShotSyncOutTrigger(CONFIG_EPWM0_BASE_ADDR, EPWM_OSHT_SYNC_OUT_TRIG_SYNC); /* Counter Compare */ EPWM_setCounterCompareValue(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_A, 5000); EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_CMPA_CMPAHR); EPWM_setCounterCompareShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO); EPWM_setCounterCompareValue(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_B, 0); EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_CMPB_CMPBHR); EPWM_setCounterCompareShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO); EPWM_setCounterCompareValue(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_C, 0); EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_CMPC); EPWM_setCounterCompareShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_C, EPWM_COMP_LOAD_ON_CNTR_ZERO); EPWM_setCounterCompareValue(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_D, 0); EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_CMPD); EPWM_setCounterCompareShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_D, EPWM_COMP_LOAD_ON_CNTR_ZERO); /* Action Qualifier */ EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_AQCSFRC); EPWM_setActionQualifierContSWForceShadowMode(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_SW_SH_LOAD_ON_CNTR_ZERO); EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_AQCTLA_AQCTLA2); EPWM_disableActionQualifierShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_ACTION_QUALIFIER_A); EPWM_setActionQualifierShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_ACTION_QUALIFIER_A, EPWM_AQ_LOAD_ON_CNTR_ZERO); EPWM_setActionQualifierT1TriggerSource(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1); EPWM_setActionQualifierT2TriggerSource(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1); EPWM_setActionQualifierSWAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE); EPWM_setActionQualifierContSWForceAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_SW_DISABLED); EPWM_disableGlobalLoadRegisters(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_REGISTER_AQCTLB_AQCTLB2); EPWM_disableActionQualifierShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_ACTION_QUALIFIER_B); EPWM_setActionQualifierShadowLoadMode(CONFIG_EPWM0_BASE_ADDR, EPWM_ACTION_QUALIFIER_B, EPWM_AQ_LOAD_ON_CNTR_ZERO); EPWM_setActionQualifierT1TriggerSource(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1); EPWM_setActionQualifierT2TriggerSource(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1); EPWM_setActionQualifierSWAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE); EPWM_setActionQualifierContSWForceAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_SW_DISABLED); /* Events */ EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T1_COUNT_UP); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T1_COUNT_DOWN); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T2_COUNT_UP); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T2_COUNT_DOWN); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T1_COUNT_UP); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T1_COUNT_DOWN); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T2_COUNT_UP); EPWM_setActionQualifierAction(CONFIG_EPWM0_BASE_ADDR, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_T2_COUNT_DOWN); /* Event Trigger */ EPWM_disableInterrupt(CONFIG_EPWM0_BASE_ADDR); EPWM_setInterruptSource(CONFIG_EPWM0_BASE_ADDR, EPWM_INT_TBCTR_ZERO, EPWM_INT_TBCTR_ZERO); EPWM_setInterruptEventCount(CONFIG_EPWM0_BASE_ADDR, 0); EPWM_disableInterruptEventCountInit(CONFIG_EPWM0_BASE_ADDR); EPWM_setInterruptEventCountInitValue(CONFIG_EPWM0_BASE_ADDR, 0); EPWM_enableADCTrigger(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_A); EPWM_setADCTriggerSource(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA, EPWM_SOC_TBCTR_U_CMPA); EPWM_setADCTriggerEventPrescale(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_A, 1); EPWM_disableADCTriggerEventCountInit(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_A); EPWM_setADCTriggerEventCountInitValue(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_A, 0); EPWM_disableADCTrigger(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_B); EPWM_setADCTriggerSource(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_B, EPWM_SOC_DCxEVT1, EPWM_SOC_DCxEVT1); EPWM_setADCTriggerEventPrescale(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_B, 0); EPWM_disableADCTriggerEventCountInit(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_B); EPWM_setADCTriggerEventCountInitValue(CONFIG_EPWM0_BASE_ADDR, EPWM_SOC_B, 0); /* Global Load */ EPWM_disableGlobalLoad(CONFIG_EPWM0_BASE_ADDR); EPWM_setGlobalLoadTrigger(CONFIG_EPWM0_BASE_ADDR, EPWM_GL_LOAD_PULSE_CNTR_ZERO); EPWM_setGlobalLoadEventPrescale(CONFIG_EPWM0_BASE_ADDR, 0); EPWM_disableGlobalLoadOneShotMode(CONFIG_EPWM0_BASE_ADDR); /* EPWM Module */ EPWM_lockRegisters(CONFIG_EPWM0_BASE_ADDR, 0); }
Hi Ashish,
Please review the patch and confirm the polling implementation is fine with you.
Thanks And Regards,
Sunil Kumar M S
Hello Ashish,
The PATCH Release "MCAL_AM263x_09.00.01.01" has issue using Adc_PollingMainFunction().
The updated patch with fix in Adc_PollingMainFunction shall be provided.
Thanks for understanding and apologize for inconvenience caused.
Regards,
Pratik
Hello Ashish,
Please find the updated file for ADC module.
Please use this updated file over PATCH Release "MCAL_AM263x_09.00.01.01" ADC module
File_Adc_PrivAdc_Priv.c:
Thanks and Regards,
Pratik