From Technologic Systems Manuals
Jump to: navigation, search
TS-BAT10
TS-BAT10.jpg
Product Page
Documents
Schematic
Battery Datasheet

Contents

1 Overview

The TS-BAT10 is a PC/104 peripheral that contains two 4.2v 2200mA LiPo batteries wired in parallel to provide a high power battery back up system for Technologic Systems' Single Board computers as well as most other PC/104 SBC modules. The TS-BAT10 acts as both a regulator and a battery back up system, accepting from 5VDC to 30VDC and powering the entire PC/104 stack via the 5+VDC pins on the 64-pin PC/104 connector. The batteries are charged via two dedicated LiPo chargers that will charge the batteries until they reach 4.2 volts or for a maximum of a 6 hour charge time. Each battery has an indication of "charging", "charge complete", or "fault", these three states can be read from userspace by the SBC. Each battery can also have a slow 250mA charge current, or a fast charge 500mA current depending on the current source available.

2 Getting Started

Be sure to remove all power from the system and install a jumper on position 4 (battery backup disable) of the 2x4 pin header to disable battery power before connecting TS-BAT10 to a PC/104 stack. A jumper also needs be installed in one of the three address decode jumper positions. Exactly one address jumper must be installed, resulting in the TS-BAT10 using one of the following PC/104 address ranges:

  • 0x110-0x11F
  • 0x150-0x15F
  • 0x300-0x30F

On Technologic Systems ARM SBCs, that base address must be added to the 8 bit PC/104 base address for the particular system.

3 Operation

To use the TS-BAT10 for the first time, add it to a PC/104 stack, with jumpers installed as described above, and provide 5-28V DC on the power input connector. The TS-BAT10 will begin providing a regulated 5V to the SBC. The batteries will not be charging and will be disabled, and none of the status LEDs should be lit. JP4 can now be removed to allow battery backup. With JP4 installed, battery power will never be used.

Once battery backup is enabled, the TS-BAT10 will power the system any time external power is removed. The TS-BAT10 uses a boost regulator in order to boost the 4.2V DC provided by the two LiPo batteries to the necessary 5V DC for the PC/104 system. The input regulator for the external power supply requires at least 4.5V DC in order to provide power to the system. With an input voltage in the range of 4.5-5V DC the boost regulator will bring the voltage up to the proper levels.

3.1 Battery Charging Sequence

Once the TS-BAT10 is provided at least 4.5V DC, the host SBC can instruct the battery charging ICs to begin their charging cycle. Using the timers is highly recommended to provide safe charging. The timer on the charging devices is set for 6 hours; if this expires they will immediately stop charging and show a fault.

In order to begin a slow charge with the timers enabled, write 0x78 to the TS-BAT10 address space. Both red "charging" (CHG) LEDs will turn on. This will draw an additional 500mA (250mA for each battery) for the duration of the charge cycle. For a fast charge with the timers enabled, write 0x18 to the TS-BAT10 address space. This will cause the TS-BAT10 to draw an additional 1A of current from the external power supply (500mA for each battery).

The standard 5V DC @ 1A power supply from Technologic Systems will not be able to provide enough current to do a fast charge as well as provide power to the SBC. If the regulated 5V DC line slumps below 4.5V DC it will be unable to charge the batteries properly and will suspend charging until the proper voltage is available. When the power supply cannot handle the required current draw, software can instruct the TS-BAT10 to charge one battery at a time.

The charge controllers are intelligent and commands can continually be issued to the controllers to charge the batteries. They have automatic cutoff when the batteries are at the correct voltage. To maximize the lifetime (number of recharge cycles) of a battery, it is best to wait until the batteries report they are below 3.3V and then begin a full charge cycle. This is recommended for use cases where the system will only use the TS-BAT10 for power for a brief time while it does an orderly shutdown. Note that the battery charge controllers will not automatically begin a charge cycle; they must be commanded to do so via software.

3.2 Disabling Battery Backup Power

There are five conditions under which the batteries will be disabled from powering the system:

  • Valid external voltage is applied
  • The battery voltage is below 3.1V DC
  • A jumper in position 4 is installed
  • A large current draw has occurred and the regulated 5V DC drops below 4.45V DC
  • The battery backup is disabled by software

Battery backup functionality is enabled by default when the system is first powered up unless JP4 is installed.

