max77654

group max77654

Driver for the MAX77654 I²C driven battery charge controller (PMIC).

https://datasheets.maximintegrated.com/en/ds/MAX77654.pdf There are at least 5 Different voltage outputs. Main Power Rail:

  • 1.8V Power Rail: MCU and the Touch IC, Always on. Auxillary Power Rails, tured ON by MCU in a specific routine, in monocle_board.c.

  • 1.2V Power Rail

  • 2.7V Power Rail

  • 10V Power Rail

  • LED Power Rail: Can be tured OFF.

    Bug:

    Right now a little underpowered: there is a 18 sec delay after turning the power for every module.

    Occassionally boot failure is also noticed right now.

Typedefs

typedef enum MAX77654_charging_status max77654_status

return values of max77654_charging_status()

typedef enum MAX77654_charge_fault max77654_fault

Enums

enum MAX77654_charging_status

return values of max77654_charging_status()

Values:

enumerator MAX77654_READ_ERROR

I2C error on read of status register.

enumerator MAX77654_READY

Ready.

enumerator MAX77654_CHARGING

Charging.

enumerator MAX77654_CHARGE_DONE

Charge done.

enumerator MAX77654_FAULT

Fault.

enum MAX77654_charge_fault

Values:

enumerator MAX77654_NORMAL

No faults.

enumerator MAX77654_FAULT_PRE_Q

Prequalification timer fault.

enumerator MAX77654_FAULT_TIME

Fast-charge timer fault.

enumerator MAX77654_FAULT_TEMP

Battery temperature fault.

Functions

void max77654_init(void)

Initialize the MAX77654 chip.

Test results: (using resistors to simulate bulk & constant voltage charging) bulk charging current: 67.4mA, constant voltage: 4.28V

Returns

True if I2C succeeds.

void max77654_rail_1v2(bool on)

Turn the 1.2V rail on/off powering all 1.2V components of the circuit.

Parameters

on – True for power on.

Returns

True if I2C succeeds.

void max77654_rail_1v8(bool on)

Turn the 1.8V rail on/off powering all 1.8V components of the circuit.

Parameters

on – True for power on.

Returns

True if I2C succeeds.

void max77654_rail_2v7(bool on)

Turn the 2.7V rail on/off powering all 2.7V components of the circuit.

Parameters

on – True for power on.

Returns

True if I2C succeeds.

void max77654_rail_10v(bool on)

Turn the 10V rail on/off powering all 10V components of the circuit.

Parameters

on – True for power on.

Returns

True if I2C succeeds.

void max77654_rail_vled(bool on)

Enable the power rail used to power the LEDs.

Returns

True if I2C succeeds.

void max77654_led_red(bool on)

Turn the red led connected to the max77654 on or off.

Parameters

on – Desired state of the led.

Returns

True if I2C succeeds.

void max77654_led_green(bool on)

Turn the green led connected to the max77654 on or off.

Parameters

on – Desired state of the led.

Returns

True if I2C succeeds.

max77654_status max77654_charging_status(void)

Get the battery status.

Returns

Current status of charge.

max77654_fault max77654_faults_status(void)

Query the fault status of the device.

Returns

An enum with the type of the fault.

void max77654_set_charge_current(uint16_t current)

Set the battery charge current.

Warning

Setting this too high could damage the battery

Parameters

current – Range is 7mA to 300mA. Input values <7 will be rounded up to 7.5, >300 down to 300, and intermediate values rounded down to the nearest supported config value (increments of 7.5mA).

Returns

True if I2C succeeds.

void max77654_set_charge_voltage(uint16_t voltage)

Set charge voltage (in mV)

Parameters

millivolts – Range is 3600 to 4600 (3.6V to 4.6V).

Returns

True if I2C succeeds.

void max77654_set_current_limit(uint16_t current)

Set input current upper limit (in mA).

Parameters

current – Range is 95 to 475 in increments of 95mA, see MAX77654_CNFG_CHG_B_REG definitions.

Returns

True if I2C succeeds.

void max77564_factory_ship_mode(void)

Set the device in extreme low power mode.

This disconnects the battery from the system, not powered anymore.

Returns

True if I2C succeeds.