i2c communicate

787562067 googcheng at qq.com
Tue Apr 2 10:39:10 UTC 2019


HI, ALL!
    I have added some configure for stm32f407. need some help for i2c configue first







#define STM32F4_PIN_I2C(port, idx, altfunc) \
  { \
    { \
      .pin_first = STM32F4_GPIO_PIN(port, idx), \
      .pin_last = STM32F4_GPIO_PIN(port, idx), \
      .mode = STM32F4_GPIO_MODE_AF, \
      .otype = STM32F4_GPIO_OTYPE_OPEN_DRAIN, \
      .ospeed = STM32F4_GPIO_OSPEED_2_MHZ, \
      .pupd = STM32F4_GPIO_PULL_UP, \
      .af = altfunc \
    } \
  }

#define STM32F4_PIN_I2C1_SCL      STM32F4_PIN_I2C(1, 8, STM32F4_GPIO_AF_I2C1)
#define STM32F4_PIN_I2C1_SDA      STM32F4_PIN_I2C(1, 9, STM32F4_GPIO_AF_I2C1)
#endif /* STM32F4_FAMILY_F4XXXX */


// in start-config-io.c also add pins

 #ifdef STM32F4_ENABLE_I2C1
    STM32F4_PIN_I2C1_SCL,
    STM32F4_PIN_I2C1_SDA,
  #endif




but i still cant open device like "/dev/i2c-1" or "/dev/i2c-1.eeprom", my board PB8 PB9 is i2c1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20190402/9b9207c1/attachment.html>


More information about the users mailing list