Skip to content

Debugging tool for I2C networks, built for STM32 microcontrollers

License

Notifications You must be signed in to change notification settings

kongr45gpen/i2c-sniffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

15e4ad3 · Sep 26, 2021

History

20 Commits
Sep 26, 2021
May 22, 2020
Apr 5, 2018
Sep 26, 2021
Sep 26, 2021
Apr 5, 2018
Sep 26, 2021
Sep 26, 2021
May 22, 2020
Sep 26, 2021
Sep 26, 2021
Oct 23, 2018
Sep 26, 2021
Apr 5, 2018
Apr 5, 2018
Sep 26, 2021
May 22, 2020
Apr 5, 2018
Apr 5, 2018

Repository files navigation

I2C sniffer project

  • Board: STM32F103C8T6 "Blue Pill"
  • Pins used:
    • PA9: TX (connect to serial RX)
    • PA10: RX (connect to serial TX)
    • PB8: SCL
    • PB9: SDA
  • Serial baud rate: 3 000 000 bits/s
  • Additional required hardware: FTDI232 (or similar) USB-to-Serial converter

Project Purpose

This project is built to connect to any I2C network and process any data sent through it in a transparent way. It's useful for debugging faulty networks.

Notes

  • This project was built in STM32CubeMX for the free STM32CubeIDE. If you load the project in STM32CubeMX, you can export it to use any other IDE of your choice.

  • This project sets the processor clock to 72 MHz, the highest one achievable, so that the I2C data can be processed as fast as possible.

  • The serial output contains colours. If your terminal doesn't support colours, you might see garbled characters.

  • UART is used to output the data. You can connect an FTDI232 USB-to-Serial converter to receive the information. Note that you have to use a converter that supports a baud rate of 3 Mbits/sec.

    The command I used to open the terminal on linux was:

    minicom -s -c on -b 3000000 -D /dev/ttyUSB0

    You can also use RealTerm on Windows.

  • The HAL driver is used, but all the necessary driver files are included in the Drivers folder.

Important files

  • Src/main.c: The source code of the project
  • i2c_sniffer.ioc: Open this file inside STM32CubeMX to edit the project.

Screenshot

I2C Sniffer serial output screenshot

Schematic

Project Schematic

Frequently Asked Questions

Q: Where can I buy the required board for this application?
A: The board needed is the small development board "Blue Pill" for an STM32F1 microcontroller. It costs about 2$ and can be found on common marketplaces like ebay or AliExpress (search for STM32F103C8T6). When getting started with these chips, you will also need an ST-Link device (~2$) available at the same sites, in order to program it.
Finally, an FTDI232 board (~2$) will be needed for serial communication with the Blue Pill.
In total, this sniffer should set you back by less than 6$, if you don't already have the required components.