LiPo batteries can be severely damaged if the cell voltage drops below 2.3V DC. In order to prevent permanent damage to the cells, the battery backup functionality is automatically disabled if the cell voltage drops below 3.1V DC. LiPo batteries hold their nominal voltage (in this case, 4.2V DC) through the length of their charge. The LiPo discharge curve will drop voltage sharply once the cells can no longer provide adequate current. There is a low battery register that indicates when the cells are below 3.3V DC. When the cells are less than 3.3V DC the LiPos will only be able to provide stable voltage for minutes at most. The recommended procedure is for the system to shut down when the batteries reach 3.3V DC and no external power is available.

The TS-BAT10 will ship with a jumper in position 4 to prevent the batteries from being drained during shipment. When this jumper is installed, the battery backup functionality will never be enabled; however, the batteries can still be charged using normal procedures.

The batteries and boost regulator can provide 4A of current. If that is exceeded under battery operation and the regulated 5V DC line drops below 4.45V DC, the batteries will immediately be disabled until the backup circuit is reset (see "Push Button" below) or external power is restored.

If the battery backup is disabled via software, the power to the PC/104 system will be cut if the external input power is cut. The software disable will reset to its enabled state when external power is re-applied. Power can also be restored to the system via the battery backup by resetting the battery backup circuit (see "Push Button" below).

3.3 Battery Notes

LiPo batteries can be severely damaged if the cell voltage drops below 2.3VDC. In order to prevent permanent damage to the cells the battery backup functionality is disabled if the cell voltage drops below 3.1VDC. LiPo batteries hold their nominal voltage (in this case, 4.2VDC) through the length of their charge. The LiPo discharge curve will drop voltage sharply once the cells can no longer provide adequate current. There is low battery detector that can be read to indicate when the cells are down below 3.3VDC. When the cells are less than 3.3VDC the LiPos will only be able to provide stable voltage for minutes at the most. The batteries CANNOT be used until they are charged above 3.1VDC.

3.4 Push Button SW1/CN1

A momentary switch is installed on the side of the TS-BAT10. This switch can be read by software (see "Register Layout" above) from the SBC to trigger a custom event. This switch is also used to enable battery backup functionality while power is cut and the battery backup has been disabled (via software, or if the regulated 5V DC dropped below 4.45V DC). Pressing and holding the switch for one second will cause the battery backup to fully take over and provide 5V DC to the PC/104 system.

The two pins labeled CN1, located immediately next to the push button, can be used to connect an external button. If the two pins are shorted together it has the same effect on the system as if the push button were depressed. This can be used to bring out the push button to the outside of an enclosure.

The push button, combined with the low battery state, can be used in a power management application. A userspace process can poll the register; if a low battery condition occurs, or if the push button is depressed, the system can be commanded to safely shut down.

4 Jumper Configuration

Jumper Function
1 Use 0x110 as base
2 Use 0x150 as base
3 Use 0x300 as base
4 Disable battery backup
CN1 Same as SW1.

5 Register Map

5.1 Status Register (Read only)

This register is available at (PC104 base) + (pins 1-3 TS-BAT10 Base) + 0

Read-only Status Register
Bit 0 0 = Battery 2 charge complete
1 = Battery 2 charge did not complete
Bit 1 0 = Battery 2 charging
1 = Battery 2 not charging
Bit 2 0 = Battery 1 charge complete
1 = Battery 1 charge did not complete
Bit 3 0 = Battery 1 charging
1 = Battery 1 not charging
Bit 4 0 = Battery backup disable jumper installed
1 = Battery backup disable jumper not installed
Bit 5 0 = input voltage not OK
1 = input voltage OK
Bit 6 0 = Battery under 3.3V
1 = Battery over 3.3V
Bit 7 0 = Push switch is being pressed
1 = Push switch is not being pressed
Note: bit 0-1 and 2-3 are also used to indicated a fault in charging. If they are both logic 1 (HiZ state) after initiating a charge cycle, either the timer has expired or the thermal cutoff of the batteries has engaged.

5.2 Configuration Register (Write only)

Write-only Configuration Register
Bit 0 0 = Enable battery backup
1 = Disable battery backup
Bit 1 0 = Enable battery 1 charge timer
1 = Disable battery 1 charge timer
Bit 2 0 = Enable battery 2 charge timer
1 = Disable battery 2 charge timer
Bit 3 0 = Disable battery 1 charge
1 = Enable battery 1 charge
Bit 4 0 = Disable battery 2 charge
1 = Enable battery 2 charge
Bit 5 0 = Charge battery 1 at 500mA
1 = Charge battery 1 at 250mA
Bit 6 0 = Charge battery 2 at 500mA
1 = Charge battery 2 at 250mA
Bit 7 Reserved

6 Safe Shutdown Example

