[sdiy] I2C on STM32F0 parts

Eric Brombaugh ebrombaugh1 at cox.net
Tue Nov 29 00:33:52 CET 2016

On 11/28/2016 03:36 PM, Chris McDowell wrote:
> Howdy list,
> Does anyone here have any examples or pointers for how to initialize and use the I2C peripheral on STM32F0 micros using the Standard Peripheral Library? I love the ST chips, and they -almost- always just work wonderfully, but I2C is really stumping me. I've spent a few days at work scoping data to no avail. I understand how it is supposed to work, but am missing something somewhere either in configuration, or in when to wait for which flags, etc. The examples included with the std periph lib aren't doing me much good (is this really how most folks get to know these libraries?) so any pointers would be greatly appreciated!

I've not had any issues with using the I2C port on STM32F0xx parts. I've 
got some example code for that here:


(scroll down to the Design Resources area - the f030_oled.zip file)

It's like most STM32 peripherals - enable the I/O pins, set the 
alternate functions, enable the clock and configure the port. I2C has 
some odd extra stuff that you may need depending on which pins you're 
using - sometimes there's a mux setting in the system configuration 
section for alternate outputs but I haven't used that in this project.


More information about the Synth-diy mailing list