cancel
Showing results for 
Search instead for 
Did you mean: 

I2C_Timing_Config_Tool for F0 and F3

conor
Associate II
Posted on February 26, 2013 at 02:34

I need to configure an I2C slave on an STM32F0 .

The peripheral library refers to an 'I2C_Timing_Config_Tool' and googling suggests that application note AN4235

 I2C timing configuration tool for STM32F3xxxx and STM32F0xxxx

 is relevant. All traces of this document appear to have been removed from st.com.

Since this incarnation of I2C is new to the F0 and F3 (as far as I know), I could use a little guidance.

-- Conor

#amazing-google-skills #i2c-timing_config_tool-stm32f0
10 REPLIES 10
andrew239955_st
Associate
Posted on August 28, 2015 at 22:13

A bit late to the party... but here is what I found and am using in my code for an STM32F3XX:

<code>

        /*                                                                             

         * Timing fun for I2C in STM32F303XX Series...                                 

         *                                                                             

         * 400 KHz Bus Speed.  This was derived using the STM32F303x                   

         * reference manual, which I apparently could never find.  Assumes             

         * we are using the default HSI clock which runs at 8MHz.  Values              

         * came from page 856, Table 148.                                              

         *                                                                             

         * PRESC  = 0x0                                                                

         * SCLL   = 0x9                                                                

         * SCLH   = 0x3                                                                

         * SDADEL = 0x1                                                                

         * SCLDEL = 0x3                                                                

         *                                                                             

         * Timing Register Layout (Bits in Paren):                                     

         * [PRESC(4)][N/A(4)][SCLDEL(4)][SDADEL(4)][SCLH(8)][SCLL(8)]                  

         *                                                                             

         * Therefore I2C_Timing = 0x00310309                                           

         */

        I2C_InitStruct.I2C_Timing = 0x00310309;

</code>