cancel
Showing results for 
Search instead for 
Did you mean: 

I cannot use the HAL functions for ADC?

SStad.1
Associate II

Hey there,

I tried to modify an existing project by using the ADC to measure a current. My problem is when I try to include the header stm32l4xx_hal_adc.h and use the functions like HAL_ADC_Start(); i will get the error undefined "reference to...". It's the same for every function declared in the header. The path for the header is added to the compiler. Some definitions from the header are recogniced only the functions aren't. Does anyone know how to solve this problem?

Thanks in advance.

0693W000003BaB4QAK.jpg

1 ACCEPTED SOLUTION

Accepted Solutions

Here are my steps leading to result ok from scratch

1) Import SW4STM32 project

0693W000003BbT4QAK.jpg

0693W000003BbTTQA0.jpg

2) Set defines (*_conf.h file is not local to project but part of the pack ... considering file system. In other words I've not a local copy ...)

0693W000003Bc8gQAC.jpg

3) Add source code to main.c

0693W000003Bc8lQAC.jpg

4) Add required .c files

0693W000003BbSaQAK.jpg

0693W000003Bc9AQAS.jpg

5) Get compile success

0693W000003Bc0OQAS.jpg

View solution in original post

24 REPLIES 24

Check modules enabled in stm32l4xx_hal_conf.h

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

Include path definitionissue ? ... could be same as : https://community.st.com/s/question/0D53W00000DJpGPSA1/file-added-and-path-added-but-still-get-no-such-file

Takes care about your include coloring ... Is such include setup effective from Eclipse point of view already ? Please could you check if such line is leading to plain or grayed include like following snapshot ... if grayed means Eclipse not able to reach

0693W000003BZiCQAW.jpg

Then if ok possibly some define to enable stuff as advised by @Community member​ 

SStad.1
Associate II

0693W000003BakYQAS.jpg

Thanks for the quick answers!

I think the paths are valid, nothing is grey.

What could be the problem with define to enabel?

I'm relatively new to programming.

SStad.1
Associate II

So I think #define HAL_ADC_MODULE_ENABELD is missing?0693W000003BarFQAS.jpg

These kind of define to be uncommented in sync. with your IP(s) usage.

0693W000003BaswQAC.jpg

I guess so.

SStad.1
Associate II

Still the same Error.

MM..1
Chief III

I recomm create your project from scratch in CubeMX .

Could you x2 check your Drivers/STM32L4xx_HAL_Driver/Inc & Src content ?

Are .h/.c files here ? Are .h/.c files exist ?

Takes care to small icon overlay on files like ...

0693W000003Bb5IQAS.jpg

0693W000003BbAlQAK.jpg