cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030F4 ADC strange behaviour

srdjan
Associate II
Posted on October 08, 2015 at 01:01

Hello all,

I have a custom board with STM32F030F4. I'm trying to run the simplest example generated by STM32Cube, which is to sample Temperature sensor and VRef input using DMA.

Everything compiles and runs properly, but when I run the code all I get is 0xFFF as a result for both inputs.

Next I tried measuring a value from a PA4 input pin. I'm bringing a 0.5V signal to a PA4 pin, but when the ADC starts I see nasty oscillations on the PA4 pin which go between 0.5V and 1.1V. (The signal is coming through an buffer op-amp).

Same thing happens when I connect PA4 to GND over a 1K resistor. It almost looks like the pin is pulled ''up'' during the sampling period to this 1.1V rail (VRef?), and the ADC reports a value of around 1000 instead of values close to 0.

Can anyone explain what is happening?

Thank you..

#stm32f0-adc-dma
3 REPLIES 3
AvaTar
Lead
Posted on October 08, 2015 at 13:08

> I have a custom board with STM32F030F4.

 

VDDA and VSSA properly connected ?

danielschramm9
Associate II
Posted on October 08, 2015 at 21:29

Hello,

for me it sounds like effects coming from the sample stage or IO Configuration.

Did you disable Pullup on the GPIO?

Are you switching between different inputs moving energy via the sampling capacitors, etc.

Refer to AN2834 for details on how to connect the ADC to the signal source.

Please keep us informed when you discovered the source of the problem.

Daniel
srdjan
Associate II
Posted on November 01, 2015 at 18:40

Hi Daniel,

The root cause of the issue was that I had 5V connected to a non 5V tolerant pin. According to STM gurus, this voltage was going through the protection diode and messing up with internal voltages around the chip. It would also pull up the analog pins to 5V, which would create havoc during sampling stage.

The reason I had 5V was that I was using i2c to connect to a 5V bus. I didn't think it would matter, because the outputs were open drain, but it turns on that ''the ''pullup mosfet'' will still be there. The hardware just is configured not to turn it on anymore. With the mosfet still there, it has a parasitic diode to VCC that will start to conduct if you do not respect the ''absolute maximum'' voltage of that pin.  This in return, injects 5V into the chip, and creates all sorts of problems.