Skip to main content
msche.1
Associate III
Feb 3, 2022 21:38 UTC
Solved

undefined reference to `HAL_ADC_Init'

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.
Sara BEN HADJ YAHYA
ST Technical Moderator
Feb 7, 2022 08:47 UTC

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.

5 replies

Sara BEN HADJ YAHYA
ST Technical Moderator
Feb 4, 2022 09:59 UTC

Hello @msche.1​ ,

Thanks for your feedback,

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

Thanks,

Sara.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
msche.1
msche.1Author
Associate III
Feb 6, 2022 20:23 UTC

Thanks for the help @Sara BEN HADJ YAHYA​.

IOC attached.

CubeMx Version: 6.4.0-RC4

Sara BEN HADJ YAHYA
ST Technical Moderator
Feb 7, 2022 08:47 UTC

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
msche.1
msche.1Author
Associate III
Feb 7, 2022 18:56 UTC

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

TAlme.2
Visitor II
Mar 17, 2023 12:34 UTC

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.