cancel
Showing results for 
Search instead for 
Did you mean: 

about I2C Library question

jhsong1
Associate II
Posted on July 30, 2008 at 06:13

about I2C Library question

1 REPLY 1
jhsong1
Associate II
Posted on May 17, 2011 at 12:40

hello

I have a question I2C Library(stm32f10x_i2c.c)

void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct)

{

/* Configure speed in standard mode */

if (I2C_InitStruct->I2C_ClockSpeed <= 100000)

{

......

/* Set Maximum Rise Time: ((1000/(1000000000/pclk1clock))+1 */

I2Cx->TRISE = freqrange + 1;

}

/* Configure speed in fast mode */

else /*(I2C_InitStruct->I2C_ClockSpeed <= 400000)*/

{

/* Set Maximum Rise Time: ((300/(1000000000/pclk1clock))+1 */

I2Cx->TRISE = (u16)(((freqrange * 300) / 1000) + 1);

}

....

}//end func

Plz, look commet.

'' Set Maximum Rise Time: ((1000/(1000000000/pclk1clock))+1 ''

--- <- How compute this number(1000ns)?

''Set Maximum Rise Time: ((300/(1000000000/pclk1clock))+1 ''

--- <- How compute this number(300ns)?

plz answer my question.

p.s. : Have a good time~