cancel
Showing results for 
Search instead for 
Did you mean: 

addin HAL driver to blinky project

SKaro
Associate II

I have started from blinky project and want to extend it for some PWM outputs on TIM2.

For this I need to make use of stm32f3xx_ll_tim.h.

I added into my main.c #include <stm32f3xx_ll_tim.h> without success

I added the file from 'Manage project Items' also without success!

Is the only way to add this driver over 'Manage Run-Time Environment'? The problem from this wizard I dont know which menu should I add in order to have this driver in my project!

Could anyone please help?

10 REPLIES 10

Define "without success", what errors are you seeing?

Have you set up the Include Paths properly so it can find the .H files?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SKaro
Associate II

Without success means that I cant make use any of the structs from this header file. Form example the file stm32f3xx_ll_tim.h hast a struct called LL_TIM_InitTypeDef, and once I define a variable from this struct (for example: LL_TIM_InitTypeDef TIM_TimeBaseStructure;) I get an error stating (use of undeclared identifier LL_TIM_InitTypeDef)

Do I need to define the include path? it should be already known from keil.

The .h file is located under C:\Keil_v5\ARM\PACK\Keil\STM32F3xx_DFP\2.1.0\Drivers\STM32F3xx_HAL_Driver\Inc

If this were an error, then I would get the error in the include line!!

You should be able to click on the .h file in the dependency tree under the .C, and have it open.

The next thing to check is if any #define/#ifdef stops the body of the file being included.

Make sure you have command line defines STM32F303xC,USE_FULL_LL_DRIVER (part as appropriate)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Under the project tree on the left, when I expand the Blinky.c file under source files, then I can see the intended file (stm32f3xx_ll_tim.h).

This file has been available in this project tree first after adding the line #include "stm32f3xx_ll_tim.h" at the begining of the Blinky.c (which means it seems to be ok!).

Of course wehn I click on this stm32f3xx_ll_tim.h file then I have it opened (write protected mode).

I dont see any discrepency in the header file, so that the body will be stopped.

What you mean with the command line defines? Could you please give more explanation?

Options -> C/C++ -> Preprocessor Symbols -> Define

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I owe you a ver big Thank.

as soon as I added STM32F303xC,USE_FULL_LL_DRIVER to the define then it worked!

But I dont know at all what this means, and why it does not work without it!!

I have again another problem now!

The suggested solution helped to compile the project, but during linking I get again errors like

Blinky.c(52): error: #20: identifier "LL_TIM_BDTR_InitTypeDef" is undefined

Any hint please?

I mean I dont understand why it works only when I define them from Options -> C/C++ -> Preprocessor Symbols -> Define!

Even when I write in my main.c the two define lines then it does not work?!!

#define STM32F303xC

#define USE_FULL_LL_DRIVER

> Even when I write in my main.c the two define lines then it does not work?!!

Because you've defined it only in main.c, Other .c files do not see these defines.

-- pa