Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • prv_fault_check(): check fresh data for faults

  • prv_periodic…(): periodically reads AFEs for data

  • cell_sense_init(): begins periodic checks, inits SPI

  • Fault thresholds (from the LG MJ1 datasheet)

    • Undervoltage: 2.5V

    • Overvoltage: 4.2V

    • Overtemp while charging: 45C

    • Overtemp while discharging: 60C

Passive_balance

  • prv_periodic_balance(): periodically checks which cells are highest and raises event for AFEs to balance those cells

  • passive_balance_init(): inits periodic balance

...

  • prv_fault_check(): checks new data for faults

  • prv_periodic_read_current(): read current at least 100 times a second

    • Every 20 readings, update the data in CurrentStorage.

  • current_sense_init(): inits periodic read

  • Note: eventually this module will also be responsible for transmitting data to the RPI for state of charge calculations.

  • Note: to convert from the ADS1259 reading to a current reading, multiply the ADS1259 reading by 100

Data type notes

RelayStorage

...

  • Holds the last 20 current readings, all updated at the same time periodically. Stored as int16_t because current can be negative.

AfeStorage

  • Holds the voltages of 6 modules x3 AFEs

  • Holds the temps of 30 thermistors (exact number TBD) x3 AFEs

...

  • Also holds DebounceStorage, required for killswitch.

  • IMPORTANT: Also holds state_of_charge as a uint32_t or something from raspi

Raspi

  • toggle the 5V_EN pin when we want to turn the raspi on

  • send data to the raspi through UART

  • Receive data from raspi through UART

Drivers

ADT7470

  • fan controller, exposes init() and update_speed(). The ‘stuck’ interrupt is in a GPIO pin, can be registered by the module.

...