1 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
2 import os, struct, sys, time
4 from serial import Serial
9 def programChip(self, flashData):
11 self.chip = chipDB.getChipFromDB(self.getSignature())
12 if self.chip == False:
13 raise IspError("Chip with signature: " + str(self.getSignature()) + "not found")
16 print("Flashing %i bytes" % len(flashData))
17 self.writeFlash(flashData)
18 print("Verifying %i bytes" % len(flashData))
19 self.verifyFlash(flashData)
21 #low level ISP commands
22 def getSignature(self):
24 sig.append(self.sendISP([0x30, 0x00, 0x00, 0x00])[3])
25 sig.append(self.sendISP([0x30, 0x00, 0x01, 0x00])[3])
26 sig.append(self.sendISP([0x30, 0x00, 0x02, 0x00])[3])
30 self.sendISP([0xAC, 0x80, 0x00, 0x00])
33 def __init__(self, value):
36 return repr(self.value)