cancel
Showing results for 
Search instead for 
Did you mean: 

missing ADCPRE configuration in systeminit() ?

konrad
Associate
Posted on June 03, 2013 at 16:57

Hello everybody,

I set up the (new) 3.5.0 lib in our project and configured the clock (via &sharpdefine SYSCLK_FREQ_36MHz  36000000) but the ADCPRE register did not get configured correctly.

I'm missing the part where ADCPRE gets configured. It seems it has its initial/default value ''00'' -> so PCLK2 will be divided by2 and this makes ADCCLK 18MHz(!)

ADCCLK shall be 14MHz or less so i have to get the ADCPRE to ''4'' / ''01''. (-> 9MHz)

We used lib V2.0.1 earlier and there was a statement like ''RCC_ADCCLKConfig(RCC_PCLK2_Div4);'' this was done in a non-ST function.

Do i have to do this the same way? (like adding this statement in systeminit() ) or where is the part i'm missing?

Thanks in advance!

#rcc-adcpre-pcclk2-stdperiph_lib
2 REPLIES 2
Posted on June 03, 2013 at 17:21

The typical scheme of things is to take a localized copy of system_stm32f10x.c in your project, and recode it in a fashion that matches your hardware's clocking strategy. This is especially true where your external crystal or PLL settings differ from ST's usage.

The ADC examples in the library use the standard system file, and reconfigure the ADC in the RCC_Configuration() routine. STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\ADC\3ADCs_DMA\main.c

void RCC_Configuration(void)
{
/* ADCCLK = PCLK2/4 */
RCC_ADCCLKConfig(RCC_PCLK2_Div4);
...

You'd have to decide what method best suits your needs.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
konrad
Associate
Posted on June 04, 2013 at 09:13

Ah, okay. Thank you.