Skip to main content
hamid
Visitor II
February 19, 2015
Question

Does CubeMX code generator has some problems in I2C or not?

  • February 19, 2015
  • 11 replies
  • 3004 views
Posted on February 19, 2015 at 10:31

I'm a beginner in stm32Fx. I'm using Keil IDE and cubeMX code generator.

I've used I2C1 and I2C3 in my board with stm32f407 microcontroller and used cubeMX for generating initial codes. I've tried to use I2C3 and it didn't work but I2C1 worked correctly.

I've tested cubeMX code generator in my stmf429 discovery board and the same issue. I2C1 worked and I2C3 didn't work.

I have found a website that has very good libraries with drivers but not as complete as stm's, in that libraries all I2Cs work properly.

Does CubeMX code generator has some problems in I2C or not?

Thank you

 Best regaurds

#auto-corrected-dyslexia #cubemx #i2c-stm32f4
This topic has been closed for replies.

11 replies

montagnanigiovanni
Associate III
March 9, 2015
Posted on March 09, 2015 at 17:16

thank you mayla,

i think that the code generated initialize first the GPIO, don't think so?

i post here the code snippet taken from msp_init.

GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;

    GPIO_InitStruct.Pull = GPIO_PULLUP;

    GPIO_InitStruct.Speed = GPIO_SPEED_LOW;

    GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;

    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

i've already patched my prototype, anyway, so solving this issue is just curiosity now :)

thank you

Giovanni