Skip to content

Instantly share code, notes, and snippets.

@tstellanova
Last active July 6, 2020 15:30
Show Gist options
  • Save tstellanova/c2a467b50154d34b6e8c1c041094535f to your computer and use it in GitHub Desktop.
Save tstellanova/c2a467b50154d34b6e8c1c041094535f to your computer and use it in GitHub Desktop.
Troubleshooting i2c peripheral failures (stm32h7 edition)

So your i2c device isn't responding to a simple read request from your MCU master?

Hardware

  • Have you swapped SCL and SDA in hardware?
  • Are your cables and connectors good?
  • Is the common ground connection between the MCU and the external device solid?
  • Do you know where the pull-up resistors are?
  • Does the device you're trying to address have power?
  • Do the logic level voltages between the external device and the MCU match?

Software

  • Are you selecting the correct SDA and SCL pins?
  • Have you swapped SDA and SCL pins?
  • If there aren't any hardware pull-up resistors, have you configured the MCU pins for internal pull-ups?
  • Have you configured the pins as open-drain?
  • Are you selecting the correct I2C port?
  • Have you configured and enabled the clock that feeds the selected i2c peripheral?
  • Have you enabled the analog filter ANFOFF?
  • Have you disabled the digital filter DNF?
  • Have you enabled the i2c peripheral before trying to use it?
  • Have you configured the i2c port for the right speed? (100 kHz? 400 kHz?)
  • Have you configured the correct addressing mode (7 bit or 10 bit) ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment