Ok, so what I did was correct. however, when I put "3.3*1.5" instead of "g_AdcBandgap", the result is not correct and it is always higher than real values. Why?
This is my ADC configuration:
ADC_GetDefaultConfig(&adcConfigStruct);
adcConfigStruct.channelEnable = (1U << DEMO_ADC_CHANNEL);
adcConfigStruct.channelConfig = (DEMO_ADC_CFG_IDX << DEMO_ADC_CHANNEL);
adcConfigStruct.triggerSource = DEMO_ADC_TRIGGER;
adcConfigStruct.convMode = kADC_ConvModeSingle;
adcConfigStruct.refSource = kADC_RefSourceExtWithDriver;
ADC_Init(DEMO_ADC_BASE, &adcConfigStruct);
/* Initial ADC Sigma Delta(SD) configuration */
adcSdConfigStruct.vinnSelect = kADC_VinnSelectVref;
ADC_GetSdDefaultConfig(&adcSdConfigStruct);
ADC_SetSdConfig(DEMO_ADC_BASE, DEMO_ADC_CFG_IDX, &adcSdConfigStruct);
And this is my conversion:
fresult = ADC_ConversionResult2Mv(DEMO_ADC_BASE, DEMO_ADC_CHANNEL, DEMO_ADC_CFG_IDX, 3.3*1.5, g_AdcVinn,
adcConvResult);