Skip to main content
msche.1
Associate III
February 3, 2022
Solved

undefined reference to `HAL_ADC_Init'

  • February 3, 2022
  • 3 replies
  • 4061 views

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.

This topic has been closed for replies.
Best answer by Sara BEN HADJ YAHYA

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.

3 replies

ST Employee
February 4, 2022

Hello @msche.1​ ,

Thanks for your feedback,

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

Thanks,

Sara.

msche.1
msche.1Author
Associate III
February 6, 2022

Thanks for the help @Sara BEN HADJ YAHYA​.

IOC attached.

CubeMx Version: 6.4.0-RC4

ST Employee
February 7, 2022

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.

msche.1
msche.1Author
Associate III
February 7, 2022

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

TAlme.2
Visitor II
March 17, 2023

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.