Design Notes	
Lower Half Elex Board, Coastal Profiling Float

2018-05-01	ECM	create
2018-08-15	ECM	change LT4314 I2C mux to distributed analog switches
2018-11-14	ECM	change ideal diode/load switch from LTC4414 to LTC4412 for power saving
			Delete regen
2019-01-08	ECM	change HC4060 timer to MC14536; I2C port to TCA6408; add sleep timer

1. Requirements
(most from GM email 2018-01-30)
1.1. Manage 6 Inspired Energy 8S1P sticks (selectable 2 thru 6).  Voltage 20 – 33.6V.  
	Charge sequentially, discharge in parallel
	I2C/SMBus SmartBattery communication

1.2. Battery stick ratings are 1.5A charge, 4A discharge.  Application max discharge 8A total.
	Provide input and output overcurrent protection as appropriate.

1.3. Charge source is Inspired Energy ‘smart charger’ model PH4000A, 36V max at 1.5A max.  
a) Sequence 1 charger through all 6 sticks at rates between 1 min and 10 min per step.
	b) deadface charge input connector when not connected

1.4. Allow motherboard/controller I2C bus access to all 6 packs for charge and discharge monitoring.  Mobo 5V supply available for I2C interface.  During charge, read back selected stick being charged, to allow controller to avoid stepping on charger-battery comms

1.5. Float power on/off control via reed switches on endcap (set/reset momentary).

1.6. Battery on/off sleep timer under Mobo control, with selectable sleep time in the several-minute range.  Endcap reed switches should override sleep function.

1.7. Power control for pump motor drive (Elmo Gold Twitter): on/off, soft start, overcurrent, energy monitor
	a)  8 A max expected operating current at 20V low batt
b)  NO regen control other than stoutest available TVS diode(s) (Per GM, based on difficulty of backdriving pump, and no observed regen in lab test).

1.8. Package in prescribed C-shaped PWB, keep top surface free of live traces if possible

1.9.  Board has power inputs from three sources: 
	Charger 	regulated charge voltage/current, plus 36V pilot signal
	Batteries	battery discharge voltage
	Mobo		5V logic supply for I2C interface
These inputs can combine and interact in various ways.

Operational states need min power draw and max reliability of state transitions:
Deployed, run:		Battery power, Mobo power
Deployed , sleep	Battery power (Mobo sleeping w/ power off)
Charge, run:		Charger power, Battery power, Mobo power
Charge, sleep:		Charger power, Battery power (Mobo sleeping)

Test modes can have less reliability, but need to not damage any parts of the system: 
Charge only		Charger power only (batteries and Mobo disconnected)
Mobo only		Mobo power only (batteries and charger disconnected)
Battery only		Battery power only (charger and Mobo disconnected)

1.10.  Power consumption goal:
Inspired Energy PH2059HD34 sticks are 3230 mAh each or 19,380 mAh for full set of 6.
Goal: allow <5% for P2 board or 969 mAh... this is <110 uA standby for 1 year.

1.11. Optional, future, or be-nice-if:
	Position sensor ADC
	Motorized valve controller
	Elmo Twitter connectorization, or mounting
	“Jostle” wakeup input to sleep timer

2. Description

2.1 Summary:  (See Block Diagram)  The design has six 8S1P battery packs or 'sticks'.  On the charge side, an external (outside the can) smart battery charger is connected to each stick, one at a time, by a hardwired logic sequencer.  On the discharge side, power for all sticks is connected to the discharge battery bus, i.e. main power to the CPF, and data for each stick can be selected and accessed by the motherboard/controller ('Mobo') for status monitoring.  Access to each stick is implemented as a distributed multiplexer using analog switches for the I2C data bus and ideal diode load controllers for the power bus.    A Sleep Timer can disable discharge power, under Mobo control, for programmable periods ranging from 1 to 64 minutes.  Power feed to the float's VB Pump is provided by a power switch and energy monitor, which is connected directly to the battery discharge bus, and provides on/off control to the Mobo, soft start, and electronic circuit breaker functions.  The Mobo interface is implemented as two 8-bit PIO ports connected to the Mobo I2C bus.

