cancel
Showing results for 
Search instead for 
Did you mean: 

undefined reference to `HAL_ADC_Init'

msche.1
Associate III

I've been trying for hours to read an analog value from a pin and write it over UART with no success on my STM32MP1. I've assigned PF14 to ADC2_INN2 and set IN2 to "IN2 Differential", then I generate the code and when I try to build I get a bunch of errors with regards to HAL functions.

 

I have "#define HAL_ADC_MODULE_ENABLED" in my stm32mp1xx_hal_conf.h, which I thought would be what I needed.

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @msche.1​ ,

I generated a project using your ioc file and I didn't face any issue. There were no compilation error. I also tried to start a project from scratch with the same config and still, no error generated.

Could you please share your project to help you solve the issue?

Thanks,

Sara.

View solution in original post

5 REPLIES 5
Sara BEN HADJ YAHYA
ST Employee

Hello @msche.1​ ,

Thanks for your feedback,

Could you please share your .ioc file and specify the CubeMX version?

Thanks,

Sara.

Thanks for the help @Sara BEN HADJ YAHYA​.

IOC attached.

CubeMx Version: 6.4.0-RC4

Sara BEN HADJ YAHYA
ST Employee

Hello @msche.1​ ,

I generated a project using your ioc file and I didn't face any issue. There were no compilation error. I also tried to start a project from scratch with the same config and still, no error generated.

Could you please share your project to help you solve the issue?

Thanks,

Sara.

Strange, I imported my IOC and all my code from main.c and it's working now.

TAlme.2
Associate

even you enable the HAL_ADC_MODULE_ENABLED into hal conf file, you should add $(DRIVER_DIR)/stm32f1xx_hal_adc.c \ in C_SOURCES into makefile to compile all adc HAL functions.