Skip to main content
Mahmood ul Hassan
Associate II
July 24, 2019
Question

ADC input voltage range in differential mode

  • July 24, 2019
  • 4 replies
  • 13181 views

In STM32CubeMx H7(v1.5.0) the example of ADC_DifferentialMode for NUCLEO-H743ZI is showing that we can measure difference voltage range of 6V6 in this mode and readme,txt file is also clearly telling us that we can vary the input voltage from -3V3 to +3V3 at both input VIN+ (PB.01) and VIN-(PB.00) of op-amp. But doing this the output voltage swing of op-amp will be +6V6 to -6V6 which are clearly out of range values.

Can someone clarify that. Even though the datasheet tells us we cannot connect a negative voltage at analog input. Isn't this should be like that

The ADC is configured to convert continuously ADC_CHANNEL_5 (VinP) connected to PB.01
and its correspanding VinN connected to PB.00.
 
User can connect ADC_CHANNEL_5 pins (PB.00 ( Pin 34 in CN11 connector), PB.01 (Pin 24 in CN12 Connector))
to external power supply and vary voltage between 0 to 3V3.
 
uwConvertedValue variable contains the 32-bit conversion result and 
swInputVoltage yields the signed input voltage in mV between -3V3 to 3V3.

Instead of this (actual readme.txt file in ADC_DifferentialMode example)

The ADC is configured to convert continuously ADC_CHANNEL_5 (VinP) connected to PB.01
and its correspanding VinN connected to PB.00.
 
User can connect ADC_CHANNEL_5 pins (PB.00 ( Pin 34 in CN11 connector), PB.01 (Pin 24 in CN12 Connector))
to external power supply and vary voltage between -3V3 to 3V3.
 
uwConvertedValue variable contains the 32-bit conversion result and 
swInputVoltage yields the signed input voltage in mV.

Even though the microchip ADC datasheet for cortex M-7 (http://ww1.microchip.com/downloads/en/DeviceDoc/90003182A.pdf) is also showing that we can measure difference in voltage up to 6V6 peak to peak but its showing that input values at both inputs with in the range of 0V to 3V3.

0690X000009Z2xqQAC.png

This topic has been closed for replies.

4 replies

Uwe Bonnes
Chief
July 24, 2019

Look at the first waveform in Figure 1-2. Absolute voltage range at AD2/3 is 0...3.3 Volt only. Nowhere there is a swing +6V6 to -6V6 . In side the chip, there is no OP, only sampling capacitors.

Mahmood ul Hassan
Associate II
July 24, 2019

Yes I Know that. But readme.txt file inside an ADC_DifferentialMode example of CubeH7 says we can vary the input voltage of power supply connected at input from -3V3 to 3V3.

This can only be true if there is no common ground between power supply and STM32 mcu. (True differential application) and ground of that power supply should be connected to VinN (PB.00) of ADC_CHANNEL_5 (otherwise output will be inverted).

 In this case if there is any hint of common ground between that power supply and STM32 MCU then it will be a disaster.

So to be on a safe side STM32 team should tell its user to use two separate power supplies at each input with a common ground and vary the voltage from 0V to 3V3. In this case you can avoid damaging the STM32 MCU.

Ozone
Principal
July 24, 2019

I cannot speak for the H7xx devices, which I don't have any experience with.

However, all other STM32 MCUs do neither allow nor process any negative voltages, i.e. below GND or AGND.

Their ADCs do not have a true differential mode.

Differential mode in the STM32 context means the difference between two ADC inputs.

This means:

  • you need two ADC input channels for one "differential input"
  • neither of this "differential inputs" must ever have a voltage potential below GND/AGND

I suppose the H7xx is not different in this regard.

Check the datasheet/reference manual.

Not sure why you are coming up with Microchip ADC datasheets. They are not relevant at all for this case.

Mahmood ul Hassan
Associate II
July 24, 2019

in differential mode you can measure the input signal up-to 6V6 peak to peak with maximum voltage swing between -3V3 to 3V3 when gain is 1. (Only if there is no common ground between Input signal and STM32 MCU). (tested and it works perfectly)

July 24, 2019

Both inputs are within 0-3.3V, but differential can be 0-3.3=-3.3V to 3.3-0=3.3V. 

SF??r
Associate III
July 29, 2019
  • Please checkout the datasheet an electrical chara.! No data from microchip or any code comments will help you out
  • Each ADC input pin (independent off + or - channel) could convert from VRef- to VRef+.
  • VRef- must be connected to VssA (maybe filtered)
  • VssA must be connected to Vss (maybe filtered)
  • => there should be a common ground from your measure source to the µC or you could damage the µC

You could have 6.6 V differential peak to peak (based on 3.3 V for REF+) and all is within the datasheet:

First sample (16 Bit):

AIN1+ = REF+

AIN1- = REF-

=> INT16_MAX = 3.3 V

Second sample (16 Bit):

AIN1+ = REF-

AIN1- = REF+

=> INT16_MIN = -3.3 V

Mahmood ul Hassan
Associate II
July 29, 2019

First of all core design of Cortex-M MCU is standard and same across all manufacturers.

I have already tested it with +3V3 to -3V3 design. Then only requirement of ADC input in differential mode is Vmax<=|Vpin - Vnin|.

To measure negative voltage make sure there is no common ground between Signal and MCU supply