mt2503工模中ADC显示于实际存在小量误差
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
MT6250、MT6260平台工模显示部分概率会出现与实际电压不相符
SOLUTION
此问题原因是工模中的采样次数比较少,所以采样到的ADC参数是几乎同一个点的电压。
而实际电压会因为BB工作过程中有各种扰动,导致工模采到的电压不稳定甚至不准确。
可以通过如下方法修改代码,增加工模中ADC的采样次数:
auxmain.c文件做如下修改:
DCL_HANDLE aux_open_and_create(DCL_UINT16 DCL_ADC_CHANNEL)
{
DCL_HANDLE adc_handle;
DCL_STATUS st;
ADC_CTRL_GET_PHYSICAL_CHANNEL_T adc_get_physical_channel;
ADC_CTRL_CREATE_OBJECT_T adc_create_object;
adc_handle = DclSADC_Open(DCL_ADC, FLAGS_NONE);
adc_get_physical_channel.u2AdcName = DCL_ADC_CHANNEL;
st = DclSADC_Control(adc_handle, ADC_CMD_GET_CHANNEL, (DCL_CTRL_DATA_T
*)&adc_get_physical_channel);
if(st != STATUS_OK)
ASSERT(0);
adc_create_object.u1OwnerId = MOD_AUX;
adc_create_object.u1AdcChannel = adc_get_physical_channel.u1AdcPhyCh;
if((DCL_VBAT_ADC_CHANNEL == DCL_ADC_CHANNEL) || (DCL_VISENSE_ADC_CHANNEL ==
DCL_ADC_CHANNEL) ||(DCL_VCHARGER_ADC_CHANNEL == DCL_ADC_CHANNEL)
||(DCL_VBATTMP_ADC_CHANNEL == DCL_ADC_CHANNEL) )
{ {
adc_create_object.u4Period = 1;
adc_create_object.u1EvaluateCount = 100;
} }
#if (!defined(__ACCDET_SUPPORT__)&& !defined(__DRV_EXT_ACCESSORY_DETECTION__))
else if((DCL_AUX_ADC_CHANNEL == DCL_ADC_CHANNEL) )
{ {
adc_create_object.u4Period = 15;
adc_create_object.u1EvaluateCount = 2;
} }
#endif
else
{ {
ASSERT(0);
} }
adc_create_object.fgSendPrimitive = KAL_TRUE;
st = DclSADC_Control(adc_handle, ADC_CMD_CREATE_OBJECT, (DCL_CTRL_DATA_T
*)&adc_create_object);
if(st != STATUS_OK)
ASSERT(0);
return adc_handle;
}
MT6250、MT6260平台工模显示部分概率会出现与实际电压不相符
SOLUTION
此问题原因是工模中的采样次数比较少,所以采样到的ADC参数是几乎同一个点的电压。
而实际电压会因为BB工作过程中有各种扰动,导致工模采到的电压不稳定甚至不准确。
可以通过如下方法修改代码,增加工模中ADC的采样次数:
auxmain.c文件做如下修改:
DCL_HANDLE aux_open_and_create(DCL_UINT16 DCL_ADC_CHANNEL)
{
DCL_HANDLE adc_handle;
DCL_STATUS st;
ADC_CTRL_GET_PHYSICAL_CHANNEL_T adc_get_physical_channel;
ADC_CTRL_CREATE_OBJECT_T adc_create_object;
adc_handle = DclSADC_Open(DCL_ADC, FLAGS_NONE);
adc_get_physical_channel.u2AdcName = DCL_ADC_CHANNEL;
st = DclSADC_Control(adc_handle, ADC_CMD_GET_CHANNEL, (DCL_CTRL_DATA_T
*)&adc_get_physical_channel);
if(st != STATUS_OK)
ASSERT(0);
adc_create_object.u1OwnerId = MOD_AUX;
adc_create_object.u1AdcChannel = adc_get_physical_channel.u1AdcPhyCh;
if((DCL_VBAT_ADC_CHANNEL == DCL_ADC_CHANNEL) || (DCL_VISENSE_ADC_CHANNEL ==
DCL_ADC_CHANNEL) ||(DCL_VCHARGER_ADC_CHANNEL == DCL_ADC_CHANNEL)
||(DCL_VBATTMP_ADC_CHANNEL == DCL_ADC_CHANNEL) )
{ {
adc_create_object.u4Period = 1;
adc_create_object.u1EvaluateCount = 100;
} }
#if (!defined(__ACCDET_SUPPORT__)&& !defined(__DRV_EXT_ACCESSORY_DETECTION__))
else if((DCL_AUX_ADC_CHANNEL == DCL_ADC_CHANNEL) )
{ {
adc_create_object.u4Period = 15;
adc_create_object.u1EvaluateCount = 2;
} }
#endif
else
{ {
ASSERT(0);
} }
adc_create_object.fgSendPrimitive = KAL_TRUE;
st = DclSADC_Control(adc_handle, ADC_CMD_CREATE_OBJECT, (DCL_CTRL_DATA_T
*)&adc_create_object);
if(st != STATUS_OK)
ASSERT(0);
return adc_handle;
}
多次测量出来的结果是求平均值呢还是取最大值呢?我感觉取最大值更合理些。