Skip to content

Commit

Permalink
[testudo] stage2 control power and measure current
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Hall <hsw@openmoko.com>


git-svn-id: https://wikipediardware.googlecode.com/svn/trunk@1815 974c56cd-8151-0410-98c4-7bb2f43fa8c1
  • Loading branch information
hsw@openmoko.com committed Jul 1, 2009
1 parent 77b3b8d commit a871b8c
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions testudo/src/ui2.py
Expand Up @@ -24,8 +24,18 @@
import os.path
import threading

import Keithley

import sequencer


# power supply (volts, amps)
SUPPLY_STANDARD_VOLTAGE = 3.0
SUPPLY_CURRENT_LIMIT = 0.35
MAXIMUM_SUSPEND_CURRENT = 0.02
MAXIMUM_ON_CURRENT = 0.15

# paths to files
SaveFilesFolder = '/log/files/stage2'
FileExt = '.2.text'

Expand Down Expand Up @@ -137,14 +147,25 @@ def runTest(self):

try:
s = None
psu = None

s = SerialPort()
if '' == self.serialNumber.get_text():
raise StopTestException('Serial number invalid')
serialNumber = self.serialNumber.get_text()

psu = Keithley.PSU2303()
psu.setCurrent(SUPPLY_CURRENT_LIMIT)
psu.setVoltage(SUPPLY_STANDARD_VOLTAGE)
psu.powerOn()

self.write('\n*** Start of Test for device SN: %s ***\n\n' %
(serialNumber))
t = time.time()

self.write('*** Press device power on button to begin test ***\n\n' %
(serialNumber))

run = True
while run:

Expand All @@ -162,6 +183,28 @@ def runTest(self):

self.write(line)
self.write('\n')
if '*SUSPEND*' == line:
samples = 20
total = 0
for j in range(samples):
i = psu.current
total = total + i
self.write('INFO: suspend current = %7.3f mA @ %5.1f V\n' %
(1000 * i, psu.voltage))
time.sleep(0.1)
self.write('INFO: average suspend current = %7.3f mA @ %5.1f V\n' %
(1000 * total / samples, psu.voltage))
if abs(i) > MAXIMUM_SUSPEND_CURRENT:
s.write('N')
else:
s.write('Y')

else:
i = psu.current
self.write('INFO: current = %7.3f mA @ %5.1f V\n' % (1000 * i, psu.voltage))
if abs(i) > MAXIMUM_ON_CURRENT:
raise StopTestException('Device overcurrent: %7.3f mA' % (1000 * i)

if '*END-TEST*' == line:
run = False

Expand All @@ -183,6 +226,9 @@ def runTest(self):
finally:
if None != s:
del s
if None != psu:
psu.powerOff()
del psu
self.write('\n*** End of Test ***\n')
self.testStop = False
self.testRunning = False
Expand Down

0 comments on commit a871b8c

Please sign in to comment.