The typical operation of the TS-BAT10 is to enable charging on startup, and safely shut down the board when power is lost. When the TS-BAT10 receives 5V it will reapply power to the PC104 bus. This can be accomplished with the tsbatctl and a startup script at /etc/init.d/ups-monitor.

This script should be created at /etc/init.d/ups-monitor.

#!/bin/sh
#/etc/init.d/ups-monitor
 
case "$1" in
        start)
                nohup /usr/bin/tsbatctl --jumper 1 -a 2 -b 2 --daemon &
                ;;
        poweroff)
                /usr/bin/tsbatctl --jumper 1 --disable-power
                ;;
        *)
                echo "Usage: ups-monitor start|poweroff" >&2
                exit 3
        ;;
esac
 
exit 0

The script will be called by runlevel 0's halt script by default, so this only needs to be added to the startup script.

chmod a+x /etc/init.d/ups-monitor 
update-rc.d ups-monitor defaults

This is tsbatctl.c and should be installed to /usr/bin/tsbatctl.

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <getopt.h>
#include <string.h>
 
// The mpeek/mpoke functions are specific to the TS-47XX, TS-7250-V2
unsigned int opt_pc104 = 0x81008000;
volatile uint8_t *muxbus = 0;
uint8_t mpeek8(uint16_t addr) 
{
    if(muxbus == 0) {
        int mem = open("/dev/mem", O_RDWR|O_SYNC);
        muxbus = mmap(0,
            getpagesize(),
            PROT_READ|PROT_WRITE,
            MAP_SHARED,
            mem,
            opt_pc104);
    }
    return muxbus[addr];
}
 
void mpoke8(uint16_t addr, uint8_t value)
{ 
    if(muxbus == 0) {
        int mem = open("/dev/mem", O_RDWR|O_SYNC);
        muxbus = mmap(0,
            getpagesize(),
            PROT_READ|PROT_WRITE,
            MAP_SHARED,
            mem,
            opt_pc104);
    }
    muxbus[addr] = value;
}
 
typedef enum
{
	SW1 = 1 << 7,
	BELOW33V = 1 << 6,
	NOVDC5 = 1 << 5,
	BACKUPDISABLED = 1 << 4,
	BAT1CHARGING = 1 << 3,
	BAT1CHARGED = 1 << 2,
	BAT2CHARGING = 1 << 1,
	BAT2CHARGED = 1 << 0
} StatusFlags;
 
typedef enum
{
	RESERVED = 1 << 7,
	BAT2NOFASTCHARGE = 1 << 6,
	BAT1NOFASTCHARGE = 1 << 5,
	BAT2CHARGEEN = 1 << 4,
	BAT1CHARGEEN = 1 << 3,
	BAT2TIMERDISABLE = 1 << 2,
	BAT1TIMERDISABLE = 1 << 1,
	SOFTDISABLE = 1 << 0
} ConfigurationFlags;
 
void usage(char **argv) {
	fprintf(stderr,
	  "Usage: %s -j [1-3] [OPTIONS] ...\n"
	  "TS-BAT10 userspace driver utility.\n"
	  "\n"
	  "  -s, --status               Print the current status of the TS-BAT10\n"
	  "  -j, --jumper=              Specify jumper 1-3 for the I/O address (required)\n"
	  "  -e, --disable-power        Immediately cuts power to the system.  This should\n"
	  "                             normally be called after the system has finished syncing\n"
	  "                             the disk(s) during the shutdown process to prevent corruption\n"
	  "  -a, --charge-bat1=#        Specify 0-3 for battery 1 charge setting (default 0)\n"
	  "  -b, --charge-bat2=#        Specify 0-3 for battery 2 charge setting (default 0)\n"
	  "  -n, --disable-timer-bat1   Disable the charge timer for battery 1 (default on)\n"
	  "  -n, --disable-timer-bat2   Disable the charge timer for battery 2 (default on)\n"
	  "  -t, --daemon               Daemonize and run the shutdown command when batteries are low\n"
	  "  -k, --shutdown-app=APP     When daemonizing, specify another application other\n"
      "                             than the default \"/sbin/shutdown -h now\"\n"
	  "  -h, --help                 This help\n"
	  "\n"
	  "  The 2 Batteries have 3 settings for charge options:\n"
	  "		0 - Disable charge (default)\n"
	  "		1 - Enable Slow charge (250mA)\n"
	  "		2 - Enable Fast charge (500mA)\n"
	  "  The TS-BAT10 uses a write only register so previous write values cannot be detected."
	  "  When using any settings previous values must be passed if they are to be retained."
	  "  For example, to charge both batteries:\n"
	  "  %s --jumper 1 --charge-bat1 2 --charge-bat2 2 "
	  "\n",
	  argv[0], argv[0], argv[0]
	);
}
 
