lpc176x: Enable full speed peripheral clocks on SPI and I2C
Scale the bus speed within the peripheral instead of on the system bus as scaling on the system bus slows down general register access to the peripheral. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -29,7 +29,8 @@ i2c_init(void)
|
||||
gpio_peripheral(0, 1, 3, 0);
|
||||
|
||||
// Set 100Khz frequency
|
||||
uint32_t PCLK = SystemCoreClock / 4, pulse = PCLK / (100000 * 2);
|
||||
enable_peripheral_clock(PCLK_I2C1);
|
||||
uint32_t pclk = SystemCoreClock, pulse = pclk / (100000 * 2);
|
||||
LPC_I2C1->I2SCLL = pulse;
|
||||
LPC_I2C1->I2SCLH = pulse;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user