2015-09-30 11:16 PM
2015-10-07 12:52 PM
I took another board with same MCU and same code and it also gives 0xFFF's for Vrefint.
Then i took STM32F3 discovery kit SW package ADC sample code, modified it to sample Vrefint and still got the same bad result. Same code running on STM32F3 Discovery gave feasible result. It's also strange that the custom boards give 0xFFF for Vbat and Temp channels as well while discovery board gives normal values. Of course discovery board has another MCU so it's not 100% comparable but it's the same family... I also checked the option bytes and they seemed ok (everything enabled). Then i tried gettting ADC clock from PLLCLK and from HCLK. I also found that OPAMP's have some kind of Vref test option so i tried to enable that from OPAMP1 and sample it's output with ADC but got zero as sample value. Maybe i didn't activate OPAMP correctly. This is getting absurd. I've checked the schematics and footprint pins twice and all voltages are ok. PS. Datasheet says that DAC and ADC share VREF+. So i checked DAC output and ensured that it has correct VREF+. So i expect ADC also to have correct VREF+. I tried sampling Vrefint with ADC3 also without luck.2015-10-07 01:51 PM
The datasheet seems to imply Vrefint, ADC_IN17, can be used with and ADC. Most other parts it's only connected to ADC1, so try converting it on ADC1. Maybe there's an errata about it.
Jack Peacock2015-10-07 04:04 PM
I have the same issue on STM32F0. I cannot get the thing to work with VRefint and Tempsensor. Any help with this would be appreciated...
2015-10-08 12:33 PM
My previous code was built with Keil MDK-ARM v5.14 and i used StdPerihLib v1.2.3.
Now i took HAL library (STM32CubeF3 v1.3.0) and used Ac6 (OpenSTM32) with some basic ADC example code. And still - Vrefint raw value is 0xFFF. Normal external ADC channel values are ok.2015-10-28 01:01 AM
Problem solved!
The issue was in HW. Pins PC0, PC2 and PB11 had external 1k pull-up resistors to 5V. However these pins are not 5V tolerant, instead they are ''TTa'' which means ''3.3 V tolerant I/O directly connected to ADC''. Probably the 5V leaked into the ADC circuit through protection diodes and that screwed up the voltages inside chip. That also explains why the Vrefint ADC samples had maximum value - it was just over the VDDA.