Hi,
I am working on a firmware for STR711 that uses all three UARTs and ADC,
but now I have two problems and I believe that is related with clock
configuration.
First problem: All baudrates work except 115200.
Second problem: ADC doesn't work. I always get buffer overrun status.
Bellow is the code for clock configuration and ADC (my clock input is
4Mhz):
//Clock configuration:
RCCU_Div2Config( ENABLE );
RCCU_MCLKConfig (RCCU_DEFAULT);
RCCU_FCLKConfig ( RCCU_RCLK/2 );
RCCU_PCLKConfig ( RCCU_RCLK/2 );
RCCU_PLL1Config ( RCCU_PLL1_Mul_24, RCCU_Div_1 );
while( RCCU_FlagStatus( RCCU_PLL1_LOCK ) == RESET );
RCCU_RCLKSourceConfig (RCCU_PLL1_Output) ;
---------------------------------------------------------------
//ADC configuration:
GPIO_Config (GPIO1, ADC0_Pin, GPIO_HI_AIN_TRI);
ADC12_Init();
ADC12_PrescalerConfig(1172);
ADC12_ModeConfig (ADC12_SINGLE);
ADC12_ChannelSelect(ADC12_CHANNEL0);
---------------------------------------------------------------
//ADC usage
ADC12_ConversionStart();
while (ADC12_FlagStatus(ADC12_DA0) == RESET);
if (ADC12_FlagStatus(ADC12_OR) == RESET)
{
error = 0;
value = ADC12_ConversionValue(ADC12_CHANNEL0);
}
else
{
error = 1;
}
ADC12_ConversionStop();
//the error flag is always with value 1!
So, the main question is: what is the problem? =)
Thanks in advance,
Bruno Vilhena Adorno
Did anybody already use analog-digital converter in STR711? Thanks, Bruno
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.