cancel
Showing results for 
Search instead for 
Did you mean: 

RCC_AHB1PeriphClockCmd could not be resolved

yoma1993
Associate II
Posted on May 23, 2015 at 07:33

Hello again,

Im decided to switch my first project stm32 from the HAL driver library to the SPL. I was able to get a blinky program working using the STCubeMX software and Kei1 with the HAL drives, but i want to write the code om my own in Eclipse. Everything seems to be working, but i can't figure out why i cannot resolveRCC_AHB1PeriphClockCmd(). I believe i have included all the necessary files. I went into

stm32f10x_conf.h

and uncommented _gpio.h, _rcc.h, and alsouncommitted#define STM32F10X_MD and#define USE_STDPERIPH_DRIVER in

stm32f10x.h

but im still getting errors. I also tried to include _rcc.h directly into main as you can see in my code with no luck. Anysuggestions?

#include <
stm32f10x.h
>
#include <
stm32f10x_conf.h
>
#include <
stdio.h
>
#include <
stdlib.h
>
#include ''diag/Trace.h''
#include ''stm32f1-stdperiph\stm32f10x_rcc.h''
#define GPIO_PORT GPIOC
#define GPIO_PIN GPIO_PIN_13
//Prototypes
void GPIO_Init(void);
GPIO_InitTypeDef GPIO_InitStruct;
int main(/*int argc, char* argv[]*/)
{
// At this stage the system clock should have already been configured
// at high speed.
// Infinite loop
while (1)
{
// Add your code here.
}
return 0;
}
void GPIO_Init(void) {
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
}

5 REPLIES 5
tm3341
Associate II
Posted on May 23, 2015 at 10:07

You can always open .h (in your case _rcc.h) file and check how it is designed.

F10x devices does not have AHB1, AHB2, AHBx.. but only AHB.

So, you have to do it like this:

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_PERIPHNAME, ENABLE);

Btw..GPIOs are on APB2 bus, so:

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);

Posted on May 23, 2015 at 13:40

You'd really want to review the templates for other platforms, and have the IDE pass the USE_STDPERIPH_DRIVER define to the compiler.

Your project will also need to actually include the individual library source files you are using, ie stm32f1xx_gpio.c, stm32f1xx_rcc.c so the linker actually has some function to bind against. Just #including definitions and prototypes does not achieve this.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
yoma1993
Associate II
Posted on May 23, 2015 at 20:26

Thanks majerle for the insight. I just got it working. Strange because in the SPL API reference sheet it said to useAHB1. Maybe I missed something.

Clive1, I was wondering about that. My code is working

without

including rcc.c and gpio.c files. I went into the *.h files and didn't see any include *.c statements. Any idea what the compiler/linker is doing? Working code for reference.

#include <
stm32f10x.h
>
#include <
stm32f10x_conf.h
>
#include <
stdio.h
>
#include <
stdlib.h
>
#include ''diag/Trace.h''
#define GPIO_PORT GPIOC
#define GPIO_PIN GPIO_PIN_13
//Prototypes
void GPIO_Init(void);
GPIO_InitTypeDef GPIO_InitStruct;
int main(/*int argc, char* argv[]*/) {
while (1) { }
return 0;
}
void GPIO_Init(void) {
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
}

yoma1993
Associate II
Posted on May 23, 2015 at 21:02

Does anyone know where i can find the STM32F1xx Standard Peripheral Library PDF? Currently i'm using STM32F2xx Standard Peripheral Library and its causing me a lot of problems.

tm3341
Associate II
Posted on May 27, 2015 at 08:36

Why would you need PDF for that?

Open .c file of your driver, there is vell explained everything you need.