From 06b2bd507f7b64267d4e73885c354c917a9dfa5b Mon Sep 17 00:00:00 2001 From: "Brian J. Nemec" Date: Fri, 24 May 2019 11:31:12 -0700 Subject: sweetberry: update I2C clock speeds to match spec/measurements. All 4 I2C ports on the Sweetberry were configured at 800 KHz. 3 of the I2C ports are limited to 400 KHz and the FMP I2C port can be up to 1 MHz. This means that 3 of the slower speed I2C ports are out of spec by a factor of two. Traces of the rails showed that the rails were still functioning at 800 KHz, although the FMP I2C rail is actually at 896 KHz. The STM32F4 Reference Manual Rev4 does not indicate which potential problems occur when operating in this condition. The I2C speeds were adjusted to match spec with the 3 slow speed ports set to 400 KHZ. The I2C prescalers for the FMP I2C port do not have a suitable 1 MHz configuration at our system clock speed so the FMP I2C rail was adjusted to 900 KHz to match the measured speed within 2% for all rails. The cost of this change is the scan time for a group of 28 INA's increased from 4.9 ms to 5.5 ms. BRANCH=servo BUG=b:133503970 TEST=Verified Sweetberry can measure rails when used with powerlog. Observed I2C rail activity using a Saleae analyzer. Signed-off-by: Brian Nemec Change-Id: Id345c1dd902212b92089e5ab3e04dd187efb4542 Reviewed-on: https://chromium-review.googlesource.com/1628641 Commit-Ready: Brian Nemec Tested-by: Brian Nemec Legacy-Commit-Queue: Commit Bot Reviewed-by: Todd Broch Reviewed-by: Brian Nemec --- board/sweetberry/board.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'board/sweetberry/board.c') diff --git a/board/sweetberry/board.c b/board/sweetberry/board.c index 2d94f06f76..66b21a81b9 100644 --- a/board/sweetberry/board.c +++ b/board/sweetberry/board.c @@ -59,13 +59,13 @@ struct dwc_usb usb_ctl = { /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - {"i2c1", I2C_PORT_0, 800, + {"i2c1", I2C_PORT_0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, - {"i2c2", I2C_PORT_1, 800, + {"i2c2", I2C_PORT_1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, - {"i2c3", I2C_PORT_2, 800, + {"i2c3", I2C_PORT_2, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA}, - {"fmpi2c4", FMPI2C_PORT_3, 800, + {"fmpi2c4", FMPI2C_PORT_3, 900, GPIO_FMPI2C_SCL, GPIO_FMPI2C_SDA}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -- cgit v1.2.1