2.2 Charge Sequencer:   Oscillator/Timer MC14536 is set to 437 Hz and programmed via inputs ABCD to divide by 2^18.  The output has a 10 minute period and clocks the HC161 counter on positive edges.  Other periods are possible with different clock speeds or divisor values.  The incrementing HC161 counter output is decoded by the HC138 to yield six active-low selects ChgSel0-5, which select one of six multiplexer sections to activate one battery stick at a time.   One of the selects is chosen by configurable jumper and fed back to the HC161 synchronous Load input, which presets the counter to 0001 on the next positive clock edge.  This re-starts the sequence and causes the sequence length to match the configured battery count.  

The counter counts from 1 to n during normal charge operation, and the ChgSel0-5 selects are taken from outputs Y1-Y6 on the HC138, with Y0 not used.   The encoded count (1-6) of the selected stick is available for readback at the Mobo PIO port (SeqCount0-2), which the Mobo reads to avoid stepping on comms between the charger and the selected stick.  When the charger is not present the sequencer is held in a reset and disabled state by Chg_POR (see Power Supplies and Initialization section, below).  In this state the sequence readback to the Mobo will read 0 (rather than 1-6), indicating no charger present.

2.3 Distributed Multiplexer:  Analog switches ADG1611 at each battery stick are used to connect the I2C signals from each stick, one at a time, to either the Charger I2C bus (in response to ChgSel0-5 from the charge sequencer) or to the Mobo I2C bus (in response to I2CSel0-5 from the Mobo PIO port).  During charge it is the Mobo's responsibility to read back the charge sequence count, and to avoid stepping on charger-battery communications.

One additional analog switch ADG802 is used to connect each stick's Thermistor signal to the charger during charge.

On the power side, ideal diode/load controllers LTC4412 plus back-to-back PFETs Si4909DY at each battery stick are used to connect the power terminals of each stick to either the Charger input charge power bus, or to the output Discharge bus.    The diode functionality prevents batteries from back-driving the charger in event of power loss, and from back-driving each other on the discharge side.  The LTC4412 standby current of 15uA in shutdown represents the dominant power draw of the LHE board in Sleep mode. 

The charge connections are made one at a time, in response to the ChgSel0-5 signals from the charge sequencer.  The discharge connections are made all together, under control of the MasterPwrOn signal which is the master power control for the instrument.  Additionally, discharge power is gated off for whichever stick is on charge, by OR gate 741G00 at each stick, in response to ChgSel0-5.  This prevents charge current from flowing to the discharge bus, which it would otherwise do in response to the elevated charge voltage.  

2.4 Mobo PIO Port:  The Mobo controls the LHE board via two TCA6408  8-bit I2C/PIO ports.   The ports can be bitwise configured as either inputs or outputs.   The first port, I2C address 0x21, is largely an output port, and generates the Mobo multiplexer select signals MoboSel0-5, along with the pump power and sleep trigger signals.  The second port, I2C address 0x20, has the sequence readback inputs SeqCount0-2 and the pump power fault (circuit breaker tripped) input.  The second port also has the sleep timer control bits SleepTime0-2.   

2.5 On/Off Control and Sleep Timer:   Flip-Flop 741G74 is the manual power control for the Float.  It is set or reset by momentary closure of the endcap Pwr_On and Pwr_off reed switches, respectively, and its output becomes the MasterPwrOn enable signal to the distributed multiplexer discharge power bus switches.

The sleep timer is an MC14536 oscillator/timer set for 2.185 kHz, with inputs ABC that can be configured for delays from 1 to 64 minutes.   The sleep time is set by Mobo PIO outputs SleepTime0-2, which are clocked into a 74HC174 latch by raising Mobo PIO signal SleepTrig high.   

During normal (non-sleep) float operation, SleepTime0-2 is held to 000, which when latched is applied to AND gate 741G27 to produce the SleepDis signal.    SleepDis resets the sleep timer, stops its oscillator, and forces its output high, which allows AND gate 741G00 to be controlled by the reedswitch power flip-flop to set MasterPwrOn to either the on or off state.

Sleep is enabled by writing a non-zero value to SleepTime0-2, and triggered by raising SleepTrig high to latch the value into the 74HC174.  The SleepTime value n is applied to the timer's ABC inputs, selecting decoder stages corresponding to delays of 2^(n-1) minutes at the timer output.  At the same time, the non-zero value applied to the 741G27 gate allows SleepDis to go low and the timer to begin counting.  The timer output goes low after one timer clock cycle (~0.5 msec), which forces the AND gate to override the manual power flip-flop and set MasterPwrOn to the off state.  The timer output remains low for the commanded sleep time and then goes high, gating MasterPwrOn back to the on state and waking up the Mobo and rest of the float.  The sleep cycle will repeat after another 2^(n-1) minutes, so upon awaking from sleep the Mobo controller should write 000 to SleepTime0-2, and latch it by cycling SleepTrig high and then low.  (This should be part of normal power-on initialization as well.)  After initialization the SleepTime and SleepTrig port bits can be re-configured as inputs, for some additional insurance against inadvertent writes, as they are held in inactive states by pulldowns.

