Skip to content

Commit 993836c

Browse files
committed
some test code for battery fet disconnect / leakage measurements
put into the commit log just in case i need to refer to it again in the future...
1 parent 5e7a687 commit 993836c

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

loader/src/platform/cramium/cramium.rs

+36-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,42 @@ pub fn early_init() -> u32 {
334334

335335
pmic.set_ldo(&mut i2c, Some(2.5), cramium_hal::axp2101::WhichLdo::Aldo2).unwrap();
336336
pmic.set_dcdc(&mut i2c, Some((1.2, false)), cramium_hal::axp2101::WhichDcDc::Dcdc4).unwrap();
337-
crate::println!("AXP2101 configure: {:?}", pmic);
337+
338+
// This debug print creates a lot of extra code...
339+
// crate::println!("AXP2101 configure: {:?}", pmic);
340+
341+
// test battery power off
342+
/*
343+
crate::println!("poweroff");
344+
pmic.set_ldo(&mut i2c, None, cramium_hal::axp2101::WhichLdo::Aldo3).unwrap();
345+
crate::println!("poweroff done");
346+
*/
347+
348+
// try to get the BATTFET disengaged on AXP2101
349+
// the lowest current we can get is 3mA...
350+
/*
351+
let mut buf = [0u8, 0u8];
352+
crate::println!("debug");
353+
i2c.i2c_read(0x34, 0u8, &mut buf, false).unwrap();
354+
crate::println!("0|1 bef: {:x?}", buf);
355+
356+
buf[0] = 0;
357+
buf[1] = 0;
358+
// force batfet off
359+
i2c.i2c_write(0x34, 0x12u8, &buf[..1]).unwrap();
360+
crate::println!("delay");
361+
i2c.i2c_read(0x34, 0u8, &mut buf, false).unwrap();
362+
crate::println!("0|1 aft: {:x?}", buf);
363+
364+
crate::println!("enable power off");
365+
buf[0] = 0x2;
366+
i2c.i2c_write(0x34, 0x22u8, &buf[..1]).unwrap();
367+
368+
crate::println!("poweroff");
369+
buf[0] = 0x1;
370+
i2c.i2c_write(0x34, 0x10u8, &buf[..1]).unwrap();
371+
crate::println!("poweroff done");
372+
*/
338373

339374
// Make this true to have the system shut down by disconnecting its own battery while on battery
340375
// power Note this does nothing if you have USB power plugged in.

0 commit comments

Comments
 (0)