changed I2C to run directly from IRC

This commit is contained in:
Michael Ossmann 2012-06-06 22:05:03 -06:00
parent bef51163ce
commit 251687fe37
1 changed files with 9 additions and 10 deletions

View File

@ -31,21 +31,20 @@ void i2c0_init(void)
/* enable input on SCL and SDA pins */
SCU_SFSI2C0 = SCU_I2C0_NOMINAL;
/* use PLL1 as clock source for APB1 (including I2C0) */
CGU_BASE_APB1_CLK = (CGU_SRC_PLL1 << CGU_BASE_CLK_SEL_SHIFT);
/* use IRC as clock source for APB1 (including I2C0) */
CGU_BASE_APB1_CLK = (CGU_SRC_IRC << CGU_BASE_CLK_SEL_SHIFT);
/* FIXME assuming we're on IRC at 96 MHz */
/* FIXME assuming we're on IRC at 12 MHz */
/* 400 kHz I2C */
/*
I2C0_SCLH = 120;
I2C0_SCLL = 120;
*/
I2C0_SCLH = 15;
I2C0_SCLL = 15;
/* 100 kHz I2C */
I2C0_SCLH = 480;
I2C0_SCLL = 480;
/* FIXME not sure why this appears to run at about 290 kHz */
/*
I2C0_SCLH = 60;
I2C0_SCLL = 60;
*/
/* clear the control bits */
I2C0_CONCLR = (I2C_CONCLR_AAC | I2C_CONCLR_SIC