UART and ADC problems caused by Clock config?

OP #1172807
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

Reply

A question of your own? This thread is over 19 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.