Hello people,
I have a small problem with the internal AD converter on my
STR711-EvalBoard (PDFs to the controller:
http://www.st.com/mcu/devicedocs-STR711FR2.html).
This is my hardwaresetup: AVDD is connected to 3.3 V, AVSS with GND
and I am using channels 0-2 of internal 12-bit AD converter.
PCLK2 is initialized as the following:
RCCU_Div2Config (DISABLE);
RCCU_PLL1Config (RCCU_PLL1_Mul_16, RCCU_Div_1);
RCCU_RCLKSourceConfig (RCCU_PLL1_Output);
RCCU_MCLKConfig (RCCU_DEFAULT);
RCCU_FCLKConfig (RCCU_RCLK_4);
RCCU_PCLKConfig (RCCU_RCLK_4);
The clock of PCLK2 is at 16Mhz because I have connected a 4Mhz crystall.
This is the initialization of the ADC:
ADC12_Init ()
ADC12_PrescalerConfig (100);
ADC12_ModeConfig (ADC12_ROUND);
ADC12_ConversionStart ();
And this is how I read out the Measurement and transmit it via the UART
to the computer:
ADC_Value = ADC12_ConversionValue (ADC12_CHANNEL0);
sprintf (buffer, "Ch 0:% i", ADC_Value);
UART_StringSend (UART0, Buffer);
ADC_Value = ADC12_ConversionValue (ADC12_CHANNEL1);
sprintf (buffer, "Ch 1:% i", ADC_Value);
UART_StringSend (UART0, Buffer);
ADC_Value = ADC12_ConversionValue (ADC12_CHANNEL2);
sprintf (buffer, "Ch 2:% i", ADC_Value);
UART_StringSend (UART0, Buffer);
The following problem arises now: Although I can measure 1.65 V at the input, on the PC always arrives a value of about 410, which is wrong:
12-bit: 0 - 4095
Range: 0 - 2.5 V
2.5 V / 4096 * 410 = 0.25 V
What could be the reason? In the firmware Library of ST I have
seen nothing about how to calibrate the ADC!