Tested Firmware Version
- TEXAS INSTRUMENTS bq40z50
- ATMEL ATmega32HVB
Battery controller probing requests. 0x0A=Atmel, 0x16=TI
Actual Current is signed.
Power management for the LC-Display.
Display will be scrolled (11 digits).
HRD can be connected to external devices like personal computers to transfer and store the extracted technical data.
https://github.com/peterloes/HRD/blob/master/Getting_Started_Tutorial/1_poster_overview.pdf
The standalone HRD features EFM32 ...the world´s most energy friendly microcontrollers
ARM Cortex-M3 EFM32G230F128
Code Snippets
Make quick changes to the Source Code.
https://github.com/peterloes/HRD/blob/master/Software/main.c
/*! List of items which can be displayed
*
* This array contains a list of items that can be displayed on the LCD.
* Element 0 is a special case, it shows the name, version, and date of
* the firmware image. Usually up/down push buttons are used to select
* the item to be displayed.
*
* The order of these items may be rearranged by the user. Single or
* groups of entries can be de-activated by commenting them out.
*/
static const ITEM l_Item[] =
{ // [1234567890123456] Cmd Frmt
{ ">>> HRDevice <<<", SBS_NONE, FRMT_FW_VERSION },
{ "Battery at SMBus", SBS_NONE, FRMT_BAT_CTRL },
{ "Supply Battery", SBS_NONE, FRMT_CR2032_BAT },
{ "Manufacturer", SBS_ManufacturerName, FRMT_STRING },
{ "Device Name", SBS_DeviceName, FRMT_STRING },
{ "Device Type", SBS_DeviceChemistry, FRMT_STRING },
{ "Serial Number", SBS_SerialNumber, FRMT_HEX },
{ "Production Date", SBS_ManufactureDate, FRMT_DATE },
https://github.com/peterloes/HRD/blob/master/Software/drivers/BatteryMon.c
/*!@brief Probe List of supported Battery Controllers */
static const BC_INFO l_ProbeList[] =
{ // addr type name (maximum 10 characters!)
{ 0x0A, BCT_ATMEL, "ATMEL" },
{ 0x16, BCT_TI, "TI bq40z50", },
{ 0x00, BCT_UNKNOWN, "" } // End of the list
};
/*!@brief SBS Commands
*
* These are the defines for the registers of the battery controller. Each
* define contains the following bit fields:
* - Bit 17:15 specify the controller type where the define belongs to. Bit 16
* (0x10000) represents the Atmel controller, while bit 17 (0x20000) specifies
* the TI controller. If both bits are set (0x30000), the register exists in
* both controller types. Bit 15 is used if no controller is connected to
* identify the remaining valid entries (where SBS_NONE is set).
* - Bit 14:8 contains the number of bytes to read. For 8, 16, or 32 bit values
* BatteryRegReadValue() is called, while for more than 4 bytes function
* BatteryRegReadBlock() will be used (block command).
* - Bit 7:0 of the enum contains the address as used for the SBS commands sent
* via I2C.
*
* All command sequences beginn with I²C device address to access the battery
* controller. The device address depends on the type of battery controller:
* - 0x0A in case of Atmel, and
* - 0x16 for the TI bq40z50.
* The address can be probed via BatteryCtrlProbe().
*
* @see
* Functions BatteryRegReadValue() and BatteryRegReadBlock() use these enums.
* A list of all registers can be found in document
* <a href="../SBS_Commands.pdf">SBS Commands</a> and in the
* <a href="../sluubc1b_Technical_Reference_bq40z50-R1.pdf">Technical Reference
* Manual</a> of the Texas Instruments bq40z50 battery controller.
*
* @note
* Registers 0x60~0x78 and those marked by brackets, e.g. [0x50], cannot be
* accessed when the battery device in "sealed" mode, which is the default
* state.
*/
typedef enum
{
SBS_NONE = (-1), //!< (-1) No Command / Address
SBS_ManufacturerAccess = 0x30200, //!< 0x00 ManufacturerAccess (legacy)
SBS_RemainingCapacityAlarm, //!< 0x01 Word: in [mAh / 10mWh]
SBS_RemainingTimeAlarm, //!< 0x02 Word: in [min]
SBS_BatteryMode, //!< 0x03 Word: in Hex