cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE 1.6.1 does not generate I2c handle and initialisation

LARBE.1
Associate II

Hi,

I am currently working on a STM32F303RE wired to a STEVAL-MKI195v1 throught a nucleo-iks01a2. When I tick the box corresponding to the mems package I use for data-retrieving from the lsm6dsrx on the STEVAL-MKI195v1 board. It does not add some code generating an i2c handle nor it initialise the i2c communication protocol. But when I don't tick the box and then can't use the provided lsm6dsrx.c and lsm6dsrx_reg.c and corresponding files .h.

If someone knows a solution to this problem or could tell me where my I2C protocol is initialized it would be of great help. I joined a screenshot to give a bit of context if needed.

The tickbox.0693W00000BZufEQAT.png 

Thank you in advance.

-Loïc

7 REPLIES 7
niccolò
ST Employee

Hi @Loïc ARBEZ​ ,

if you go to the system view, are you able to select the I2C communication and see the parameters?

if you see those here, in your source code you should be able to find the Initialization function at the start of main().

from there you should be able to find the handle of the I2C comm you are using.

hope this helps

Niccolò

p.s. if you found a solution to your problem, please, select a best answer to help other users with similar issues

Cartu38 OpenDev
Lead II

@Loïc ARBEZ​ I'm able to face the same. Sounds like a bug because finally being able to achieve my goal but sounds weird.

1) Based on attached .ioc file as code generation result I'm getting <=> I2C1 init is lacking !!!

0693W00000BaSF0QAN.jpg I2C1 setup is

0693W00000BaSFAQA3.jpg 

2) If I'm moving I2C1 setup to

0693W00000BaSFPQA3.jpgThen ask for code generation some I2C init is happening !

3) Let's come back to my expected setup

0693W00000BaSFAQA3.jpgThen ask for code generation finally I'm able to get my expected I2C init !!!!!!

0693W00000BaSFUQA3.jpg 

@STM please fill a bug and proceed to fix !!!!

Cartu38 OpenDev
Lead II

.ioc file to reproduce setup

Thanks @niccolo.ruffini​, but my problem seems to be similar to @Cartu38 OpenDev​'s one. I tried his method, it seemed to have worked at first. But I then realised I did not tick the box when switching to the I2C mode.

After I followed his protocol I have finally have a I2C initialisation as he said.

0693W00000BaUVyQAN.jpg 

But I realised the box was not ticked.

0693W00000BaUXGQA3.png 

And if I tick the box the I2C initialisation disappears.

0693W00000BaUYsQAN.png 

I have left my .ioc file in attachement if needed.

niccolò
ST Employee

Hi,

we are currently looking into the problem, sorry for the delay

Niccolò

This bug is still present, I just hit it.

Enabling I2C1 and I2C2, only I2C2 will show up in CubeMX's 'Generated Function Calls' list. But then set I2C1 to SMBus it shows up. Set it back to I2C and the entry in the list remains.

CubeMX 6.9.1 with G4 package 1.5.1 (STM32G431CBUx MCU selected).

Foued_KH
ST Employee

Hello @LARBE.1 , 

when you use the CMSIS pack of the MEMS, the MX_I2C1_Init() is located in the file stm32zzyyxx_nucleo_bus.c and not in the main.c.

Foued

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.