cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX HAL_I2C_MODULE_ENABLED

artgodwin
Associate II
Posted on October 06, 2015 at 17:44

If I build a Cube config using the stm32f303vctx processor and enable an I2C port, I get HAL_I2C_MODULE_ENABLED in the sources and a hal_i2c include file included.

However, if I use the 'stm32f3discovery' board profile., I don't get that macro enabled and instead, an I2C init function is created in main.c

Why is this ?

3 REPLIES 3
Amel NASRI
ST Employee
Posted on October 12, 2015 at 14:46

Hi artag,

If there is a call of I2C_Init without enabling the I2C module, you will automatically get a compilation error. Is this what you have really as problem?

-Mayla-

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.

artgodwin
Associate II
Posted on October 14, 2015 at 16:14

Hi Mayla,

I don't get a compilation error in either case.

I'm comparing the code generated by the Cube utility if I enable an I2C device, either as an individual configuration based on the 32f303 or using the 32f3discovery board config. I'd expect the code to be similar and produce a HAL template for both, but instead the f3discovery config produces localised driver code - it doesn't seem to use the HAL code.

I would like to know what causes different code to be generated, and why the discovery code doesn't use the HAL library.

Amel NASRI
ST Employee
Posted on October 15, 2015 at 17:12

Hi artag,

It is using the HAL drivers, but it is adding the initialization of used peripherals in the discovery hardware. You have to check the user manual of your board in order to know pins used by components in the F3 discovery board.

If you are using F303 on standalone, all peripherals and pins are free at the beginning. That is the difference.

-Mayla-

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.