int main(int argc, char **argv) {
	int opt_status = 0;
	int opt_jumper = 0;
	int opt_bat1charge = 0;
	int opt_bat2charge = 0;
	int opt_bat1timer = 0;
	int opt_bat2timer = 0;
	int opt_poweroff = 0;
	char *opt_shutdownapp = "/sbin/shutdown -h now";
	int opt_daemon = 0;
 
	int c;
	int offset;
	uint8_t value = 0;
 
	static struct option long_options[] = {
	  { "status", 0, 0, 's' },
	  { "jumper", 1, 0, 'j' },
	  { "charge-bat1", 1, 0, 'a' },
	  { "charge-bat2", 1, 0, 'b' },
	  { "disable-timer-bat1", 1, 0, 'n' },
	  { "disable-timer-bat2", 1, 0, 'o' },
	  { "pc104base", 1, 0, 'r' },
	  { "disable-power", 0, 0, 'e' },
	  { "daemon", 0, 0, 't' },
	  { "shutdown-app", 1, 0, 'k' },
	  { "help", 0, 0, 'h' },
	  { 0, 0, 0, 0 }
	};
 
	while((c = getopt_long(argc, argv, "sj:a:b:n:o:r:tek:h", long_options, NULL)) != -1) {
		switch(c) {
			case 's':
				opt_status = 1;
				break;
			case 'j':
				opt_jumper = strtoul(optarg, NULL, 0);
				break;
			case 'a':
				opt_bat1charge = strtoul(optarg, NULL, 0);
				break;
			case 'b':
				opt_bat2charge = strtoul(optarg, NULL, 0);
				break;
			case 'n':
				opt_bat1timer = strtoul(optarg, NULL, 0);
				break;
			case 'o':
				opt_bat2timer = strtoul(optarg, NULL, 0);
				break;
			case 'e':
				opt_poweroff = 1;
				break;
			case 'r':
				opt_pc104 = strtoul(optarg, NULL, 0);
				break;
			case 'k':
				opt_shutdownapp = strdup(optarg);
				break;
			case 't':
				opt_daemon = 1;
				break;
			case 'h':
				usage(argv);
				return 0;
			default:
				usage(argv);
				fprintf(stderr, "Unknown option \"%c\"\n", c);
				return 1;
		}
	}
 
	if(opt_bat1timer < 0 || opt_bat1timer > 1 ||
	   opt_bat2timer < 0 || opt_bat2timer > 1) {
		usage(argv);
		fprintf(stderr, "Timer value must be 0 or 1\n");
		return 1;
	}
 
 
	if(opt_bat1charge < 0 || opt_bat1charge > 2 ||
	   opt_bat2charge < 0 || opt_bat2charge > 2) {
		usage(argv);
		fprintf(stderr, "Charge value must be between 0-2\n");
		return 1;
	}
 
	if(opt_jumper < 1 || opt_jumper > 3) {
		usage(argv);
		fprintf(stderr, "The jumper value must be specified between 1-3\n");
		return 1;
	}
 
	if(opt_jumper == 1) offset=0x110;
	else if (opt_jumper == 2) offset=0x150;
	else if (opt_jumper == 3) offset=0x300;
 
	if(opt_status) {
		uint8_t s = mpeek8(offset);
		fprintf(stdout,
			"sw1=%d\n"
			"below33=%d\n"
			"no5vdc=%d\n"
			"jp4=%d\n"
			"bat1charging=%d\n"
			"bat2charging=%d\n"
			"bat1charged=%d\n"
			"bat2charged=%d\n",
			s & SW1 ? 0 : 1,
			s & BELOW33V ? 0 : 1,
			s & NOVDC5 ? 0 : 1,
			s & BACKUPDISABLED ? 0 : 1,
			s & BAT1CHARGING ? 0 : 1,
			s & BAT2CHARGING ? 0 : 1,
			s & BAT1CHARGED ? 0 : 1,
			s & BAT2CHARGED ? 0 : 1
		);
	}
 
	if(opt_poweroff) value |= SOFTDISABLE;
	if(opt_bat1charge == 1) value |= (BAT1CHARGEEN | BAT1NOFASTCHARGE);
	if(opt_bat1charge == 2) value |= (BAT1CHARGEEN);
	if(opt_bat2charge == 1) value |= (BAT2CHARGEEN | BAT2NOFASTCHARGE);
	if(opt_bat2charge == 2) value |= (BAT2CHARGEEN);
	if(opt_bat1timer) value |= BAT1TIMERDISABLE;
	if(opt_bat2timer) value |= BAT2TIMERDISABLE;
	mpoke8(offset, value);
 
	if(!opt_daemon) return 0;
 
	while(1) {
		value = mpeek8(offset);
 
		int below33 = value & BELOW33V ? 0 : 1;
		int novdc5 = value & NOVDC5 ? 0 : 1;
		if((novdc5 && below33)) {
			printf("shutting down: %s\n", opt_shutdownapp);
			system(opt_shutdownapp);
			return 0;
		}
		sleep(10);
	}
}