The Float can be powered on or off from any state, asleep or awake, via the endcap reed switches.  If the Float is in sleep mode, the endcap Pwr_On reed switch will set the power control flip-flop and also reset the SleepTime latch to 000, setting SleepDis, disabling the sleep timer, and gating MasterPwrOn to the the on state.

2.6 Power Supplies and Initialization: The LHE board has three separate power sources -- battery, charger, and Mobo -- and different modes of operation depending on their presence or absence.   

The first battery stick, Stick 0, supplies 28V to an LDO regulator which produces Batt5V.  Batt5V powers the sleep timer circuit, and the continuously powered parts of the distributed multiplexer, specifically the power select and enable circuits which need to maintain state during power down or sleep.

The external charger supplies 36V pilot power, whose primary function is to close the deadface relays.  This 36V also supplies an LDO regulator to produce Chg5V, which is active whenever the charger is connected.  

The Mobo supplies 5V power which after filtering becomes Mobo5V, active whenever the Mobo is on.  Mobo5V powers the Mobo-facing side of the TCA6408 PIO ports.

Both Chg5V and Mobo5V are diode-or'd to produce Joint4V7, which is active whenever either the charger or Mobo are on, but which is off during sleep.  Joint 4V7 powers most of the charge sequencer, the I2C section of the distributed multiplexer, and the LHE-facing side of the TCA6408 PIO ports.

When the external charger is first connected, the sequencer section is initialized by power on reset Chg_POR, generated by an LTC2934 supervisor.   Of equal importance, when the charger is absent but Mobo power is present, Chg_POR (powered by Joint4V7) holds the MC14536 in a micropower clock inhibit state, the HC161 is asynchronously reset to count 0000, and the HC138 is disabled with all outputs inactive.  The sequencer section is thus disabled during deployment so it does not interfere with Mobo operation.

When Mobo power goes active, the TCA6408 PIO ports are initialized by supervisor LTC2934 which generates reset signal Mobo_POR.  This resets all internal registers and places all I/O pins in the Input mode.   In this condition, pullup and pulldown resistors on the PIO pins pull the signals to inactive states, until the Mobo controller configures them as part of its initialization.  If the Mobo is absent or off but the charger is present, Mobo_POR (powered by Joint4V7) holds the PIO ports inactive so they do not interfere with charge operation.

No supervisor is provided for Batt5V, since it assumed that battery connection occurs rarely, during assembly in the lab.    The power control flip-flop and sleep timer section will power up in an indeterminate state, but manually cycling the Pwr_On reed switch will reset and disable the sleep timer, and set the power control to the on state.  No damage should occur due to the indeterminate state.

3. Design Notes

3.1 Charge Control Sequencer

MC14536 timer, with RC oscillator, generates timebase for sequencing the battery charge.  Timer set to divide by 2^18 to generate a 600 second (10 minute) clock period; other periods possible 

 1/min to 1/10 min clock (600 sec period).  use clock to advance HC161 sync counter, use HC138 to decode counter, use 138 outputs to select batt sticks for charging (N_ChgSel).  Feed back one N_ChgSel via Stick Count Select jumpers, use it to synchronously Load (Preset) the HC161 to a count of 1.  HC161 counts 1-6, depending on stick count, before re-loading.    

MC14536 Configuration: Keep RC osc above 400 Hz based on note in old Motorola HC4060 spec sheet.  Dynamic Icc per specs is 1.5uA/kHz @ 5V.  Slowest scan 10 min or 600 sec period. 
600 / 2^18 = 2.29 msec à 437 Hz.  Spec sheet Fig.12 says Fosc = 1 / 2.3*R*C, 10k and 0.1uF give 435 Hz with a 5% tol X7R capacitor available (NP0 caps are all 1206 or 1210 size, with boardflex concerns).  Icc in this config would be 1.5uA * 0.435 = 0.65uA.  Icc would rise to 6.5 uA at 4.37 Khz, but sequencer only runs when charger is connected so power not a concern.  Decode Stage inputs (A,B,C,D) for 2^18 are 1001 and must be tied high or low; set this up as hardwired default but run through SolderBlob pads to allow blue-wire changes if necessary. 

