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.
Hello team,
I have tested ADC using adc_soc_software from MCU+SDK for AM263x(9.1.0.41) and EB Mcal(MCAL_AM263x_09.00.01.00).
using same configurations- prescalar, sample window, clock and everything.
I found out that there is difference in ADC count values from SDK and EBMcal.
please refer below table,
Multimeter value in Voltage | Expected ADC Count | ADC Count form SDK software | ADC Count from EB Mcal |
2.815 | 3603.2 | 3570 | 3070 |
2.131 | 2727.68 | 2696 | 2545 |
1.889 | 2417.92 | 2392 | 2365 |
1.494 | 1912.32 | 1894 | 2068 |
1.159 | 1483.52 | 1483 | 1800 |
0.101 | 129.28 | 133 | 452 |
Could you please confirm, why there is a large difference value between EB Mcal and SDK software?
Thanks
Aswathy J G
Hi Aswathy,
Can you please share the MCAL EB configuration?Adc_PBcfg.c, Adc_Cfg.c and Adc_Cfg.h
BR,
Sunil
Hi Sunil,
PFA
/* * * Copyright (c) 2023 Texas Instruments Incorporated * * All rights reserved not granted herein. * * Limited License. * * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive * license under copyrights and patents it now or hereafter owns or controls to make, * have made, use, import, offer to sell and sell ("Utilize") this software subject to the * terms herein. With respect to the foregoing patent license, such license is granted * solely to the extent that any such patent is necessary to Utilize the software alone. * The patent license shall not apply to any combinations which include this software, * other than combinations with devices manufactured by or for TI ("TI Devices"). * No hardware patent is licensed hereunder. * * Redistributions must preserve existing copyright notices and reproduce this license * (including the above copyright notice and the disclaimer and (if applicable) source * code license limitations below) in the documentation and/or other materials provided * with the distribution * * Redistribution and use in binary form, without modification, are permitted provided * that the following conditions are met: * * * No reverse engineering, decompilation, or disassembly of this software is * permitted with respect to any software provided in binary form. * * * any redistribution and use are licensed by TI for use only with TI Devices. * * * Nothing shall obligate TI to provide you with source code for the software * licensed and provided to you in object code. * * If software source code is provided to you, modification and redistribution of the * source code are permitted provided that the following conditions are met: * * * any redistribution and use of the source code, including any resulting derivative * works, are licensed by TI for use only with TI Devices. * * * any redistribution and use of any object code compiled from the source code * and any resulting derivative works, are licensed by TI for use only with TI Devices. * * Neither the name of Texas Instruments Incorporated nor the names of its suppliers * * may be used to endorse or promote products derived from this software without * specific prior written permission. * * DISCLAIMER. * * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** Project: Lecu Date : 2023-12-11 14:49:13 This file is generated by EB Tresos Do not modify this file, otherwise the software may behave in unexpected way ******************************************************************************/ /******************************************************************************* * INCLUDES ******************************************************************************/ #include "AdcDrv.h" #include "Adc_Irq.h" /****************************************************************************** * VERSION CHECK ******************************************************************************/ #if ( (ADC_CFG_MAJOR_VERSION != (9U)) \ ||(ADC_CFG_MINOR_VERSION != (0U))) #error "Version numbers of Adc_PBcfg.c and Adc_Cfg.h are inconsistent!" #endif /******************************************************************************* * GLOBAL CONFIG DATA ******************************************************************************/ #define ADC_START_SEC_CONFIG_DATA //#include "Adc_MemMap.h" #ifdef __cplusplus extern "C" { #endif extern void IoHwAb_AdcServ_Config_HwUnit0_Group0EndNotification(void); extern void IoHwAb_AdcServ_Config_HwUnit1_Group0EndNotification(void); extern void IoHwAb_AdcServ_Config_HwUnit2_Group0EndNotification(void); extern void IoHwAb_AdcServ_Config_HwUnit3_Group0EndNotification(void); /* Create runtime configurations. */ CONST(struct Adc_ConfigType_s, ADC_CONFIG_DATA) AdcConfigSet = { .maxGroup = 4U, .maxHwUnit = 4U, .groupCfg = { [0] = { .groupId = AdcGroupSensor_AdcGroup_0, .groupPriority =0U, .hwUnitId = 0, .Adc_GroupEndNotification = IoHwAb_AdcServ_Config_HwUnit0_Group0EndNotification, .streamNumSamples = (Adc_StreamNumSampleType)1, .resolution = ADC_DEF_CHANNEL_RESOLUTION,/* This is not configurable and should be set to ADC_DEF_CHANNEL_RESOLUTION */ .convMode = ADC_CONV_MODE_ONESHOT, .triggSrc = ADC_TRIGG_SRC_HW, .accessMode = ADC_ACCESS_MODE_SINGLE, .streamBufMode = ADC_STREAM_BUFFER_LINEAR, .hwTrigSignal = ADC_HW_TRIG_FALLING_EDGE, .hwTrigTimer =ADC_TRIGGER_EPWM0_SOCA, .groupReplacement = (Adc_GroupReplacementType)ADC_GROUP_REPL_SUSPEND_RESUME, .groupChannelMask = 0x3f, #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .grouplimitcheck = FALSE, #endif .groupDataAccessMode = ADC_GROUP_INTERRUPT_ACCESS, .numChannels = 6U, .channelConfig = { [0] = { .hwChannelId = 0U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 0, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =2482, .lowRange =1241, #endif }, [1] = { .hwChannelId = 1U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 1, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [2] = { .hwChannelId = 2U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 2, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [3] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [4] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [5] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, }, }, [1] = { .groupId = AdcGroupCurr_AdcGroup_1, .groupPriority =0U, .hwUnitId = 1, .Adc_GroupEndNotification = IoHwAb_AdcServ_Config_HwUnit1_Group0EndNotification, .streamNumSamples = (Adc_StreamNumSampleType)1, .resolution = ADC_DEF_CHANNEL_RESOLUTION,/* This is not configurable and should be set to ADC_DEF_CHANNEL_RESOLUTION */ .convMode = ADC_CONV_MODE_ONESHOT, .triggSrc = ADC_TRIGG_SRC_HW, .accessMode = ADC_ACCESS_MODE_SINGLE, .streamBufMode = ADC_STREAM_BUFFER_LINEAR, .hwTrigSignal = ADC_HW_TRIG_FALLING_EDGE, .hwTrigTimer =ADC_TRIGGER_EPWM0_SOCA, .groupReplacement = (Adc_GroupReplacementType)ADC_GROUP_REPL_SUSPEND_RESUME, .groupChannelMask = 0x3f, #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .grouplimitcheck = FALSE, #endif .groupDataAccessMode = ADC_GROUP_INTERRUPT_ACCESS, .numChannels = 6U, .channelConfig = { [0] = { .hwChannelId = 0U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 6, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =2482, .lowRange =1241, #endif }, [1] = { .hwChannelId = 1U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 7, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [2] = { .hwChannelId = 2U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 8, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [3] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [4] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [5] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, }, }, [2] = { .groupId = AdcConf_AdcHwUnit_AdcHwUnit_2_AdcGroup_AdcGroup_2, .groupPriority =0U, .hwUnitId = 2, .Adc_GroupEndNotification = IoHwAb_AdcServ_Config_HwUnit2_Group0EndNotification, .streamNumSamples = (Adc_StreamNumSampleType)1, .resolution = ADC_DEF_CHANNEL_RESOLUTION,/* This is not configurable and should be set to ADC_DEF_CHANNEL_RESOLUTION */ .convMode = ADC_CONV_MODE_ONESHOT, .triggSrc = ADC_TRIGG_SRC_HW, .accessMode = ADC_ACCESS_MODE_SINGLE, .streamBufMode = ADC_STREAM_BUFFER_LINEAR, .hwTrigSignal = ADC_HW_TRIG_FALLING_EDGE, .hwTrigTimer =ADC_TRIGGER_EPWM0_SOCA, .groupReplacement = (Adc_GroupReplacementType)ADC_GROUP_REPL_SUSPEND_RESUME, .groupChannelMask = 0x3f, #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .grouplimitcheck = FALSE, #endif .groupDataAccessMode = ADC_GROUP_INTERRUPT_ACCESS, .numChannels = 6U, .channelConfig = { [0] = { .hwChannelId = 0U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 12, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [1] = { .hwChannelId = 1U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 13, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [2] = { .hwChannelId = 2U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 14, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [3] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 15, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [4] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [5] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 9, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, }, }, [3] = { .groupId = AdcConf_AdcHwUnit_AdcHwUnit_3_AdcGroup_AdcGroupSwTrg_0, .groupPriority =0U, .hwUnitId = 3, .Adc_GroupEndNotification = IoHwAb_AdcServ_Config_HwUnit3_Group0EndNotification, .streamNumSamples = (Adc_StreamNumSampleType)1, .resolution = ADC_DEF_CHANNEL_RESOLUTION,/* This is not configurable and should be set to ADC_DEF_CHANNEL_RESOLUTION */ .convMode = ADC_CONV_MODE_ONESHOT, .triggSrc = ADC_TRIGG_SRC_SW, .accessMode = ADC_ACCESS_MODE_SINGLE, .streamBufMode = ADC_STREAM_BUFFER_LINEAR, .hwTrigSignal =ADC_HW_TRIG_BOTH_EDGES, .hwTrigTimer =ADC_TRIGGER_SW_ONLY, .groupReplacement = (Adc_GroupReplacementType)ADC_GROUP_REPL_SUSPEND_RESUME, .groupChannelMask = 0x3f, #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .grouplimitcheck = FALSE, #endif .groupDataAccessMode = ADC_GROUP_INTERRUPT_ACCESS, .numChannels = 6U, .channelConfig = { [0] = { .hwChannelId = 0U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 18, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [1] = { .hwChannelId = 1U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 19, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [2] = { .hwChannelId = 2U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 20, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [3] = { .hwChannelId = 3U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 21, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [4] = { .hwChannelId = 4U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 22, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, [5] = { .hwChannelId = 5U, .samplewindow = 16U, #if (STD_ON == ADC_DMA_MODE) .adcDMAChannel = 23, #endif #if (STD_ON == ADC_ENABLE_LIMIT_CHECK) .channelEnableLimitCheck =(FALSE), .highRange =4095, .lowRange =0, #endif }, }, }, }, .hwUnitCfg = { [0] = { .hwUnitId = (Adc_HWUnitType)ADC_HWUNIT_0, .baseAddr =0x502c0000UL, .prescale = (ADC_ClkPrescale)ADC_CLK_DIV_4_0, .resolution = (ADC_Resolution)ADC_RESOLUTION_12BIT, }, [1] = { .hwUnitId = (Adc_HWUnitType)ADC_HWUNIT_1, .baseAddr =0x502c1000UL, .prescale = (ADC_ClkPrescale)ADC_CLK_DIV_4_0, .resolution = (ADC_Resolution)ADC_RESOLUTION_12BIT, }, [2] = { .hwUnitId = (Adc_HWUnitType)ADC_HWUNIT_2, .baseAddr =0x502c2000UL, .prescale = (ADC_ClkPrescale)ADC_CLK_DIV_4_0, .resolution = (ADC_Resolution)ADC_RESOLUTION_12BIT, }, [3] = { .hwUnitId = (Adc_HWUnitType)ADC_HWUNIT_3, .baseAddr =0x502c3000UL, .prescale = (ADC_ClkPrescale)ADC_CLK_DIV_1_0, .resolution = (ADC_Resolution)ADC_RESOLUTION_12BIT, }, }, }; #ifdef __cplusplus } #endif #define ADC_STOP_SEC_CONFIG_DATA //#include "Adc_MemMap.h" /******************************************************************************* * END OF FILE: Adc_PBcfg.c ******************************************************************************/
Thanks
Aswathy J G
Hi Aswathy,
By default the ADC Clock Pre-scaler value for MCAL is div by 1 and for MCU_PLUS_SDK is div by 4.
Could you confirm if these are the same in your case and the issue still persists.
If the values are still default, could you make them same and then try to get the result again?
Regards,
Akshit