Skip to main content
rastik
Associate III
August 26, 2019
Question

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

  • August 26, 2019
  • 10 replies
  • 2920 views

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?

    This topic has been closed for replies.

    10 replies

    Ozone
    Principal
    August 26, 2019

    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.

    rastik
    rastikAuthor
    Associate III
    August 26, 2019

    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
    rastikAuthor
    Associate III
    September 8, 2019

    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.

    Winfred LU
    ST Employee
    September 11, 2019

    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
    rastikAuthor
    Associate III
    September 11, 2019

    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.

    Ozone
    Principal
    September 11, 2019

    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.

    Winfred LU
    ST Employee
    September 19, 2019

    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.