This can be compiled with:

gcc tsbatctl.c -o tsbatctl -mcpu=arm9
cp tsbatctl /usr/bin/tsbatctl

7 Reboot/Sleep support

Bat10-jp1.jpg

On some boards the sleep mode or reboot mechanism will depend on the 5V going into the terminal block header on the board rather than going through the PC104 bus. Test your board first to find out if this modification is necessary. To redirect 5V to support both of these modes you can depopulate R18 and R19. This will prevent the 5V from going through the PC104 bus. The pad furthest away from the PC104 connector in the JP1 box provides the regulated 5V. Connect this to the + power connector on your macrocontroller baseboard or single board computer.

  • The TS-7800 requires this modification for sleep and rebooting.
  • The TS-8160 requires this for sleep mode.

8 Errata

8.1 Incorrect silkscreen on TS-BAT10 Rev A

Synopsis Incorrect silkscreen on TS-BAT10, shows incorrect address
Severity Minor
Affected TS-BAT10 Rev A

Description:

The TS-BAT10 Rev A has a typo on the silkscreen. It lists JP3 as being address 0x310. It should read 0x300, the documentation on this is correct and should be followed instead of the board markings. REV A units shipped after 2-28-13 include a sticker with the corrected address.

TS-BAT10-Label.jpg

8.2 Incorrect resistor value for R75

Synopsis Incorrect value for R75
Severity Major
Affected TS-BAT10 Rev A (shipped before Jan 30th, 2013)

Description:

The TS-BAT10 units shipped before Jan 30th, 2013 had an improper value for R75 which would cause voltage up to 5.7V when power is connected to the TS-BAT10. Any units ordered before this date should be sent for repair through an RMA.

9 Product Notes

9.1 FCC Advisory

This equipment generates, uses, and can radiate radio frequency energy and if not installed and used properly (that is, in strict accordance with the manufacturer's instructions), may cause interference to radio and television reception. It has been type tested and found to comply with the limits for a Class A digital device in accordance with the specifications in Part 15 of FCC Rules, which are designed to provide reasonable protection against such interference when operated in a commercial environment. Operation of this equipment in a residential area is likely to cause interference, in which case the owner will be required to correct the interference at his own expense.

If this equipment does cause interference, which can be determined by turning the unit on and off, the user is encouraged to try the following measures to correct the interference:

Reorient the receiving antenna. Relocate the unit with respect to the receiver. Plug the unit into a different outlet so that the unit and receiver are on different branch circuits. Ensure that mounting screws and connector attachment screws are tightly secured. Ensure that good quality, shielded, and grounded cables are used for all data communications. If necessary, the user should consult the dealer or an experienced radio/television technician for additional suggestions. The following booklets prepared by the Federal Communications Commission (FCC) may also prove helpful:

How to Identify and Resolve Radio-TV Interference Problems (Stock No. 004-000-000345-4) Interface Handbook (Stock No. 004-000-004505-7) These booklets may be purchased from the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402.

9.2 Limited Warranty

Technologic Systems warrants this product to be free of defects in material and workmanship for a period of one year from date of purchase. During this warranty period Technologic Systems will repair or replace the defective unit in accordance with the following process:

A copy of the original invoice must be included when returning the defective unit to Technologic Systems, Inc. This limited warranty does not cover damages resulting from lightning or other power surges, misuse, abuse, abnormal conditions of operation, or attempts to alter or modify the function of the product.

This warranty is limited to the repair or replacement of the defective unit. In no event shall Technologic Systems be liable or responsible for any loss or damages, including but not limited to any lost profits, incidental or consequential damages, loss of business, or anticipatory profits arising from the use or inability to use this product.

Repairs made after the expiration of the warranty period are subject to a repair charge and the cost of return shipping. Please, contact Technologic Systems to arrange for any repair service and to obtain repair charge information.