Power-On Reset (N_POR):    Seek supervisor circuit with Sense input independent of Vcc pin; totem-pole output to save power (versus open-drain) since N_POR will be active during deployment; internal V divider convenient and probably higher impedance, but not mandatory since divider only powered when Chg5V is present.  Considered MIC803, TPS3808, and LTC2934; choose LTC2934-2 for sub-uA Icc and totem-pole output.  Choose 200msec delay since there are no specific requirements and we’re not in any big hurry.

Channel-Status LEDs:  Can't be connected direct to stick 28V since discharge voltage is present even when charge voltage is not.  HC138 stick select decoder has 5 mA drive for 0.24 Vol, can drive LEDs.  No disable needed since all will be off when charger not present.  Use 0603 green LEDs, 2V Vf and run from Batt5V supply; 3V/5mA = 600 ohm use 620 5%. 

3.2 I2C Mux

Two approaches considered:
1) LTC4314 4-channel I2C Mux/Buffer (2 ea).   Dropped this due to complex (req. software mediation) recovery from bus fault conditions
2) Analog switches
ADG1611 chosen I2C mux, for 1uA supply current, low R.  C may be high at 70-160 pF.
Alternates with same footprint include ADG4612, ADG611, and ADG451.
ADG802 chosen for thermistor mux, for 0.4 ohm resistance.  High C doesn't matter.

I2C Buffer/Repeater:  Have observed Inspired Energy 'smart charger' pulling battery I2C bus to 5V; Mobo uses 3.3V.  Seek buffer/repeater/isolator to separate the two busses, for 

3.3 Power Mux (Diode/Load Switches)

Charge bus requires load switch per battery stick, to enable/disable charge current in sequence.  The charge bus needs diode functionality at least at the charger input, to prevent reverse current flow out the charge port or in to the charger.  It seems safer to have diode functionality on each load switch to each stick, to prevent sticks reverse-driving the charge bus (although there’s normally nowhere for that current to go except through an enabled switch into another stick).  

Discharge bus requires diode functionality to prevent battery sticks from back-driving each other in event of charge imbalance, or more importantly in event of shorted cell.  Discharge bus also can use load switch functionality to enable power control of the whole platform.

Simplest solution would adopt a common ideal-diode/load-switch circuit for each stick charge input and discharge output.  An alternate (not pursued) would be an ideal diode at charger input, charge bus load switches at each stick, discharge bus ideal diodes at each stick, and a load switch at the platform power output.    (Future options to reduce standby current: Schottky or junction diodes with load switch devices that stand by on ~5uA; diode loss would be 0.6V/28V = ~2%, cf. the 4% capacity loss of 6x15uA=90 uA for 1 year with ideal diodes.  Second option discrete PFETs driven by static CMOS buffers to a JFET-maintained phantom ground at VBatt-10V, similar to LRAUV Load Control Board.)

Ideal diodes considered:
  LTC4412HV – a little slow with large FETs, but lowest standby power, ~15uA typ
  LTC4414 – better with large FETs but ~30uA standby
  Various N-ch ideal diode drivers w/ charge pumps – due to topology can’t function as load switches

3.4 Pump ECB/Inrush/Load Switch

Power feed to VB pump motor drive needs Load Switch function, Inrush control, and ECB function.  LTC4380 provides all three.  Could provide OV protection too but would require back-to-back FETs

Load Switch:  

3.5 Energy Monitor

Vdd supply requires 4-100V.  Specs show Vdd supply current ~950uA at 4 MHz clock.  Seems OK to run this from Mobo5V since 5mW is much smaller than Mobo power.  (NB: does this chip require continuous power?)

3.6 Sleep Timer

Power Supply:   Need ~10uA for logic, plus ~1mA for reed switch pullups or on/off jumpers.  Draw always-on 28V from batts, upstream of load switches.  Diode-OR two sticks together for redundancy, use BAS19-7-F (100V/200mA) already used for coil suppression .  Try a current-limit resistor in series with each 28V feed, located close to stick, to protect traces and batts... 10k gives 10V drop, still leaves 5V headroom for LDO at 20V low batt.  10k may affect LDO stability, verify during checkout.  (Edit 2019-05-14: add 5 mA for channel-status LED, total 6 mA, 10V drop implies 1.67k.  But 1.67k would dissipate 3/4W in short ckt from 36V.  Compromise on 2.2k 1/2W part from database, 13V drop @ 6mA and 0.59W short ckt dissipation.)

