STM32f103c8 ADC error, Constant error value( 1.69 Volt) and erratic output
I am trying to create ADC using STM32F103C8. Software i am using are:
a. STM32CubeMX
b. Keil Vision -- V5
c. Hercules to Monitor the Serial Output
Clock Setting of STM is 72 Mhz and 12 Mhzfor ADC
Code :-
while (1)
{
/* USER CODE END WHILE */
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1,300);
raw = HAL_ADC_GetValue(&hadc1);
float vin = (double)raw*(3.3/4096);
sprintf(msg1,"Vol = %.2f , HEX Value = %.4x \r\n",vin, raw);
HAL_UART_Transmit(&huart1,(uint8_t*)msg1,sizeof(msg1),300);
HAL_Delay(1000);
/* USER CODE BEGIN 3 */
}
i am getting a constant DC Output of around 1.69 Volt, when input volt at ADC is Zero (Screen Shot attached). After supplying any Voltage value between 0 - 3.3 Volt, output is varying contentiously between 0 to 3.3 Volt.
I have checked the input reference volt, it is 3.3 Volt. Can you suggest me how to resolve this issue. I have printed a HEX value of output of function HAL_ADC_GetValue(&hadc1). 
