From 1a4bf7fdaa58d7e05d33bc1faf3fceed8b6ad07a Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Wed, 18 Jun 2014 10:10:12 -0700 Subject: [PATCH] zinger: update current and voltage sensing gains On the P2 boards, the operational amplifier gain for current sensing is exactly x100 rather than x101. (non-inverter configuration with R1=1.8kOhm R2=178kOhm) The voltage gain constant had a typo introducing a 10% error. the voltage divider is 10k/100k,so it's x11 gain. ie it should be written (10+100)/10 rather than (10+110). Signed-off-by: Vincent Palatin BRANCH=none BUG=chrome-os-partner:28331 TEST=make BOARD=zinger checked manually with a voltmeter and traces. Change-Id: I8097ab50149fee319efc11ebae75802e8a49a7f8 Reviewed-on: https://chromium-review.googlesource.com/204540 Reviewed-by: Alec Berg Commit-Queue: Vincent Palatin Tested-by: Vincent Palatin --- board/zinger/usb_pd_policy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c index 83737b717b..ee03ec7ccc 100644 --- a/board/zinger/usb_pd_policy.c +++ b/board/zinger/usb_pd_policy.c @@ -75,9 +75,9 @@ static timestamp_t fault_deadline; /* Current sense resistor : 5 milliOhm */ #define R_SENSE 5 /* VBUS voltage is measured through 10k / 100k voltage divider = /11 */ -#define VOLT_DIV ((10+110)/10) -/* The current sensing op-amp has a x101 gain */ -#define CURR_GAIN 101 +#define VOLT_DIV ((10+100)/10) +/* The current sensing op-amp has a x100 gain */ +#define CURR_GAIN 100 /* convert VBUS voltage in raw ADC value */ #define VBUS_MV(mv) ((mv)*ADC_SCALE/VOLT_DIV/VDDA_MV) /* convert VBUS current in raw ADC value */