Problem in lpc17xx_i2c.c

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mfc on Sun Dec 05 02:56:55 MST 2010
I discovered a problem in the subject source code today -- I cannot find where to report it, so I'm putting it here in the hope that it might save someone some time.   The problem it causes is that the i2c2 clock runs twice as fast as specified, which could make some devices unreliable.

Mike Cowlishaw


[FONT=Courier New]In lpc17xx_i2c.c the I2C_SetClock function has an error; in the case of I2Cx == LPC_I2C2, the line[/FONT]
[INDENT][FONT=Courier New]  temp = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_I2C1) / target_clock;[/FONT]
[/INDENT][FONT=Courier New]should be:[/FONT]
[INDENT][FONT=Courier New]  temp = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_I2C2) / target_clock;[/FONT]