2017-08-14 07:32 AM
Hello, I am using STM32Cube lib to development my project which include both spi and i2c communication.
So I develop the project based on the SPI example in STM32Cube example package.
However the initial project do not include stm32l4xx_hal_i2c.c and stm32l4xx_hal_i2c.h. So I added them by right click the project driver group to add the two files into project. The path is well reveiwed. there is no problem with path. .h from inc and .c from src folder.
However, the
stm32l4xx_hal_i2c is added, but its dependancies do not include stm32l4xx_hal_i2c.h. And the project can not be built successfully. Showing :
STM32L432KC_NUCLEO\STM32L432KC_NUCLEO.axf: Error: L6218E: Undefined symbol HAL_I2C_Init (referred from hsensor_i2c.o).
STM32L432KC_NUCLEO\STM32L432KC_NUCLEO.axf: Error: L6218E: Undefined symbol HAL_I2C_Master_Receive_IT (referred from hsensor_i2c.o).
HAL_I2C_Master_Receive_IT and HAL_I2C_Init are both from stm32l4xx_hal_i2c.h.
Could any one help me with this ? Is there configuration files to be modified ?
Thank you!
Yu LU
2017-08-15 04:33 AM
Hi
,You have to enable the I2C modules in the file stm32l4xx_hal_conf.h:
#define HAL_I2C_MODULE_ENABLED�?
You may check some ready to use examples available in the Cube package underSTM32Cube_FW_L4_V1.8.0\Projects\STM32L432KC-Nucleo\Examples\I2C.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.