LDO Regulator: Chose TPS7A16 from CIS library, 5.0V version (no divider required).  60V input, 5-10 uA quiescent.  Sadly, EN input apparently has 400% hysteresis (Von=1.2V, Voff=0.3V), so cannot use EN to disable LDO when VBatt falls below 20V.  Junction-Ambient thermal resistance 66 K/W, assume 50C ambient, max allowable temp 125C, allowable rise is 75K, power is 75/66 = 1.14W.  For 36V input, 5V output, max current is 1.14 / (36 - 5) = 37mA.  Actual Batt5V+ draw should just be a few microamps for logic, 1 mA when reed switch closed or jumper installed.  (Edit 2019-05-14: 6mA when channel-status LED is on... should still be OK especially with upstream ballast resistor.)

3.7 Overcurrent Coordination

PH4000 charger puts out 2.78 A max.  (spec p. 2)
PH2059-HD34 battery 	should charge at 1.5A (spec 3.1.5)
			discharge should current limit at 4A (spec 3.1.4)
			discharge should open fuse at 12A
Pump motor drive (Elmo Twitter) should draw 8A max (requirement)

Fuse F1 in Charge Input section protects against
	-- failed or improper Charger putting excess current into batteries
	-- batteries discharging back out Charge port (if battery diodes fail)
Normal operation should never see more than 1.5A here; choose 3A non-delay.  Nuisance trip will stop charging but not endanger mission.

Fuse F2 on Mobo 28V feed protects 
	-- wiring and traces against shorts on Mobo or downstream
		Harwin M80 contacts 3A x 2 ea = 6A
	-- batteries against shorts on Mobo or downstream
		Battery CL 4A each... 4A min, 24A max
	Mobo load: 
	DC/DC converters (3.3V x 5A)+(12V x 3A)+(1.8V x 0.6A)+(5V x 1A)
		= 59W out, @90% eff = 65W in, @ 20V Vmin = 3.2A max
Choose 6.3A non-delay fuse based on 6A traces, connectors, and wiring.  Nuisance trip here will cause loss of vehicle (!).

ECB and Fuse F3 on pump motor feed protects 
	-- wiring and traces against external short, Harwin pwr contacts 20A
	-- fuse protects batteries against uncontrolled regen event
Pump drive should draw 8A max; set ECB for 10A limit and 15 msec trip
Use 12A fuse as backup in case of ECB failure or regen

4. Standby Current Budget

Inspired Energy PH2059HD34 sticks are 3230 mAh each or 19,380 mAh for full set of 6.
Goal: allow 5% for P2 board or 969 mAh or 110 uA standby for 1 year

Disch28V
Batt5V (see below)			  20	uA
LTC4412 ideal diode, 6 ea		  90	
LTC4380 limiter (pump)			  10	
					120

Batt5V (adds to Disch28V)
TPS7A16 LDO				   10	uA
MC14536 dynamic			     6	
logic standby, 4 @ 1uA			     4
					   20

Mobo5V
Joint 4V7 (see below)			    26	uA
LTC2934 divider + chip			      7	
LTC2946 Energy Monitor		  950	
TCA6408 ports, dynamic, 2 @ 20uA	    40	
					1023

Joint4V7 (adds to Mobo5V and Chg28V)
TCA6408 ports, static, 2 @ 7uA		   14	uA  (max, 3 uA typ) 
Analog switches, 12 @ 1uA		   12	uA (max, .012 uA typ)
					   26

Chg28V
Chg5V (see below)			   23
LTC4412, 6 ea				   90	uA
					   90

Chg5V (adds to Chg28V)
MC14536 dynamic			     6	uA  
TPS7A16 LDO				   10	
LTC2934 divider + chip			     7	
					   23

5. Questions for Review:

1. What supplies should I2C busses be pulled up to?
	I.I. battery spec says "system logic voltage"
	I.I. charger has been observed using 5V
2. Blinky lights (LEDs) to show channel scan active, or other status?
3. OK to take Sleep Timer power from just 1 stick?
4. 5% tolerance on Scan and Sleep time OK?  Trimpot?
5. Other test points?
6. Does Energy Monitor require continuous power?
7. Bus capacitance for pump drive (Elmo)?