EmbDev.net

Forum: ARM programming with GCC/GNU tools UART and ADC problems caused by Clock config?


Author: Bruno Adorno (bvadorno)
Posted on:

Rate this post
0 useful
not useful
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

Author: Bruno Adorno (bvadorno)
Posted on:

Rate this post
0 useful
not useful
Did anybody already use analog-digital converter in STR711?

Thanks,
Bruno

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.