2019-07-24 02:52 AM
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.
2019-07-24 03:30 AM
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.
2019-07-24 03:44 AM
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.
2019-07-24 03:56 AM
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)
2019-07-24 04:02 AM
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:
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.
2019-07-24 04:06 AM
Both inputs are within 0-3.3V, but differential can be 0-3.3=-3.3V to 3.3-0=3.3V.
2019-07-24 04:21 AM
I have tested by applying a -3V3 to +3v3 signal with no common ground between MCU and power supply it worked absolutely fine.
|-3v3| = 3v3 which is with in the input range of ADC.
@Mikhail Z has explained the rest. its just matter of consideration of reference point when we are talking about differential signals.
Simply change the ground reference point w.r.t MCU the input signal between 0V to -3V3 w.r.t input signal ground will become 3V3 to 0V.
similarly the input signal between 3V3 to 0V w.r.t input signal ground will become 0V to 3V3 for MCU inputs.
You can even measure the negative voltage (ONLY with separate ground and input should be between 0V and -(VDDA) or -3V3 in case of STM32 MCU) by using single ended ADC input of any MCU.
2019-07-29 05:02 AM
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
2019-07-29 11:28 AM
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
2019-07-29 12:00 PM
If there is a any connection between input signal ground and mcu power supply then
1) input signal ground is common with MCU ground. Input signal Voltage measuring Range will be same as in single input mode (3V3 to 0V).
2) input signal ground connected to VDD of MCU. Input signal voltage measuring Range will be 0V to -3V3. If you keep the input signal GND with MCU GND and apply negative signal then you will surely damage it.
One of the main reason to use differential signal is ground isolation. Therefore in differential mode it isn't necessary to connect input signal ground to ground or VDD of measuring device.
Only for @Sebastian Förster !
If you are saying there should be common ground between MCU and input signal and 100% sure about it.
Then please verify your theory by keeping a common ground between input signal supply and MCU. And then follow the instruction given in CubeH7 ADC differential input example of varying the input signal from +3V3 to -3V3. After verification please share your experience with all of us.
Even if you were able to do this (given below) with common ground between input signal and MCU I will except I was wrong and need to study it again.
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
For me this will definitely give you a damaged MCU.