summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2010-01-31 14:16:15 +0100
committerMichael Buesch <mb@bu3sch.de>2010-01-31 14:16:15 +0100
commitfe247dca9d29306b66c34d7ac3656c71b1c61a36 (patch)
tree3d50f6136e3c0fee0fff48c1473f6fa109896313
parent46c722dd516ca8f1fdfe1b4e84b72c15a4b116e1 (diff)
downloadtoprammer-fe247dca9d29306b66c34d7ac3656c71b1c61a36.tar.xz
toprammer-fe247dca9d29306b66c34d7ac3656c71b1c61a36.zip
Splitup some commands
Signed-off-by: Michael Buesch <mb@bu3sch.de>
-rw-r--r--chip_atmega8dip28.py139
-rwxr-xr-xtoprammer2
2 files changed, 116 insertions, 25 deletions
diff --git a/chip_atmega8dip28.py b/chip_atmega8dip28.py
index 338ad2f..e40067a 100644
--- a/chip_atmega8dip28.py
+++ b/chip_atmega8dip28.py
@@ -58,8 +58,17 @@ class ATMega8DIP28(Chip):
self.top.cmdSetVPPVoltage(5)
self.top.cmdFlush(21)
self.top.cmdLoadVPPLayout(14)
- self.top.send("\x1B\x1B\x0B\x16\x0B\x17\x0B\x18\x0B\x19\x0B\x1A\x0B\x1B\x07")
+
+ self.top.blockCommands()
+ self.top.cmdFlush(2)
+ self.top.send("\x0B\x16")
+ self.top.send("\x0B\x17")
+ self.top.send("\x0B\x18")
+ self.top.send("\x0B\x19")
+ self.top.send("\x0B\x1A")
+ self.top.send("\x0B\x1B")
stat = self.top.cmdReadStatusReg32()
+ self.top.unblockCommands()
if stat != 0xFFFFFFC0:
self.throwError("Did not detect chip. Please check connections.")
@@ -76,24 +85,67 @@ class ATMega8DIP28(Chip):
self.top.cmdFlush()
self.top.cmdSetVCCXVoltage(4.4)
self.top.cmdFlush()
- self.top.send("\x0A\x12\x05\x0A\x12\x06\x0A\x12\x04\x0A\x12\x03")
+
+ self.top.blockCommands()
+ self.top.send("\x0A\x12\x05")
+ self.top.send("\x0A\x12\x06")
+ self.top.send("\x0A\x12\x04")
+ self.top.send("\x0A\x12\x03")
+ self.top.unblockCommands()
+
self.top.cmdSetGNDPin(18)
self.top.cmdLoadVCCXLayout(13)
- self.top.send("\x1B\x19\x0A\x12\x01\x34\x0A\x12\x01\x0A\x12\x02\x0A\x12\x83\x0A" +\
- "\x12\x07\x0A\x12\x05\x0A\x12\x06\x0A\x12\x08\x0A\x12\x04\x0A\x12" +\
- "\x0A\x0A\x12\x09\x0A\x12\x87\x0A\x12\x07\x0A\x12\x87\x0A\x12\x07" +\
- "\x0A\x12\x87\x0A\x12\x07\x0A\x12\x87\x0A\x12\x07\x0A\x12\x87\x00")
- self.top.send("\x0A\x12\x07\x0A\x12\x87\x0A\x12\x07\x0A\x12\x87\x0A\x12\x07\x0A" +\
- "\x12\x87\x0A\x12\x07\x0A\x12\x87\x0A\x12\x07\x0A\x12\x87\x0A\x12" +\
- "\x07\x19")
+
+ self.top.blockCommands()
+ self.top.cmdFlush()
+ self.top.send("\x19")
+ self.top.send("\x0A\x12\x01\x34")
+ self.top.send("\x0A\x12\x01")
+ self.top.send("\x0A\x12\x02")
+ self.top.send("\x0A\x12\x83")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x05")
+ self.top.send("\x0A\x12\x06")
+ self.top.send("\x0A\x12\x08")
+ self.top.send("\x0A\x12\x04")
+ self.top.send("\x0A\x12\x0A")
+ self.top.send("\x0A\x12\x09")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87\x00")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07\x19")
+ self.top.unblockCommands()
+
self.top.cmdLoadVPPLayout(7)
- self.top.send("\x34\x0A\x12\x88\x1B")
+
+ self.top.blockCommands()
+ self.top.send("\x34")
+ self.top.send("\x0A\x12\x88")
+ self.top.cmdFlush()
+ self.top.unblockCommands()
+
self.top.cmdFlush(10)
self.top.send("\x0E\x1F\x00\x00")
time.sleep(0.1)
stat = self.top.cmdReadStatusReg32()
- if stat != 0xFFFFFFC0:
- self.throwError("read: Unexpected status value 0x%X012" % stat)
+ if stat != 0xB9C80101:
+ self.throwError("read: Unexpected status value 0x%08X" % stat)
# Now read the image
self.printInfo("Reading image ", newline=False)
@@ -107,21 +159,60 @@ class ATMega8DIP28(Chip):
self.printInfo("%d%%" % percent, newline=False)
else:
self.printInfo(".", newline=False)
- self.top.send("\x34\x0A\x12\x01\x0A\x12\x82\x0A\x12\x04\x34\x0A\x12\x05\x0A\x12" +\
- "\x86\x10\x02\x0A\x12\x87\x0A\x12\x07\x0A\x12\x05\x0A\x12\x06\x10" +\
- chr((chunk << 4) & 0xFF) +\
- "\x0A\x12\x87\x0A\x12\x07\x0A\x12\x84\x0A\x12\x05\x0A\x12\x06" +\
- "\x10" + chr(high) + "\x0A\x12\x87\x0A\x12\x07\x0A\x12\x81")
+ self.top.blockCommands()
+ self.top.send("\x34")
+ self.top.send("\x0A\x12\x01")
+ self.top.send("\x0A\x12\x82")
+ self.top.send("\x0A\x12\x04\x34")
+ self.top.send("\x0A\x12\x05")
+ self.top.send("\x0A\x12\x86\x10\x02")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x05")
+ self.top.send("\x0A\x12\x06\x10" + chr((chunk << 4) & 0xFF))
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x84")
+ self.top.send("\x0A\x12\x05")
+ self.top.send("\x0A\x12\x06\x10" + chr(high))
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x81")
+ self.top.unblockCommands()
for word in range(0, 31, 1):
value = (chunk << 4) + (word + 1)
high = (value >> 8) & 0xFF
- self.top.send("\x0A\x12\x04\x0A\x12\x02\x01\x0A\x12\x84\x01\x0A\x12\x82\x0A\x12" +\
- "\x01\x34\x0A\x12\x01\x0A\x12\x82\x0A\x12\x04\x34\x0A\x12\x05\x0A" +\
- "\x12\x86\x10\x02\x0A\x12\x87\x0A\x12\x07\x0A\x12\x05\x0A\x12\x06" +\
- "\x10" + chr(value & 0xFF) + "\x0A\x12\x87\x0A\x12\x07\x0A\x12\x84\x0A\x12\x05\x00\x00")
- self.top.send("\x0A\x12\x06\x10" + chr(high) + "\x0A\x12\x87\x0A\x12\x07\x0A\x12\x81")
- self.top.send("\x0A\x12\x04\x0A\x12\x02\x01\x0A\x12\x84\x01\x0A\x12\x82\x0A\x12" +\
- "\x01\x07")
+ self.top.blockCommands()
+ self.top.send("\x0A\x12\x04")
+ self.top.send("\x0A\x12\x02\x01")
+ self.top.send("\x0A\x12\x84\x01")
+ self.top.send("\x0A\x12\x82")
+ self.top.send("\x0A\x12\x01\x34")
+ self.top.send("\x0A\x12\x01")
+ self.top.send("\x0A\x12\x82")
+ self.top.send("\x0A\x12\x04\x34")
+ self.top.send("\x0A\x12\x05")
+ self.top.send("\x0A\x12\x86\x10\x02")
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x05")
+ self.top.send("\x0A\x12\x06\x10" + chr(value & 0xFF))
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x84")
+ self.top.send("\x0A\x12\x05\x00\x00")
+ self.top.send("\x0A\x12\x06\x10" + chr(high))
+ self.top.send("\x0A\x12\x87")
+ self.top.send("\x0A\x12\x07")
+ self.top.send("\x0A\x12\x81")
+ self.top.unblockCommands()
+ self.top.blockCommands()
+ self.top.send("\x0A\x12\x04")
+ self.top.send("\x0A\x12\x02\x01")
+ self.top.send("\x0A\x12\x84\x01")
+ self.top.send("\x0A\x12\x82")
+ self.top.send("\x0A\x12\x01\x07")
+ self.top.unblockCommands()
data = self.top.cmdReadStatusReg()
image += data
self.printInfo("100%")
diff --git a/toprammer b/toprammer
index 6cbc9f9..e917b05 100755
--- a/toprammer
+++ b/toprammer
@@ -307,7 +307,7 @@ class TOP:
def blockCommands(self):
"""Each succeeding command will be queued in software instead
of writing it to the device. The queue will be flushed and sent to
- the device on unblocking."""
+ the device on a call to unblockCommands() or receive()."""
assert(not self.commandsBlocked)
self.commandsBlocked = True
bues.ch cgit interface