cancel
Showing results for 
Search instead for 
Did you mean: 

BlueNRG-1 ADC input with higher voltage than VBAT sinks a lot of current

rastik
Associate III

According to the datasheet, it is possible with ADC to sample voltage up to 3.6V, even with lower VBAT, if proper attenuator.

I'm powering the MCU with 2.5V and feeding battery (up to 3.6V) to ADC1 pin. No matter what setting I use, the ADC is still sinking a lot of current - approx. 40 uA for ADC1 pin and more than 1 mA for ADC2 pin.

I've even tried setting CHSEL to 0 that should result in input connected to the ADC, but it is still the same.

My standard setup is ADC1, CHSEL=2, OSR=0, single mode, REFSEL=2, PGASEL=2.

Is there anything I'm missing in the specs?

10 REPLIES 10
Ozone
Lead

ST's Cortex M controllers use to allow a maximum of 3.6V as VDD and on analog inputs, without damaging it.

For proper operation of the ADC, you need to keep the maximal input voltage below the level of the ADC Vref (usually VDD or VDDA).

Otherwise, compensatory currents will flow through the input protective circuits - as you observed.

I guess when battery-supplied, VDD (or VDDA) are much lower.

> ... , if proper attenuator.

I suppose this means a voltage divider.

Yes, this is what I thought is going on. But the datasheet states:

VINP, VINN - Input pin voltage - With input attenuator - Min: -50 mV, Max: (VBAT+50 mV) / input attenuation

Hence the term "attenuator", even though I wouldn't use it in this context. based on that I'd expect that ADC > VBAT is allowed, if proper setup is used.

VREF is 2.4V according to the datasheet, so that should not be the limit.

rastik
Associate III

I'd like to add that when voltage level on ADC1 pin is higher than VBAT, all ADC measurements are flawed. E.g. internal temperature sensor reports much lower temperature than the actual. In such a case I'd expect that ADC is not connected to external input and it should have not effect.

Hi Rastik,

Please doubly check if REFSEL is set to 2 (Vbias 0.6V) and GPASEL is set to 2 (Attenuation 9.54 dB).

Not quite understand the reason of testing single ended through ADC1 pin but connecting ADC2 too.

I tested BlueNRG-2 (STEVAL-IDB008v2) with VBAT 3.3V (from USB 5V), for cases:

  1. CHSEL 3 : ADC2 connected to GND; ADC1 sink current was around 20 uA
  2. CHSEL 2 : ADC2 unconnected; ADC1 sink current was around 30 uA

Best Regards,

Winfred

rastik
Associate III

Hello Winfred,

this is the code I use (ADC routines are from BlueNRG1_adc.c):

	static ADC_InitType adc_settings;
	static float adc_value;
 
	SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_ADC, ENABLE);
 
	// recommended oversampling rate for DC signal
	adc_settings.ADC_OSR = ADC_OSR_200;
	adc_settings.ADC_Input = ADC_Input_AdcPin1; // or ADC_Input_TempSensor
	adc_settings.ADC_ConversionMode = ADC_ConversionMode_Single;
	// recommended value
	adc_settings.ADC_ReferenceVoltage = ADC_ReferenceVoltage_0V6;
	// attenuation for 3.6V input
	adc_settings.ADC_Attenuation = ADC_Attenuation_9dB54;
 
	ADC_Init(&adc_settings);
 
	// Enable auto offset correction
	ADC_AutoOffsetUpdate(ENABLE);
	ADC_Calibration(ENABLE);
 
	// measure
	ADC_Cmd(ENABLE);
	while (!ADC_GetFlagStatus(ADC_FLAG_EOC));
 
	// read converted data
	adc_value = ADC_GetConvertedData(adc_settings.ADC_Input, adc_settings.ADC_ReferenceVoltage);
 
	// deinit
	ADC->CONF_b.CHSEL = ADC_Input_None;
	ADC->CONF_b.PGASEL = ADC_Attenuation_0dB;
 
	SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_ADC, DISABLE);

I was testing ADC1 or ADC2, not both at the same time. I'm generally using ADC1, but when this problem arose, I've tried ADC2 instead too.

And even though I run the deinit part (which should disconnect the input), the current is leaking though the ADC pin anyway. Or when ADC_Input_TempSensor is specified, voltage on ADC pin has an effect on the measured value.

Not familiar with BlueNRG details.

A general feature of STM32 controllers is, that pins with associated analog functionality are not 5V tolerant. That means all pins that have an analog Alternate Function, even if they are configured to another mode (GPIO, serial IO, timer IO, etc.).

This (usually) means, clamping diodes for overvoltage protection will drain currents for voltages of 3.6V + Vf. And this current will affect the peripheral unit.

In other words, avoid voltages above 3.6V (or VDD) on analog pins. I used to have at least a zener diode (with series resistor) at ADC inputs as protective measure.

Agree with Ozone's points.

Please avoid voltage above 3.6V on ADC pins.

Providing it higher than 3.6V is over spec and the behavior is not guaranteed. It is reasonable that the protection diodes drain current for higher voltages.

The test was done again with another instrument (more accurate for low current measurement)

  • Board STEVAL-IDB008V1 (BlueNRG-2)
  • Example project BlueNRG1_Periph_Examples/ADC/Polling modified to get samples from ADC pin 1
  • Connect the Output + of channel 1 to ADC pin 1 and Output - of channel 1 to GND

The current leakage values were close to the expected ones, according to the voltage provided to the pin:

  • with 3.6 V => leakage = ~ 6.6 uA
  • with 3.3 V => leakage = ~ 5.8 uA
  • with 2.0 V => leakage = ~ 3.5 uA
  • with 1.5 V => leakage = ~ 2.6 uA

For my previous test, please consider it as an instrumental error.

Thank you.

Hello Winfred, I agree with 3.6V limit. Our problem occurs when VBAT < VADC1 < 3.6V. Anyway, we've solved it by adding a resistor between our input and ADC1 pin. Combined with internal impedance of internal voltage divider (REFSEL=2) there is no current leak and we can calculate quite precise voltage level of the original input. Even though it is not perfectly precise as the internal impedance changes with ADC1 pin voltage.

The only other viable option was to use external voltage divider and a voltage buffer (opamp). The external divider itself would be enough only when we could use REFSEL=0 (i.e. divide down to 1.2V max), because otherwise internal divider would skew the measurement.

Thank you all for your comments and inputs.

Hi Rastik,

Good to know that it works after an external divider is added.

For the case that VADC1 below 3.6V , there shall be no such kind of leakage issue.

In the previous test, for VBAT = 3.3V, VADC1 = 3.6V (not above 3.6), the current is 6.6 uA.

With PGASEL = 2, the impedance being 585 kOhm (typical), providing ADC 3.6V the expected current would be around 6.15 uA.

The posted source code looks fine. I am not so sure what could be the cause.

Could you possibly replicate the test with some EVB such as a STEVAL-IDB007v2 or a STEVAL-IDB008v2 ?

Thank you.

Best Regards,

Winfred