summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libtoprammer/chips/__init__.py4
-rw-r--r--libtoprammer/chips/microchip01/__init__.py6
-rw-r--r--libtoprammer/chips/microchip01/microchip01_common.py425
-rw-r--r--libtoprammer/chips/microchip01/pic10f200dip8.py83
-rw-r--r--libtoprammer/chips/microchip01/pic10f202dip8.py81
-rw-r--r--libtoprammer/chips/microchip01/pic12f508dip8.py75
-rw-r--r--libtoprammer/chips/microchip01/pic16f59sip6.py81
-rw-r--r--libtoprammer/chips/microchip02/__init__.py5
-rw-r--r--libtoprammer/chips/microchip02/microchip02_common.py446
-rw-r--r--libtoprammer/chips/microchip02/pic10f322dip8.py86
-rw-r--r--libtoprammer/chips/microchip02/pic12f1822dip8.py103
-rw-r--r--libtoprammer/chips/microchip02/pic16f1824dip14.py103
-rw-r--r--libtoprammer/chips/microchip16/__init__.py1
-rw-r--r--libtoprammer/chips/microchip16/microchip16_common.py451
-rw-r--r--libtoprammer/chips/microchip16/pic24f04ka200dip14.py84
-rw-r--r--libtoprammer/chips/microchip8/__init__.py32
-rw-r--r--libtoprammer/chips/microchip8/makeSip6.py93
-rw-r--r--libtoprammer/chips/microchip8/microchip8_18_common.py394
-rw-r--r--libtoprammer/chips/microchip8/microchip8_18f1220family.py61
-rw-r--r--libtoprammer/chips/microchip8/microchip8_18f2221family.py73
-rw-r--r--libtoprammer/chips/microchip8/microchip8_18f97j60family.py103
-rw-r--r--libtoprammer/chips/microchip8/microchip8_common.py512
-rw-r--r--libtoprammer/chips/microchip8/microchip8_singlePMarea.py78
-rw-r--r--libtoprammer/chips/microchip8/microchip8_splittedPMarea.py132
-rw-r--r--libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py72
-rw-r--r--libtoprammer/chips/microchip8/pic10f200dip8.py71
-rw-r--r--libtoprammer/chips/microchip8/pic10f202dip8.py71
-rw-r--r--libtoprammer/chips/microchip8/pic10f320dip8.py71
-rw-r--r--libtoprammer/chips/microchip8/pic10f322dip8.py71
-rw-r--r--libtoprammer/chips/microchip8/pic12f1822dip8.py91
-rw-r--r--libtoprammer/chips/microchip8/pic12f508dip8.py67
-rw-r--r--libtoprammer/chips/microchip8/pic12f629dip8.py81
-rw-r--r--libtoprammer/chips/microchip8/pic16f1823dip14.py91
-rw-r--r--libtoprammer/chips/microchip8/pic16f1824dip14.py90
-rw-r--r--libtoprammer/chips/microchip8/pic16f1825dip14.py88
-rw-r--r--libtoprammer/chips/microchip8/pic16f1826dip18.py88
-rw-r--r--libtoprammer/chips/microchip8/pic16f1827dip18.py88
-rw-r--r--libtoprammer/chips/microchip8/pic16f1828dip20.py88
-rw-r--r--libtoprammer/chips/microchip8/pic16f1829dip20.py88
-rw-r--r--libtoprammer/chips/microchip8/pic16f1933dip28.py90
-rw-r--r--libtoprammer/chips/microchip8/pic16f1934dip40.py90
-rw-r--r--libtoprammer/chips/microchip8/pic16f1936dip28.py90
-rw-r--r--libtoprammer/chips/microchip8/pic16f1937dip40.py90
-rw-r--r--libtoprammer/chips/microchip8/pic16f1938dip28.py90
-rw-r--r--libtoprammer/chips/microchip8/pic16f1939dip40.py90
-rw-r--r--libtoprammer/chips/microchip8/pic16f59dip40.py70
-rw-r--r--libtoprammer/chips/microchip8/pic16f630dip14.py81
-rw-r--r--libtoprammer/chips/microchip8/pic16f84adip18.py97
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1902dip28.py87
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1903dip28.py87
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1904dip40.py87
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1906dip28.py87
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1907dip40.py87
-rw-r--r--libtoprammer/chips/microchip8/pic18f1220dip18.py179
-rw-r--r--libtoprammer/chips/microchip8/pic18f2320dip28.py179
-rw-r--r--libtoprammer/chips/microchip8/pic18f2321dip28.py179
-rw-r--r--libtoprammer/chips/microchip8/pic18f67j60sip6.py111
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01.vh164
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01dip18/microchip01dip18.v2
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01dip28/Makefile3
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01dip28/microchip01dip28.v77
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01dip40/Makefile3
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01dip40/microchip01dip40.v77
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01dip40a/Makefile3
-rw-r--r--libtoprammer/fpga/src/microchip01/microchip01dip40a/microchip01dip40a.v77
-rw-r--r--libtoprammer/fpga/src/microchip16/microchip16.vh170
-rw-r--r--libtoprammer/fpga/src/microchip16/microchip16dip14dip20/Makefile3
-rw-r--r--libtoprammer/fpga/src/microchip16/microchip16dip14dip20/microchip16dip14dip20.v77
68 files changed, 5711 insertions, 1544 deletions
diff --git a/libtoprammer/chips/__init__.py b/libtoprammer/chips/__init__.py
index 9efbb02..e91bc74 100644
--- a/libtoprammer/chips/__init__.py
+++ b/libtoprammer/chips/__init__.py
@@ -15,5 +15,5 @@ from m24cxxdip8 import *
from m8cissp import *
from unitest import *
from w29ee011dip32 import *
-from microchip01 import *
-from microchip02 import *
+from microchip8 import *
+#from microchip16 import *
diff --git a/libtoprammer/chips/microchip01/__init__.py b/libtoprammer/chips/microchip01/__init__.py
deleted file mode 100644
index bc1cdbd..0000000
--- a/libtoprammer/chips/microchip01/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# Import all chip modules in **ALPHABETICAL** order
-
-from pic10f200dip8 import *
-from pic10f202dip8 import *
-from pic12f508dip8 import *
-from pic16f59sip6 import *
diff --git a/libtoprammer/chips/microchip01/microchip01_common.py b/libtoprammer/chips/microchip01/microchip01_common.py
deleted file mode 100644
index b121392..0000000
--- a/libtoprammer/chips/microchip01/microchip01_common.py
+++ /dev/null
@@ -1,425 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip common
-#
-# Copyright (c) 2012 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from libtoprammer.chip import *
-
-class Chip_Microchip01_common(Chip):
- CMD_LOAD_DATA_FOR_PGM = 0x02
- CMD_READ_DATA_FROM_PGM = 0x04
- CMD_INCREMENT_ADDRESS = 0x06
- CMD_BEGIN_PROGRAMMING = 0x08
- CMD_END_PROGRAMMING = 0x0E
- CMD_BULK_ERASE_PGM = 0x09
-
- PROGCMD_SENDINSTR = 1
- PROGCMD_SENDDATA = 2
- PROGCMD_READDATA = 3
-
- STAT_BUSY= 0x01
- STAT_SDIO = 0x02
-
- def __init__(self,
- chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
- signature,
- flashPageSize, flashPages,
- eepromPageSize, eepromPages,
- fuseBytes
- ):
- Chip.__init__(self,
- chipPackage = chipPackage,
- chipPinVCC = chipPinVCC,
- chipPinsVPP = chipPinsVPP,
- chipPinGND = chipPinGND)
- self.signature = signature
- self.flashPageSize = flashPageSize # Flash page size, in words
- self.flashPages = flashPages # Nr of flash pages
- self.eepromPageSize = eepromPageSize # EEPROM page size, in bytes
- self.eepromPages = eepromPages # Nr of EEPROM pages
- self.fuseBytes = fuseBytes # Nr of fuse bytes
- self.PC=0
- self.isInPmMode=False
-
-
- def readSignature(self):
- self.progressMeterInit("Reading signature", 0)
- signature = self.__readSignature()
- self.progressMeterFinish()
- return signature
-
- def erase(self):
- if(hasattr(self,'osccalAddr')):
- self.__erase()
- else:
- self.__erase(keepOSCCAL=False)
-
- def __erase(self, keepConfigWord=False, keepOSCCAL=True, keepUserIDLocation=False):
- OSCCAL = 0xfff
- self.__enterPM()
- if(keepConfigWord):
- self.progressMeterInit("Reading ConfigWord for backup", 0)
- CW = self.__getConfigWord()
- self.progressMeterFinish()
- if(keepOSCCAL):
- self.progressMeterInit("Reading OSCCAL)", 0)
- self.__setPC(self.osccalAddr)
- self.__sendReadFlashInstr()
- self.top.cmdDelay(0.00005)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- OSCCAL=self.top.cmdReadBufferReg16()
- self.progressMeterFinish()
- if(OSCCAL == 0xfff):
- self.progressMeterInit("OSCCAL value lost, restoring from backup location ...", 0)
- self.__setPC(self.osccalBackupAddr-self.osccalAddr)
- self.__sendReadFlashInstr()
- self.top.cmdDelay(0.00005)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- OSCCAL=self.top.cmdReadBufferReg16()
- self.progressMeterFinish()
- #print ("osccal: %x\n" % OSCCAL)
- #erase User ID Location and backup osccal Tooo
- if(not keepUserIDLocation):
- self.__setPC(self.userIDLocationAddr)
- self.progressMeterInit("Erasing chip", 0)
- self.__sendInstr(self.CMD_BULK_ERASE_PGM)
- self.top.hostDelay(0.01) #Tera
- self.progressMeterFinish()
- #OSCCAL=0xC12
- if(keepOSCCAL and OSCCAL != 0xfff):
- self.__enterPM()
- self.progressMeterInit("Writing osccal, value %x" % OSCCAL, 0)
- self.__setPC(self.osccalAddr)
- self.__sendInstr(self.CMD_LOAD_DATA_FOR_PGM)
- self.__setSDI(OSCCAL)
- self.top.hostDelay(0.000005)
- self.__sendWriteFlashInstr()
- self.progressMeterFinish()
- if(keepConfigWord):
- self.progressMeterInit("Write read ConfigWord, value %x" % CW, 0)
- self.__writeConfigWord(CW)
- self.progressMeterFinish()
- self.__exitPM()
-
-
- def readProgmem(self):
- nrWords = self.flashPages * self.flashPageSize
- image = ""
- self.__enterPM()
- self.progressMeterInit("Reading flash", nrWords)
- bufferedBytes = 0
- for word in range(0, nrWords):
- self.__incrementPC(1)
- self.__sendReadFlashInstr()
- #self.__busyWait()
- self.top.cmdDelay(0.00002) #20us wait - inconsistent data if skipped
- self.__readSDOBufferLow()
- bufferedBytes += 1
- self.__readSDOBufferHigh()
- bufferedBytes += 1
- if bufferedBytes == self.top.getBufferRegSize():
- image += self.top.cmdReadBufferReg(bufferedBytes)
- self.progressMeter(word)
- bufferedBytes = 0
- image += self.top.cmdReadBufferReg(bufferedBytes)
- self.progressMeterFinish()
- self.__exitPM()
- return image
-
- def writeProgmem(self, image):
- self.__enterPM()
- nrWords = self.flashPages * self.flashPageSize
- if len(image) > nrWords * 2 or len(image) % 2 != 0:
- self.throwError("Invalid flash image size %d (expected <=%d and word aligned)" %\
- (len(image), nrWords * 2))
- self.__enterPM()
- self.progressMeterInit("Writing flash", len(image) // 2)
- for word in range(0, len(image) // 2):
- self.progressMeter(word)
- #do not swap following two lines
- self.__incrementPC(1)
- self.__sendInstr(self.CMD_LOAD_DATA_FOR_PGM)
- WD = (byte2int(image[word * 2 + 1])<<8) | byte2int(image[word * 2 + 0])
- if(WD != 0xfff):
- self.__setSDI(WD)
- self.top.hostDelay(0.00002)
- self.__sendWriteFlashInstr()
-
- self.progressMeterFinish()
- self.__exitPM()
-
- def readFuse(self):
- self.__enterPM()
- fuses = []
- self.progressMeterInit("Reading fuses (configuration word)", 0)
- for CW in self.__getConfigWord():
- fuses.append(int2byte(CW & 0x00ff))
- fuses.append(int2byte((CW >> 8) & 0x00ff))
- self.progressMeterFinish()
- self.__exitPM()
- return b"".join(fuses)
-
- def readUserIdLocation(self):
- self.__enterPM()
- self.__setPC(self.userIDLocationAddr)
- for i in range(0, self.userIDLocationSize):
- self.__incrementPC(1)
- self.__sendReadFlashInstr()
- self.top.hostDelay(0.00002)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- self.__exitPM()
- return self.top.cmdReadBufferReg()[0:2*self.userIDLocationSize-1]
-
- def writeUserIdLocation(self, image):
- if len(image) > self.userIDLocationSize * 2 or len(image) % 2 != 0:
- self.throwError("Invalid flash image size %d (expected <=%d and word aligned)" %\
- (len(image), self.userIDLocationSize * 2))
- self.__enterPM()
- self.__setPC(self.userIDLocationAddr)
- self.progressMeterInit("Writing User ID Location", len(image) // 2)
- for word in range(0, len(image) // 2):
- self.progressMeter(word)
- #do not swap following two lines
- self.__incrementPC(1)
- self.__sendInstr(self.CMD_LOAD_DATA_FOR_PGM)
- WD = (byte2int(image[word * 2 + 1])<<8) | byte2int(image[word * 2 + 0])
- if(WD != 0xfff):
- self.__setSDI(WD)
- self.top.hostDelay(0.00002)
- self.__sendWriteFlashInstr()
- self.progressMeterFinish()
- self.__exitPM()
-
- def __getConfigWordSize(self):
- return self.fuseBytes // 2
-
- def __getConfigWord(self):
- self.__enterPM()
- self.__setPC(self.configWordAddr)
- retVal=[]
- for i in range(0,self.__getConfigWordSize()):
- self.__sendReadFlashInstr()
- self.top.cmdDelay(0.00002)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- retVal.append(self.top.cmdReadBufferReg16())
- self.__incrementPC(1)
- return retVal
-
- def writeFuse(self, image):
- self.__enterPM()
- if len(image) != 2*self.__getConfigWordSize():
- self.throwError("Invalid Fuses image size %d (expected %d)" %\
- (len(image), 2*self.__getConfigWordSize()))
- self.progressMeterInit("Writing fuses", 0)
- #print "image1:%x,,%x,,%x" % (byte2int(image[0]),byte2int(image[1]),byte2int(image[1])<<8)
- CW=[]
- for tBytes in zip(image[::2],image[1::2]):
- CW.append((byte2int(image[1])<<8) | byte2int(image[0]))
- self.__writeConfigWord(CW)
- self.progressMeterFinish()
- self.__exitPM()
-
- def __writeConfigWord(self, listConfigWord16):
- self.__enterPM()
- self.__setPC(self.configWordAddr)
- for configWord16 in listConfigWord16:
- self.__sendInstr(self.CMD_LOAD_DATA_FOR_PGM)
- self.__setSDI(configWord16)
- self.top.hostDelay(0.00002)
- self.__sendWriteFlashInstr()
- self.__incrementPC(1)
-
- def __readSignature(self):
- if(hasattr(self,'deviceIDAddr')):
- idAddr = self.deviceIDAddr
- idSize = 1
- else:
- idAddr = self.userIDLocationAddr
- idSize = self.userIDLocationSize
- self.__enterPM()
- self.__incrementPC(idAddr)
- for i in range(0, idSize):
- self.__incrementPC(1)
- self.__sendReadFlashInstr()
- self.top.hostDelay(0.00002)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- self.__exitPM()
- return self.top.cmdReadBufferReg()[0:2*idSize-1]
-
- def __enterPM(self):
- if self.isInPmMode:
- self.__setPC(self.logicalFlashSize - 1)
- return
- self.PC = self.logicalFlashSize - 1
- "Enter HV programming mode. Vdd first entry mode"
- self.applyVCC(False)
- self.applyVPP(False)
- self.applyGND(False)
- self.__setPins(0,0)
- self.top.cmdSetVCCVoltage(self.voltageVDD)
- self.top.cmdSetVPPVoltage(self.voltageVPP)
- #self.top.cmdEnableZifPullups(True)
- self.applyGND(True)
-
- self.applyVCC(True)
- self.top.cmdDelay(0.000005)
-
- for i in range(0,2):
- self.applyVPP(True)
- self.top.cmdDelay(0.000005)
- self.applyVPP(False)
- self.top.cmdDelay(0.000031)
- self.applyVPP(True)
- #self.top.cmdEnableZifPullups(True)
-
- self.top.cmdDelay(0.000005) #least 5us is required to reach Vdd first entry PM
- self.isInPmMode=True
-
- def __checkSignature(self):
- signature = self.__readSignature()
- if signature != self.signature:
- msg = "Unexpected device signature. " +\
- "Want %02X%02X%02X, but got %02X%02X%02X" % \
- (byte2int(self.signature[0]), byte2int(self.signature[1]),
- byte2int(self.signature[2]),
- byte2int(signature[0]), byte2int(signature[1]),
- byte2int(signature[2]))
- if self.top.getForceLevel() >= 1:
- self.printWarning(msg)
- else:
- self.throwError(msg)
-
- def __exitPM(self):
- "Exit HV programming mode. Vdd last exit mode"
- self.__setPins(0,0)
- self.applyVPP(False)
- self.applyGND(False)
- self.top.hostDelay(0.000005)
- self.applyVCC(False)
- self.isInPmMode=False
-
- def __sendReadFlashInstr(self):
- '''
- '''
- self.__sendInstr(self.CMD_READ_DATA_FROM_PGM)
- self.__loadCommand(self.PROGCMD_READDATA)
-
- def __sendWriteFlashInstr(self):
- '''
- '''
- self.__loadCommand(self.PROGCMD_SENDDATA)
- self.top.hostDelay(0.000005)
- self.__sendInstr(self.CMD_BEGIN_PROGRAMMING)
- self.top.hostDelay(0.001)#025) #Tprog
- self.__sendInstr(self.CMD_END_PROGRAMMING)
- self.top.hostDelay(0.0001) #Tdis
-
- def __sendInstr(self, SDI):
- '''
- see __loadCommand for availabla commands
- '''
- self.top.cmdFPGAWrite(0x13, SDI & 0xFF)
- self.__loadCommand(self.PROGCMD_SENDINSTR)
- # We do not poll the busy flag, because that would result
- # in a significant slowdown. We delay long enough for the
- # command to finish execution, instead.
- #self.top.hostDelay(0.001)
- self.top.hostDelay(0.000005)
-
- def __setSDI(self, sdi):
- '''
- set 14 bit sdi value
- '''
- self.top.cmdFPGAWrite(0x13, sdi & 0xFF)
- self.top.cmdFPGAWrite(0x14, (sdi>>8) & 0x0F)
-
- def __loadCommand(self, command):
- '''
- `define CMD_SENDINSTR 1
- `define CMD_SENDDATA 2
- `define CMD_READDATA 3
- '''
- self.top.cmdFPGAWrite(0x12, command & 0xFF)
-
- def __runCommandSync(self, command):
- self.__loadCommand(command)
- self.__busyWait()
-
- def __setPC(self, address):
- while(self.PC!=address):
- self.__incrementPC(1)
-
- def __incrementPC(self, count):
- for address in range(0, count):
- self.__sendInstr(self.CMD_INCREMENT_ADDRESS)
- self.PC += 1
- if (self.PC == self.logicalFlashSize):
- self.PC = 0
-
- def __setPins(self, ICSPCLK=0, SDIODRIVEN=0, SDIOVALUE=0):
- '''
- setPins
- '''
- data = 0
- if ICSPCLK:
- data |= 1
- if SDIODRIVEN:
- data |= 2
- if SDIOVALUE:
- data |= 4
- self.top.cmdFPGAWrite(0x15, data)
-
- def __getStatusFlags(self):
- '''
- '''
- self.top.cmdFPGARead(0x12)
- stat = self.top.cmdReadBufferReg()
- return byte2int(stat[0])
-
- def __readSDOBufferHigh(self):
- self.top.cmdFPGARead(0x10)
-
- def __readSDOBufferLow(self):
- self.top.cmdFPGARead(0x13)
-
- def __rawSDIOState(self):
- return bool(self.__getStatusFlags() & self.STAT_SDIO)
-
- def __busy(self):
- return bool(self.__getStatusFlags() & self.STAT_BUSY)
-
- def __busyWait(self):
- for i in range(0, 100):
- if not self.__busy():
- return
- self.top.hostDelay(0.01)
- self.throwError("Timeout in busywait.")
-
- def __waitHighSDIO(self):
- for i in range(0, 100):
- if self.__rawSDOState():
- return
- self.top.hostDelay(0.01)
- self.throwError("Timeout waiting for SDO.")
diff --git a/libtoprammer/chips/microchip01/pic10f200dip8.py b/libtoprammer/chips/microchip01/pic10f200dip8.py
deleted file mode 100644
index 855f7a1..0000000
--- a/libtoprammer/chips/microchip01/pic10f200dip8.py
+++ /dev/null
@@ -1,83 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip PIC10F200, PIC10F204 and PI10f220 DIP8
-#
-# Copyright (c) 2012 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from microchip01_common import *
-
-
-class Chip_Pic10F200dip8(Chip_Microchip01_common):
- voltageVDD = 5
- voltageVPP =13
- #CONFIGURATION WORD FOR PIC10F200/202/204/206
- #X X X X X X X MCLRE /CP WDT X X
- logicalFlashSize = 0x200
- userIDLocationSize = 4
- SUPPORT_SIGREAD = (0 << 1)
-
-
- def __init__(self):
- Chip_Microchip01_common.__init__(self,
- chipPackage = "DIP8",
- chipPinVCC = 2,
- chipPinsVPP = 8,
- chipPinGND = 7,
- signature = "\x09\x18\x24\x35",
- flashPageSize = 0x100,
- flashPages = 1,
- eepromPageSize = 0,
- eepromPages = 0,
- fuseBytes = 2
- )
- self.configWordAddr = self.logicalFlashSize-1
- self.osccalAddr = self.flashPageSize-1
- self.userIDLocationAddr = self.flashPageSize
- self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
- self.programMemoryByteAddressRange = [(0,2*self.flashPageSize)]
- self.configWordByteAddressRange = [(2*self.configWordAddr,2*self.configWordAddr+1), (2*0xFFF, 2*0xFFF+1)]
- self.userIDLocationByteAddressRange = [(2*self.userIDLocationAddr, 2*(self.userIDLocationAddr+self.userIDLocationSize)-1)]
-
-
-fuseDesc = (
- BitDescription(0, "Unused"),
- BitDescription(1, "Unused"),
- BitDescription(2, "WDTE"),
- BitDescription(3, "!CP"),
- BitDescription(4, "MCLRE"),
- BitDescription(5, "Unused"),
- BitDescription(6, "Unused"),
- BitDescription(7, "Unused"),
- BitDescription(8, "Unused"),
- BitDescription(9, "Unused"),
- BitDescription(10, "Unused"),
- BitDescription(11, "Unused"),
-)
-
-ChipDescription(
- Chip_Pic10F200dip8,
- bitfile = "pic10fxxxdip8",
- chipID = "pic10f200dip8",
- runtimeID = (0xDE01, 0x01),
- chipVendors = "Microchip",
- description = "PIC10F200, PIC10F204, PIC10F220",
- packages = ( ("DIP8", ""), ),
- fuseDesc = fuseDesc,
- maintainer = "Pavel Stemberk <stemberk@gmail.com>",
-)
diff --git a/libtoprammer/chips/microchip01/pic10f202dip8.py b/libtoprammer/chips/microchip01/pic10f202dip8.py
deleted file mode 100644
index 5c835bb..0000000
--- a/libtoprammer/chips/microchip01/pic10f202dip8.py
+++ /dev/null
@@ -1,81 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip PIC10F202, PIC10F206 and PIC10f222 DIP8
-#
-# Copyright (c) 2012 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from microchip01_common import *
-
-class Chip_Pic10F202dip8(Chip_Microchip01_common):
- voltageVDD = 5
- voltageVPP = 13
- #CONFIGURATION WORD FOR PIC10F200/202/204/206
- #X X X X X X X MCLRE /CP WDT X X
- logicalFlashSize = 0x400
- userIDLocationSize = 4
- SUPPORT_SIGREAD = (0 << 1)
-
- def __init__(self):
- Chip_Microchip01_common.__init__(self,
- chipPackage="DIP8",
- chipPinVCC=2,
- chipPinsVPP=8,
- chipPinGND=7,
- signature="\x09\x18\x24\x35",
- flashPageSize=0x200,
- flashPages=1,
- eepromPageSize=0,
- eepromPages=0,
- fuseBytes=2
- )
- self.configWordAddr = self.logicalFlashSize - 1
- self.osccalAddr = self.flashPageSize - 1
- self.userIDLocationAddr = self.flashPageSize
- self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
- self.programMemoryByteAddressRange = [(0,2*self.flashPageSize)]
- self.configWordByteAddressRange = [(2*self.configWordAddr,2*self.configWordAddr+1), (2*0xFFF, 2*0xFFF+1)]
- self.userIDLocationByteAddressRange = [(2*self.userIDLocationAddr, 2*(self.userIDLocationAddr+self.userIDLocationSize)-1)]
-
-
-fuseDesc = (
- BitDescription(0, "Unused"),
- BitDescription(1, "Unused"),
- BitDescription(2, "WDTE"),
- BitDescription(3, "!CP"),
- BitDescription(4, "MCLRE"),
- BitDescription(5, "Unused"),
- BitDescription(6, "Unused"),
- BitDescription(7, "Unused"),
- BitDescription(8, "Unused"),
- BitDescription(9, "Unused"),
- BitDescription(10, "Unused"),
- BitDescription(11, "Unused"),
-)
-
-ChipDescription(
- Chip_Pic10F202dip8,
- bitfile = "pic10fxxxdip8",
- chipID = "pic10f202dip8",
- runtimeID = (0xDE01, 0x01),
- chipVendors = "Microchip",
- description = "PIC10F202, PIC10F206, PIC10F222",
- packages = (("DIP8", ""),),
- fuseDesc = fuseDesc,
- maintainer = "Pavel Stemberk <stemberk@gmail.com>",
-)
diff --git a/libtoprammer/chips/microchip01/pic12f508dip8.py b/libtoprammer/chips/microchip01/pic12f508dip8.py
deleted file mode 100644
index 63024fa..0000000
--- a/libtoprammer/chips/microchip01/pic12f508dip8.py
+++ /dev/null
@@ -1,75 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip PIC12F508 DIP8
-#
-# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from microchip01_common import *
-
-class Chip_Pic12F508dip8(Chip_Microchip01_common):
- voltageVDD = 5
- voltageVPP = 13
- #CONFIGURATION WORD FOR PIC10F200/202/204/206
- #X X X X X X X MCLRE /CP WDT X X
- logicalFlashSize = 0x400
- userIDLocationSize = 4
- SUPPORT_SIGREAD = (0 << 1)
-
- def __init__(self):
- Chip_Microchip01_common.__init__(self,
- chipPackage="DIP8",
- chipPinVCC=1,
- chipPinsVPP=4,
- chipPinGND=8,
- signature="",
- flashPageSize=0x200,
- flashPages=1,
- eepromPageSize=0,
- eepromPages=0,
- fuseBytes=2
- )
- self.configWordAddr = self.logicalFlashSize - 1
- self.osccalAddr = self.flashPageSize - 1
- self.userIDLocationAddr = self.flashPageSize
- self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
-fuseDesc = (
- BitDescription(0, "FOSC[0] 00=LP, 01=XT, 10=INTOSC, 11=EXTRC"),
- BitDescription(1, "FOSC[1]"),
- BitDescription(2, "WDTE"),
- BitDescription(3, "!CP"),
- BitDescription(4, "MCLRE"),
- BitDescription(5, "Unused"),
- BitDescription(6, "Unused"),
- BitDescription(7, "Unused"),
- BitDescription(8, "Unused"),
- BitDescription(9, "Unused"),
- BitDescription(10, "Unused"),
- BitDescription(11, "Unused"),
-)
-ChipDescription(
- Chip_Pic12F508dip8,
- bitfile = "microchip01dip8",
- chipID = "pic12f508dip8",
- runtimeID = (0xDE02, 0x01),
- chipVendors = "Microchip",
- description = "PIC12F508",
- fuseDesc = fuseDesc,
- packages = (("DIP8", ""),),
- maintainer = "Pavel Stemberk <stemberk@gmail.com>",
-)
diff --git a/libtoprammer/chips/microchip01/pic16f59sip6.py b/libtoprammer/chips/microchip01/pic16f59sip6.py
deleted file mode 100644
index e6c9287..0000000
--- a/libtoprammer/chips/microchip01/pic16f59sip6.py
+++ /dev/null
@@ -1,81 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip PIC16F59 SIP6
-#
-# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from microchip01_common import *
-
-
-class Chip_Pic16F59sip6(Chip_Microchip01_common):
- voltageVDD = 5
- voltageVPP =13
- #CONFIGURATION WORD FOR PIC10F200/202/204/206
- #X X X X X X X MCLRE /CP WDT X X
- logicalFlashSize = 0x1000
- userIDLocationSize = 4
- SUPPORT_SIGREAD = (0 << 1)
-
-
- def __init__(self):
- Chip_Microchip01_common.__init__(self,
- chipPackage = "DIP10",
- chipPinVCC = 9,
- chipPinsVPP = 10,
- chipPinGND = 8,
- signature = "",
- flashPageSize = 0x200,
- flashPages = 4,
- eepromPageSize = 0,
- eepromPages = 0,
- fuseBytes = 2
- )
- self.configWordAddr = self.logicalFlashSize-1
- self.userIDLocationAddr = self.flashPageSize
- self.programMemoryByteAddressRange = [(0,2*self.flashPageSize)]
- self.configWordByteAddressRange = [(2*self.configWordAddr,2*self.configWordAddr+self.fuseBytes-1)]
- self.userIDLocationByteAddressRange = [(2*self.userIDLocationAddr, 2*(self.userIDLocationAddr+self.userIDLocationSize)-1)]
-
-
-fuseDesc = (
- BitDescription(0, "FOSC0"),
- BitDescription(1, "FOSC1 - 00=LP, 01=XT, 10=HS, 11=RC"),
- BitDescription(2, "WDTE"),
- BitDescription(3, "!CP"),
- BitDescription(4, "Unused"),
- BitDescription(5, "Unused"),
- BitDescription(6, "Unused"),
- BitDescription(7, "Unused"),
- BitDescription(8, "Unused"),
- BitDescription(9, "Unused"),
- BitDescription(10, "Unused"),
- BitDescription(11, "Unused"),
-)
-
-ChipDescription(
- Chip_Pic16F59sip6,
- bitfile = "microchip01sip6",
- chipID = "pic16f59sip6",
- runtimeID = (0xDE05, 0x01),
- chipVendors = "Microchip",
- description = "PIC16F59",
- packages = ( ("DIP10", ""), ),
- fuseDesc = fuseDesc,
- maintainer = "Pavel Stemberk <stemberk@gmail.com>",
-)
diff --git a/libtoprammer/chips/microchip02/__init__.py b/libtoprammer/chips/microchip02/__init__.py
deleted file mode 100644
index fd04f4e..0000000
--- a/libtoprammer/chips/microchip02/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# Import all chip modules in **ALPHABETICAL** order
-
-from pic10f322dip8 import *
-from pic12f1822dip8 import *
-from pic16f1824dip14 import *
diff --git a/libtoprammer/chips/microchip02/microchip02_common.py b/libtoprammer/chips/microchip02/microchip02_common.py
deleted file mode 100644
index 6aa1e75..0000000
--- a/libtoprammer/chips/microchip02/microchip02_common.py
+++ /dev/null
@@ -1,446 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip common
-#
-# Copyright (c) 2012 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from libtoprammer.chip import *
-
-class Chip_Microchip02_common(Chip):
- CMD_LOAD_CONFIGURATION = 0x00
- CMD_LOAD_DATA_FOR_PGM = 0x02
- CMD_READ_DATA_FROM_PGM = 0x04
- CMD_INCREMENT_ADDRESS = 0x06
- CMD_RESET_ADDRESS = 0x16
- CMD_BEGIN_INTERNALLY_TIMED_PROGRAMMING = 0x08
- CMD_BEGIN_EXTERNALLY_TIMED_PROGRAMMING = 0x18
- CMD_END_EXTERNALLY_TIMED_PROGRAMMING = 0x0A
- CMD_BULK_ERASE_PGM = 0x09
- CMD_ROW_ERASE_PGM = 0x11
-
- PROGCMD_SENDINSTR = 1
- PROGCMD_SENDDATA = 2
- PROGCMD_READDATA = 3
-
- STAT_BUSY= 0x01
- STAT_SDIO = 0x02
-
- def __init__(self,
- chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
- signature,
- flashPageSize, flashPages,
- eepromPageSize, eepromPages,
- fuseBytes
- ):
- Chip.__init__(self,
- chipPackage = chipPackage,
- chipPinVCC = chipPinVCC,
- chipPinsVPP = chipPinsVPP,
- chipPinGND = chipPinGND)
- self.signature = signature
- self.flashPageSize = flashPageSize # Flash page size, in words
- self.flashPages = flashPages # Nr of flash pages
- self.eepromPageSize = eepromPageSize # EEPROM page size, in bytes
- self.eepromPages = eepromPages # Nr of EEPROM pages
- self.fuseBytes = fuseBytes # Nr of fuse bytes
- self.PC=0
- self.isInPmMode = False
- self.isInsideProgramMemoryArea = True
- #self.rowSize = rowSize
- #self.nLatches = nLatches
- #self.logicalFlashProgramMemorySize = logicalFlashProgramMemorySize
- #self.logicalFlashConfigurationMemorySize = logicalFlashConfigurationMemorySize
-
-
- def readSignature(self):
- self.progressMeterInit("Reading signature", 0)
- signature = self.__readSignature()
- self.progressMeterFinish()
- return signature
-
- def erase(self):
- self.__erase()
-
- def __erase(self, keepConfigWord=False, keepUserIDLocation=False):
- OSCCAL = 0xfff
- self.__enterPM()
- if(keepConfigWord):
- self.progressMeterInit("Reading ConfigWord for backup", 0)
- CW = self.__getConfigWord()
- self.progressMeterFinish()
- #erase User ID Location and backup osccal Tooo
- if(not keepUserIDLocation):
- self.__enterConfigArea()
- self.__setPC(self.userIDLocationAddr)
- self.progressMeterInit("Erasing chip", 0)
- self.__sendInstr(self.CMD_BULK_ERASE_PGM)
- self.top.hostDelay(0.01) #Tera
- self.progressMeterFinish()
- if(keepConfigWord):
- self.progressMeterInit("Write ConfigWord, value %x" % CW, 0)
- self.__writeConfigWord(CW)
- self.progressMeterFinish()
- self.__exitPM()
-
-
- def readProgmem(self):
- nrWords = self.flashPages * self.flashPageSize
- image = ""
- self.__enterPM()
- self.progressMeterInit("Reading flash", nrWords)
- bufferedBytes = 0
- for word in range(0, nrWords):
- self.__sendReadFlashInstr()
- self.top.cmdDelay(0.00002) #20us wait - inconsistent data if skipped
- self.__readSDOBufferLow()
- bufferedBytes += 1
- self.__readSDOBufferHigh()
- bufferedBytes += 1
- if bufferedBytes == self.top.getBufferRegSize():
- image += self.top.cmdReadBufferReg(bufferedBytes)
- self.progressMeter(word)
- bufferedBytes = 0
- self.__incrementPC(1)
- image += self.top.cmdReadBufferReg(bufferedBytes)
- self.progressMeterFinish()
- self.__exitPM()
- return image
-
- def writeProgmem(self, image):
- self.__enterPM()
- nrWords = self.flashPages * self.flashPageSize
- if len(image) > nrWords * 2 or len(image) % 2 != 0:
- self.throwError("Invalid flash image size %d (expected <=%d and word aligned)" %\
- (len(image), nrWords * 2))
- self.__enterPM()
- self.progressMeterInit("Writing flash", len(image) // 2)
- for wordAddr in range(0, len(image) // 2):
- self.progressMeter(wordAddr)
- self.__sendInstr(self.CMD_LOAD_DATA_FOR_PGM)
- WD = (byte2int(image[wordAddr * 2 + 1])<<8) | byte2int(image[wordAddr * 2 + 0])
- if(WD != 0xfff):
- self.__setSDI(WD)
- self.top.hostDelay(0.00002)
- self.__loadCommand(self.PROGCMD_SENDDATA)
- self.top.hostDelay(0.000005)
- self.__sendWriteFlashInstr()
- self.__incrementPC(1)
- self.progressMeterFinish()
- self.__exitPM()
-
- def readFuse(self):
- self.__enterPM()
- fuses = []
- self.progressMeterInit("Reading fuses (configuration word)", 0)
- for CW in self.__getConfigWord():
- fuses.append(int2byte(CW & 0x00ff))
- fuses.append(int2byte((CW >> 8) & 0x00ff))
- self.progressMeterFinish()
- self.__exitPM()
- return b"".join(fuses)
-
- def readUserIdLocation(self):
- self.__enterPM()
- self.__enterConfigArea()
- self.__setPC(self.userIDLocationAddr)
- self.progressMeterInit("Reading User ID Location", 0)
- for i in range(0, self.userIDLocationSize):
- self.__sendReadFlashInstr()
- self.top.hostDelay(0.00002)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- self.__incrementPC(1)
- self.__exitPM()
- self.progressMeterFinish()
- return self.top.cmdReadBufferReg()[0:2*self.userIDLocationSize]
-
- def writeUserIdLocation(self, image):
- if len(image) > self.userIDLocationSize * 2 or len(image) % 2 != 0:
- self.throwError("Invalid flash image size %d (expected <=%d and word aligned)" %\
- (len(image), self.userIDLocationSize * 2))
- self.__enterPM()
- self.__enterConfigArea()
- #self.__setPC(self.userIDLocationAddr)
- self.__setPC(0x2004)
- self.progressMeterInit("Writing User ID Location", (len(image) // 2) - 1)
- for word in range(0, (len(image) // 2)):
- self.progressMeter(word)
- #do not swap following two lines
- self.__sendInstr(self.CMD_LOAD_DATA_FOR_PGM)
- WD = (byte2int(image[word * 2 + 1])<<8) | byte2int(image[word * 2 + 0])
- self.__setSDI(WD)
- #self.top.hostDelay(0.00002)
- self.__loadCommand(self.PROGCMD_SENDDATA)
- self.__incrementPC(1)
- self.top.hostDelay(0.000005)
- self.__sendWriteFlashInstr()
- self.progressMeterFinish()
- self.__exitPM()
-
- def __getConfigWordSize(self):
- return self.fuseBytes // 2
-
- def __getConfigWord(self):
- self.__enterPM()
- self.__enterConfigArea()
- self.__setPC(self.configWordAddr)
- retVal=[]
- for i in range(0,self.__getConfigWordSize()):
- self.__sendReadFlashInstr()
- self.top.cmdDelay(0.00002)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- self.__incrementPC(1)
- retVal.append(self.top.cmdReadBufferReg16())
-
- return retVal
-
- def writeFuse(self, image):
- self.__enterPM()
- if len(image) != 2*self.__getConfigWordSize():
- self.throwError("Invalid Fuses image size %d (expected %d)" %\
- (len(image), 2*self.__getConfigWordSize()))
- self.progressMeterInit("Writing fuses", 0)
- #print "image1:%x,,%x,,%x" % (byte2int(image[0]),byte2int(image[1]),byte2int(image[1])<<8)
- CW=[]
- for tBytes in zip(image[::2],image[1::2]):
- CW.append((byte2int(tBytes[1])<<8) | byte2int(tBytes[0]))
- self.__writeConfigWord(CW)
- self.progressMeterFinish()
- self.__exitPM()
-
- def __writeConfigWord(self, listConfigWord16):
- #Externally timed writes are not supported
- #for Configuration and Calibration bits. Any
- #externally timed write to the Configuration
- #or Calibration Word will have no effect on
- #the targeted word.
- self.__enterPM()
- self.__enterConfigArea()
- self.__setPC(self.configWordAddr-1)
- print "PC:{:x}".format(self.PC)
- for configWord16 in listConfigWord16:
- self.__incrementPC(1)
- print "write CW {:x}".format(configWord16)
- self.__sendInstr(self.CMD_LOAD_DATA_FOR_PGM)
- self.__setSDI(configWord16)
- self.top.hostDelay(0.00002)
- self.__loadCommand(self.PROGCMD_SENDDATA)
- self.top.hostDelay(0.000005)
- self.__sendInstr(self.CMD_BEGIN_INTERNALLY_TIMED_PROGRAMMING)
- self.top.hostDelay(0.005)#TPINT
-
-
- def __readSignature(self):
- self.__enterPM()
- self.__enterConfigArea()
- self.__setPC(self.deviceIDAddr)
- idSize = 1
- for i in range(0, idSize):
- self.__sendReadFlashInstr()
- self.top.hostDelay(0.00002)
- self.__readSDOBufferLow()
- self.__readSDOBufferHigh()
- self.__incrementPC(1)
- self.__exitPM()
- return self.top.cmdReadBufferReg()[0:2*idSize]
-
- def __enterPM(self):
- if self.isInPmMode:
- self.__resetPC()
- return
- self.PC = 0
- "Enter HV programming mode. Vdd first entry mode"
- self.applyVCC(False)
- self.applyVPP(False)
- self.applyGND(False)
- self.__setPins(0,0)
- self.top.cmdSetVCCVoltage(self.voltageVDD)
- self.top.cmdSetVPPVoltage(self.voltageVPP)
- #self.top.cmdEnableZifPullups(True)
- self.applyGND(True)
-
- self.applyVCC(True)
- self.top.cmdDelay(0.000005)
-
- for i in range(0,2):
- self.applyVPP(True)
- self.top.cmdDelay(0.000005)
- self.applyVPP(False)
- self.top.cmdDelay(0.000031)
- self.applyVPP(True)
- #self.top.cmdEnableZifPullups(True)
-
- self.top.cmdDelay(0.000005) #least 5us is required to reach Vdd first entry PM
- self.isInPmMode=True
-
- def __checkSignature(self):
- signature = self.__readSignature()
- if signature != self.signature:
- msg = "Unexpected device signature. " +\
- "Want %02X%02X%02X, but got %02X%02X%02X" % \
- (byte2int(self.signature[0]), byte2int(self.signature[1]),
- byte2int(self.signature[2]),
- byte2int(signature[0]), byte2int(signature[1]),
- byte2int(signature[2]))
- if self.top.getForceLevel() >= 1:
- self.printWarning(msg)
- else:
- self.throwError(msg)
-
- def __exitPM(self):
- "Exit HV programming mode. Vdd last exit mode"
- self.__setPins(0,0)
- self.applyVPP(False)
- self.applyGND(False)
- self.top.hostDelay(0.000005)
- self.applyVCC(False)
- self.isInPmMode=False
-
- def __sendReadFlashInstr(self):
- '''
- '''
- self.__sendInstr(self.CMD_READ_DATA_FROM_PGM)
- self.__loadCommand(self.PROGCMD_READDATA)
-
- def __sendWriteFlashInstr(self):
- '''
- '''
- self.__sendInstr(self.CMD_BEGIN_EXTERNALLY_TIMED_PROGRAMMING)
- self.top.hostDelay(0.001)#025) #Tprog
- self.__sendInstr(self.CMD_END_EXTERNALLY_TIMED_PROGRAMMING)
- self.top.hostDelay(0.0001) #Tdis
-
- def __sendInstr(self, SDI):
- '''
- see __loadCommand for availabla commands
- '''
- self.top.cmdFPGAWrite(0x13, SDI & 0xFF)
- self.__loadCommand(self.PROGCMD_SENDINSTR)
- # We do not poll the busy flag, because that would result
- # in a significant slowdown. We delay long enough for the
- # command to finish execution, instead.
- #self.top.hostDelay(0.001)
- self.top.hostDelay(0.000005)
-
- def __setSDI(self, sdi):
- '''
- set 14 bit sdi value
- '''
- self.top.cmdFPGAWrite(0x13, sdi & 0xFF)
- self.top.cmdFPGAWrite(0x14, (sdi>>8) & 0x3F)
-
- def __loadCommand(self, command):
- '''
- `define CMD_SENDINSTR 1
- `define CMD_SENDDATA 2
- `define CMD_READDATA 3
- '''
- self.top.cmdFPGAWrite(0x12, command & 0xFF)
-
- def __runCommandSync(self, command):
- self.__loadCommand(command)
- self.__busyWait()
-
- def __setPC(self, address):
- if(self.isInsideProgramMemoryArea):
- if(address >= self.logicalFlashProgramMemorySize):
- raise(TOPException('Cannot set PC to address {:x}'.format(address)))
- if(address < self.PC):
- self.__resetPC()
- self.__setPC(address)
- else:
- if(address < self.logicalFlashProgramMemorySize):
- raise(TOPException('Cannot set PC to address {:x}'.format(address)))
- if(address < self.PC):
- self.__resetPC()
- self.__enterConfigArea()
- self.__setPC(address)
- while(self.PC!=address):
- self.__incrementPC(1)
-
- def __incrementPC(self, count):
- for address in range(0, count):
- self.__sendInstr(self.CMD_INCREMENT_ADDRESS)
- self.PC += 1
- if(self.isInsideProgramMemoryArea):
- if (self.PC == self.logicalFlashProgramMemorySize):
- self.PC = 0
- else:
- if (self.PC == self.logicalFlashConfigurationMemorySize):
- self.PC = self.logicalFlashProgramMemorySize
-
- def __resetPC(self):
- self.__sendInstr(self.CMD_RESET_ADDRESS)
- self.PC = 0
- self.isInsideProgramMemoryArea = True
-
- def __enterConfigArea(self, wordLatched = 0):
- self.__sendInstr(self.CMD_LOAD_CONFIGURATION)
- self.__setSDI(wordLatched)
- #self.top.hostDelay(0.00002)
- self.__loadCommand(self.PROGCMD_SENDDATA)
- self.PC = self.logicalFlashProgramMemorySize
- self.isInsideProgramMemoryArea = False
-
- def __setPins(self, ICSPCLK=0, SDIODRIVEN=0, SDIOVALUE=0):
- '''
- setPins
- '''
- data = 0
- if ICSPCLK:
- data |= 1
- if SDIODRIVEN:
- data |= 2
- if SDIOVALUE:
- data |= 4
- self.top.cmdFPGAWrite(0x15, data)
-
- def __getStatusFlags(self):
- '''
- '''
- self.top.cmdFPGARead(0x12)
- stat = self.top.cmdReadBufferReg()
- return byte2int(stat[0])
-
- def __readSDOBufferHigh(self):
- self.top.cmdFPGARead(0x10)
-
- def __readSDOBufferLow(self):
- self.top.cmdFPGARead(0x13)
-
- def __rawSDIOState(self):
- return bool(self.__getStatusFlags() & self.STAT_SDIO)
-
- def __busy(self):
- return bool(self.__getStatusFlags() & self.STAT_BUSY)
-
- def __busyWait(self):
- for i in range(0, 100):
- if not self.__busy():
- return
- self.top.hostDelay(0.01)
- self.throwError("Timeout in busywait.")
-
- def __waitHighSDIO(self):
- for i in range(0, 100):
- if self.__rawSDOState():
- return
- self.top.hostDelay(0.01)
- self.throwError("Timeout waiting for SDO.")
diff --git a/libtoprammer/chips/microchip02/pic10f322dip8.py b/libtoprammer/chips/microchip02/pic10f322dip8.py
deleted file mode 100644
index 6bf7ae6..0000000
--- a/libtoprammer/chips/microchip02/pic10f322dip8.py
+++ /dev/null
@@ -1,86 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip PIC10F322 DIP8
-#
-# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from microchip02_common import *
-
-class Chip_Pic10F322dip8(Chip_Microchip02_common):
- voltageVDD = 3
- voltageVPP = 8.5
- #CONFIGURATION WORD FOR PIC10F200/202/204/206
- #X X X X X X X MCLRE /CP WDT X X
- logicalFlashProgramMemorySize = 0x2000
- logicalFlashConfigurationMemorySize = 0x2000
- userIDLocationSize = 4
- rowSize = 32
- nLatches = 16
-
- def __init__(self):
- Chip_Microchip02_common.__init__(self,
- chipPackage="DIP8",
- chipPinVCC=2,
- chipPinsVPP=8,
- chipPinGND=7,
- signature="\x02\x84",
- flashPageSize=0x200,
- flashPages=1,
- eepromPageSize=0,
- eepromPages=0,
- fuseBytes=2
- )
- self.configWordAddr = 0x2007
- #self.osccalAddr = 0x2000
- self.userIDLocationAddr = 0x2000
- self.deviceIDAddr = 0x2006
- self.programMemoryByteAddressRange = [(0,2*self.flashPageSize)]
- self.configWordByteAddressRange = [(2*self.configWordAddr,2*self.configWordAddr+1)]
- self.userIDLocationByteAddressRange = [(2*self.userIDLocationAddr, 2*(self.userIDLocationAddr+self.userIDLocationSize)-1)]
-
- #self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
-
-fuseDesc = (
- BitDescription(0, "FOSC, 1=CLKIN, 0=internal"),
- BitDescription(1, "BOREN[0]"),
- BitDescription(2, "BOREN[1]"),
- BitDescription(3, "WDTE[0]"),
- BitDescription(4, "WDTE[1]"),
- BitDescription(5, "nPWRTE"),
- BitDescription(6, "MCLRE, 1=RA3 is nMCLR, weak pull-up enabled"),
- BitDescription(7, "nCP"),
- BitDescription(8, "LVP"),
- BitDescription(9, "LPBOREN"),
- BitDescription(10, "BORV"),
- BitDescription(11, "WRT[0]"),
- BitDescription(12, "WRT[1] 11=write protection off"),
- BitDescription(13, "Unused"),
-)
-
-ChipDescription(
- Chip_Pic10F322dip8,
- bitfile = "pic10fxxxdip8",
- chipID = "pic10f322dip8",
- runtimeID = (0xDE01, 0x01),
- chipVendors = "Microchip",
- description = "PIC10F322, PIC10LF322",
- packages = (("DIP8", ""),),
- fuseDesc = fuseDesc,
- maintainer = "Pavel Stemberk <stemberk@gmail.com>",
-)
diff --git a/libtoprammer/chips/microchip02/pic12f1822dip8.py b/libtoprammer/chips/microchip02/pic12f1822dip8.py
deleted file mode 100644
index cf69d32..0000000
--- a/libtoprammer/chips/microchip02/pic12f1822dip8.py
+++ /dev/null
@@ -1,103 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip PIC12F1822 DIP8
-#
-# Copyright (c) 2012 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from microchip02_common import *
-
-class Chip_Pic12F1822dip8(Chip_Microchip02_common):
- voltageVDD = 3
- voltageVPP = 8.5
- #CONFIGURATION WORD FOR PIC10F200/202/204/206
- #X X X X X X X MCLRE /CP WDT X X
- logicalFlashProgramMemorySize = 0x8000
- logicalFlashConfigurationMemorySize = 0x8000
- rowSize = 16
- nLatches = 16
- userIDLocationSize = 4
-
- def __init__(self):
- Chip_Microchip02_common.__init__(self,
- chipPackage="DIP8",
- chipPinVCC=1,
- chipPinsVPP=4,
- chipPinGND=8,
- signature="\x08\x27",
- flashPageSize=0x800,
- flashPages=1,
- eepromPageSize=0,
- eepromPages=0,
- fuseBytes=4
- )
- self.configWordAddr = 0x8007
- #self.osccalAddr = 0x2000
- self.userIDLocationAddr = 0x8000
- self.deviceIDAddr = 0x8006
- self.programMemoryByteAddressRange = [(0,2*self.flashPageSize)]
- self.configWordByteAddressRange = [(2*self.configWordAddr,2*self.configWordAddr+self.fuseBytes-1)]
- self.userIDLocationByteAddressRange = [(2*self.userIDLocationAddr, 2*(self.userIDLocationAddr+self.userIDLocationSize)-1)]
-
- #self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
-
-fuseDesc = (
- BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
- BitDescription(1, "FOSC[1]"),
- BitDescription(2, "FOSC[2]"),
- BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
- BitDescription(4, "WDTE[1]"),
- BitDescription(5, "nPWRTE"),
- BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
- BitDescription(7, "nCP 1=program memory code protection is disabled"),
- BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
- BitDescription(9, "BOREN[0], 00=BOR disabled"),
- BitDescription(10, "BOREN[1]"),
- BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
- BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
- BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
- BitDescription(14, "NA"),
- BitDescription(15, "NA"),
-
- BitDescription(16, "WRT[0], 11=Write protection off"),
- BitDescription(17, "WRT[1]"),
- BitDescription(18, "Unused"),
- BitDescription(19, "Unused"),
- BitDescription(20, "Unused"),
- BitDescription(21, "Unused"),
- BitDescription(22, "Unused"),
- BitDescription(23, "Unused"),
- BitDescription(24, "PLLEN, 0=4xPLL disabled"),
- BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
- BitDescription(26, "BORV"),
- BitDescription(27, "Unused"),
- BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
- BitDescription(29, "LVP 1=Low-voltage programming enabled"),
-)
-
-ChipDescription(
- Chip_Pic12F1822dip8,
- bitfile = "microchip01dip8",
- chipID = "pic12f1822dip8",
- runtimeID = (0xDE02, 0x01),
- chipVendors = "Microchip",
- description = "PIC12F1822, PIC12LF1822",
- packages = (("DIP8", ""),),
- fuseDesc = fuseDesc,
- maintainer = "Pavel Stemberk <stemberk@gmail.com>",
-)
diff --git a/libtoprammer/chips/microchip02/pic16f1824dip14.py b/libtoprammer/chips/microchip02/pic16f1824dip14.py
deleted file mode 100644
index 2acf422..0000000
--- a/libtoprammer/chips/microchip02/pic16f1824dip14.py
+++ /dev/null
@@ -1,103 +0,0 @@
-"""
-# TOP2049 Open Source programming suite
-#
-# Microchip PIC16F1824 DIP14
-#
-# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""
-
-from microchip02_common import *
-
-class Chip_Pic16F1824dip14(Chip_Microchip02_common):
- voltageVDD = 3
- voltageVPP = 8.5
- #CONFIGURATION WORD FOR PIC10F200/202/204/206
- #X X X X X X X MCLRE /CP WDT X X
- logicalFlashProgramMemorySize = 0x8000
- logicalFlashConfigurationMemorySize = 0x8000
- rowSize = 32
- nLatches = 32
- userIDLocationSize = 4
-
- def __init__(self):
- Chip_Microchip02_common.__init__(self,
- chipPackage="DIP14",
- chipPinVCC=1,
- chipPinsVPP=4,
- chipPinGND=14,
- signature="\x43\x27",
- flashPageSize=0x1000,
- flashPages=1,
- eepromPageSize=0,
- eepromPages=0,
- fuseBytes=4
- )
- self.configWordAddr = 0x8007
- #self.osccalAddr = 0x2000
- self.userIDLocationAddr = 0x8000
- self.deviceIDAddr = 0x8006
- self.programMemoryByteAddressRange = [(0,2*self.flashPageSize)]
- self.configWordByteAddressRange = [(2*self.configWordAddr,2*self.configWordAddr+self.fuseBytes-1)]
- self.userIDLocationByteAddressRange = [(2*self.userIDLocationAddr, 2*(self.userIDLocationAddr+self.userIDLocationSize)-1)]
-
- #self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
-
-fuseDesc = (
- BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
- BitDescription(1, "FOSC[1]"),
- BitDescription(2, "FOSC[2]"),
- BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
- BitDescription(4, "WDTE[1]"),
- BitDescription(5, "nPWRTE"),
- BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
- BitDescription(7, "nCP 1=program memory code protection is disabled"),
- BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
- BitDescription(9, "BOREN[0], 00=BOR disabled"),
- BitDescription(10, "BOREN[1]"),
- BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
- BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
- BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
- BitDescription(14, "NA"),
- BitDescription(15, "NA"),
-
- BitDescription(16, "WRT[0], 11=Write protection off"),
- BitDescription(17, "WRT[1]"),
- BitDescription(18, "Unused"),
- BitDescription(19, "Unused"),
- BitDescription(20, "Unused"),
- BitDescription(21, "Unused"),
- BitDescription(22, "Unused"),
- BitDescription(23, "Unused"),
- BitDescription(24, "PLLEN, 0=4xPLL disabled"),
- BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
- BitDescription(26, "BORV"),
- BitDescription(27, "Unused"),
- BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
- BitDescription(29, "LVP 1=Low-voltage programming enabled"),
-)
-
-ChipDescription(
- Chip_Pic16F1824dip14,
- bitfile = "microchip01dip14dip20",
- chipID = "pic16f1824dip14",
- runtimeID = (0xDE03, 0x01),
- chipVendors = "Microchip",
- description = "PIC16F1824, PIC16LF1824",
- packages = (("DIP14", ""),),
- fuseDesc = fuseDesc,
- maintainer = "Pavel Stemberk <stemberk@gmail.com>",
-)
diff --git a/libtoprammer/chips/microchip16/__init__.py b/libtoprammer/chips/microchip16/__init__.py
new file mode 100644
index 0000000..ac58a62
--- /dev/null
+++ b/libtoprammer/chips/microchip16/__init__.py
@@ -0,0 +1 @@
+from pic24f04ka200dip14 import * \ No newline at end of file
diff --git a/libtoprammer/chips/microchip16/microchip16_common.py b/libtoprammer/chips/microchip16/microchip16_common.py
new file mode 100644
index 0000000..501b22c
--- /dev/null
+++ b/libtoprammer/chips/microchip16/microchip16_common.py
@@ -0,0 +1,451 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip8 common - basic file for 16bit PIC MCU
+#
+# Copyright (c) 2012 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chip import *
+
+class Chip_Microchip16_common(Chip):
+
+ STAT_BUSY = 0x01
+ STAT_SDIO = 0x02
+
+ PROGCMD_SENDSIXINSTR = 0
+ PROGCMD_SENDREGOUTINSTR = 1
+ PROGCMD_ENTERPM = 2
+
+ codeExitResetVector = (0x000000, 0x040200, 0x000000)
+ codeExitResetVectorSimple = (0x040200, 0x000000)
+ codeInitializeW7toVISI = (0x207847, 0x000000)
+ codeResetDeviceInternalPC = (0x040200, 0x000000)
+
+
+ # EEPROM access: default on, if does not exist override it
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ # default delays - can be overridden
+ delayTdis = 0.0001
+ delayTprog = 0.001
+ delayTdly = 0.000005
+ delayTera = 0.01
+ delayP4 = 0.000000040 # Delay between 4-Bit Command Operand and Command Operand
+ delayP4A = 0.000000040 # Delay between 4-Bit Command Operand and the Next 4-bit command
+ delayP5 = 0.000000020 # Delay between Last PGCx fall of Command Byte and First PGC rise by Programming Executive
+ delayP6 = 0.000000100 # Vdd rise setup time to nMCLR rise
+ delayP7 = 0.025 # Input data Hold Time from nMCLR rise, Vpp fall
+ delayP11 = 0.0025 # chip Erase Time
+ delayP13 = 0.00125 # row programming time
+ delayP16 = 0 # delay between last PGCx fall and nMCLR fall
+ delayP17 = 0.000000100 # nMCLR fall to Vdd fall
+ delayP18 = 0.001 # delay between first nMCLR fall and first PGCx rise
+ delayP19 = 0.001 # delay between last PGC fall for key sequence on PGDx and second nMCLR rise
+
+ deviceIDAddr = 0xFF0000
+ deviceIDLength = 2
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip.__init__(self,
+ chipPackage=chipPackage,
+ chipPinVCC=chipPinVCC,
+ chipPinsVPP=chipPinsVPP,
+ chipPinGND=chipPinGND)
+ self.signature = signature
+ self.flashPageSize = flashPageSize # Flash page size, in words
+ self.flashPages = flashPages # Nr of flash pages
+ self.eepromPageSize = eepromPageSize # EEPROM page size, in bytes
+ self.eepromPages = eepromPages # Nr of EEPROM pages
+ self.fuseBytes = fuseBytes # Nr of fuse bytes
+ self.isInPmMode = False
+ self.BufferedBytes = 0
+ self.Image = ""
+
+ def enterPM(self, lowVoltageIcspEntry=True):
+ if self.isInPmMode:
+ return
+ "Enter HV programming mode. Vdd first entry mode"
+ self.applyVCC(False)
+ self.applyVPP(False)
+ self.applyGND(False)
+ self.setPins(0, 0)
+ self.top.cmdSetVCCVoltage(self.voltageVDD)
+ self.top.cmdSetVPPVoltage((self.voltageVPP, self.voltageVDD)[lowVoltageIcspEntry])
+ self.applyGND(True)
+ self.applyVCC(True)
+ self.top.hostDelay(self.delayP6)
+ self.applyVPP(True)
+ if lowVoltageIcspEntry:
+ self.top.hostDelay(self.delayP6)
+ self.applyVPP(False)
+ self.top.hostDelay(self.delayP18)
+ # self.sendCommand(self.PROGCMD_ENTERPM)
+ if lowVoltageIcspEntry:
+ self.top.hostDelay(self.delayP19)
+ self.applyVPP(True)
+ self.top.hostDelay(self.delayP7)
+ self.isInPmMode = True
+
+ def checkSignature(self):
+ signature = self.readSignature()
+ if signature != self.signature:
+ msg = "Unexpected device signature. " + \
+ "Want %02X%02X%02X, but got %02X%02X%02X" % \
+ (byte2int(self.signature[0]), byte2int(self.signature[1]),
+ byte2int(self.signature[2]),
+ byte2int(signature[0]), byte2int(signature[1]),
+ byte2int(signature[2]))
+ if self.top.getForceLevel() >= 1:
+ self.printWarning(msg)
+ else:
+ self.throwError(msg)
+
+ def old_readSignature(self):
+ self.progressMeterInit("Reading signature", 0)
+ self.enterPM()
+ self.Image = ""
+ self.BufferedBytes = 0
+ self.executeCode(self.codeExitResetVector)
+ self.executeCode(self.getCodeInitializeTBLPAG(self.deviceIDAddr, 6))
+ self.executeCode(self.codeInitializeW7toVISI)
+ self.read2words()
+ self.progressMeterFinish()
+ return self.top.cmdReadBufferReg(4)
+
+ def erase(self):
+ self.__erase()
+
+ def __erase(self, keepEEPROM=False):
+ def er(NVMCON):
+ self.executeCode(self.codeExitResetVector)
+ # Set the NVMCON to erase entire PGM
+ self.executeCode(self.getCodeSetNVMCON(NVMCON))
+ # Set the TBLPAG and perform dummy table write to select the erased memory
+ self.executeCode(self.getCodeInitializeTBLPAG(0, 0))
+ self.executeCode((0xBB0800, 0x000000, 0x000000))
+ # Initiate the erase cycle
+ self.executeCode((0xA8E761, 0x000000, 0x000000))
+ while self.isWRset():
+ pass
+ self.progressMeterInit("Erasing chip", 0)
+ self.enterPM()
+ er(0x4064)
+ if(not keepEEPROM):
+ er(0x4050)
+ self.progressMeterFinish()
+
+ def readProgmem(self):
+ nrWords = self.flashPages * self.flashPageSize
+ self.enterPM()
+ self.progressMeterInit("Reading flash", nrWords / 2)
+ self.BufferedBytes = 0
+ self.Image = ""
+ self.executeCode(self.codeExitResetVector)
+ self.executeCode(self.getCodeInitializeTBLPAG(0, 6))
+ self.executeCode((0x207847, 0x0))
+ for wordAddrHalf in range(0, nrWords / 2):
+ self.executeCode((0xBA0B96, 0x0, 0x0))
+ self.readREGOUTword()
+ self.executeCode((0x0, 0xBA8BB6, 0x0, 0x0, 0xBAD3D6, 0x0, 0x0))
+ self.readREGOUTword()
+ self.executeCode((0x0, 0xBA0BB6, 0x0, 0x0))
+ self.readREGOUTword()
+ self.executeCode(self.codeExitResetVector)
+ self.progressMeter(wordAddrHalf)
+ self.progressMeterFinish()
+ self.flushBufferToImage()
+ return self.Image
+
+ def _t_readEEPROM(self):
+ nrWords = self.eepromPages * self.eepromPageSize
+ self.enterPM()
+ self.progressMeterInit("Reading EEPROM", nrWords)
+ self.BufferedBytes = 0
+ self.Image = ""
+ self.executeCode(self.codeExitResetVector)
+ self.executeCode(self.getCodeInitializeTBLPAG(0x7F0000 | 0, 6))
+ self.executeCode((0x207847, 0x0))
+ for wordAddr in range(0, nrWords):
+ self.executeCode((0xBA0B96, 0x0, 0x0))
+ self.readREGOUTword()
+ self.executeCode(self.codeExitResetVector)
+ self.progressMeter(wordAddr)
+ self.progressMeterFinish()
+ self.flushBufferToImage()
+ return self.Image
+
+ def readEEPROM(self):
+ nrWords = self.eepromPages * self.eepromPageSize
+ return self.readSequentialBlock(0x7F0000 , nrWords, "Reading EEPROM")
+
+ def readFuse(self):
+ return self.readSequentialBlock(self.configWordAddr, self.fuseBytes / 2, "Reading Config Words")
+
+ def readSignature(self):
+ return self.readSequentialBlock(self.deviceIDAddr, self.deviceIDLength, "Reading Signature")
+
+ def readSequentialBlock(self, startAddr, nWords, infoText):
+ self.enterPM()
+ self.progressMeterInit(infoText, nWords)
+ self.BufferedBytes = 0
+ self.Image = ""
+ self.executeCode(self.codeExitResetVector)
+ self.executeCode(self.getCodeInitializeTBLPAG(startAddr, 6))
+ self.executeCode(self.codeInitializeW7toVISI)
+ for wordAddr in range(0, nWords):
+ self.executeCode((0xBA0BB6, 0x0, 0x0))
+ self.readREGOUTword()
+ self.executeCode(self.codeExitResetVector)
+ self.progressMeter(wordAddr)
+ self.progressMeterFinish()
+ self.flushBufferToImage()
+ return self.Image
+
+ def writeProgmem(self, image):
+ nrWords = self.flashPages * self.flashPageSize
+ if len(image) > nrWords * 2 or len(image) % 2 != 0:
+ self.throwError("Invalid flash image size %d (expected <=%d and word aligned)" % \
+ (len(image), nrWords * 2))
+ self.progressMeterInit("Writing flash", len(image) // 12)
+ self.enterPM()
+ self.executeCode(self.codeExitResetVector)
+ self.executeCode(self.getCodeSetNVMCON(0x4004))
+ for packAddr in range(0, len(image) // 12):
+ self.progressMeter(packAddr)
+ writePackedInstructionWords(packAddr * 4, image[12 * packAddr:][:12])
+ if(0 == (packAddr % 8)):
+ writeSeq()
+ writeSeq()
+ self.progressMeterFinish()
+
+ # TODO: packed format is probably wrong
+ def writePackedInstructionWords(addr, packed12bytes):
+ self.executeCode(self.getCodeInitializeTBLPAG(addr, 7))
+ for wIdx in range(0, 6):
+ WD = (byte2int(packed12bytes[wIdx * 2 + 1]) << 8) | byte2int(packed12bytes[wIdx * 2 + 0])
+ self.executeCode((0x200000 | (WD << 4) | wIdx))
+ self.executeCode((0xEB0300, 0x0))
+ # Set the Read Pointer and load the (next set of) write latches
+ for i in range(0, 2):
+ self.executeCode((0xBB0BB6, 0x0, 0x0, 0xBBDBB6, 0x0, 0x0, 0xBBEBB6, 0x0, 0x0, 0xBB1BB6, 0x0, 0x0))
+ def writeSeq():
+ # Initiate the write cycle
+ self.executeCode((0xA8E761, 0x0, 0x0))
+ while self.isWRset():
+ pass
+ self.executeCode((0x040200, 0x0))
+
+ def writeEEPROM(self, image):
+ nrWords = self.eepromPages * self.eepromPageSize
+ if len(image) > nrWords / 2:
+ self.throwError("Invalid flash image size {:d} (expected <={:d})".format(len(image), 2 * nrWords))
+ self.enterPM()
+ self.progressMeterInit("Writing eeprom", len(image) / 2)
+ self.executeCode(self.codeExitResetVector)
+ self.executeCode(self.getCodeSetNVMCON(0x4004))
+ for addr in range(0, len(image) / 2):
+ self.progressMeter(addr)
+ WD = (byte2int(image[wIdx * 2 + 1]) << 8) | byte2int(image[wIdx * 2 + 0])
+ if WD != 0xFFFF:
+ self.executeCode(self.getCodeInitializeTBLPAG(0x7F0000 | addr, 7))
+ # Load W0 with data word program and load the wire latch
+ self.executeCode((0x200000 | (WD << 4), 0xBB1B80, 0x0, 0x0))
+ # Initiate the write cycle
+ self.executeCode((0xA8E761, 0x0, 0x0))
+ while self.isWRset():
+ pass
+ self.executeCode(self.codeExitResetVectorSimple)
+
+
+ self.progressMeterFinish()
+ self.exitPM()
+
+ def writeFuse(self, image):
+ if len(image) != 2 * self.getConfigWordSize():
+ self.throwError("Invalid Fuses image size %d (expected %d)" % \
+ (len(image), 2 * self.getConfigWordSize()))
+ self.progressMeterInit("Writing fuses", 0)
+ # print "image1:%x,,%x,,%x" % (byte2int(image[0]),byte2int(image[1]),byte2int(image[1])<<8)
+ CW = []
+ for tBytes in zip(image[::2], image[1::2]):
+ CW.append((byte2int(tBytes[1]) << 8) | byte2int(tBytes[0]))
+ self.writeConfigWord(CW)
+ self.progressMeterFinish()
+
+ def writeConfigWord(self, listConfigWord16):
+ # Externally timed writes are not supported
+ # for Configuration and Calibration bits. Any
+ # externally timed write to the Configuration
+ # or Calibration Word will have no effect on
+ # the targeted word.
+ self.enterPM()
+ self.executeCode(self.codeExitResetVector)
+ # init WritePointer (W7) for the TBLWT instruction, Set the NVMCON reg. to prog. Config. regs.
+ self.executeCode((0x200007, 0x24004A, 0x883B0A))
+ # init TBLPAG
+ self.executeCode((0x200F86, 0x880190))
+ for configWord16 in listConfigWord16:
+ print ("write CW {:x}".format(configWord16))
+ # Load the Config reg data to W6
+ self.executeCode((0x200006 | (configWord16 << 4)))
+ # Write the Config. reg. data to the write latch and increment Write Pointer
+ self.executeCode((0x0, 0xBB1B86, 0x0, 0x0))
+ # Initiate the write cycle
+ self.executeCode((0xA8E761, 0x0, 0x0))
+ while self.isWRset():
+ pass
+ self.executeCode(self.codeExitResetVectorSimple)
+ self.top.flushCommands()
+ self.progressMeterFinish()
+
+ def exitPM(self):
+ "Exit programming mode. Vdd last exit mode"
+ self.top.flushCommands()
+ self.setPins(0, 0)
+ self.top.hostDelay(self.delayP16)
+ self.applyVPP(False)
+ self.top.hostDelay(self.delayP17)
+ self.applyVCC(False)
+ self.applyGND(False)
+ self.isInPmMode = False
+
+ def setSDI(self, sdi):
+ '''
+ 16 -set 24 bit sdi value
+ '''
+ for addr in (0x13, 0x14, 0x15):
+ self.top.cmdFPGAWrite(addr, sdi & 0xFF)
+ sdi = sdi >> 8
+
+
+ def sendCommand(self, command):
+ '''
+ 16 - send command
+ CMD_SENDSIXINSTR 0
+ CMD_SENDREGOUTINSTR 1
+ CMD_ENTERPM 2
+ '''
+ self.top.cmdFPGAWrite(0x10, command)
+
+ def readREGOUTword(self):
+ def incBbAndCheckFillImage():
+ self.BufferedBytes += 1
+ if self.BufferedBytes == self.top.getBufferRegSize():
+ self.Image += self.top.cmdReadBufferReg(self.BufferedBytes)
+ self.BufferedBytes = 0
+ # self.busyWait()
+ self.top.hostDelay(0.000001)
+ self.sendCommand(self.PROGCMD_SENDREGOUTINSTR)
+ # self.busyWait()
+ self.top.hostDelay(0.000001)
+ self.readSDOBufferHigh()
+ incBbAndCheckFillImage()
+ self.readSDOBufferLow()
+ incBbAndCheckFillImage()
+
+
+ def flushBufferToImage(self):
+ if self.BufferedBytes > 0:
+ self.Image += self.top.cmdReadBufferReg(self.BufferedBytes)
+ self.BufferedBytes = 0
+
+ def sendSIX(self, instr):
+ self.busyWait()
+ self.setSDI(instr)
+ self.sendCommand(self.PROGCMD_SENDSIXINSTR)
+
+ def read2words(self):
+ self.executeCode((0xBA0B96, 0x000000, 0x000000))
+ self.readREGOUTword()
+ self.executeCode((0x0000000, 0xBA8BB6, 0x000000, 0x000000, 0xBAD3D6, 0x000000, 0x000000))
+ self.readREGOUTword()
+ self.executeCode((0x000000, 0xBA0BB6, 0x000000, 0x000000))
+ self.readREGOUTword()
+ self.executeCode((0x000000,))
+
+
+ def executeCode(self, code):
+ for instr in code:
+ self.sendSIX(instr)
+
+ def setPins(self, ICSPCLK=0, SDIOVALUE=0, SDIODRIVEN=1):
+ '''
+ 16 - setPins
+ '''
+ data = 0
+ if ICSPCLK:
+ data |= 1
+ if SDIODRIVEN:
+ data |= 2
+ if SDIOVALUE:
+ data |= 4
+ self.top.cmdFPGAWrite(0x19, data)
+
+ def getStatusFlags(self):
+ '''
+ [0] - BUSY
+ [1] - SDO
+ '''
+ self.flushBufferToImage()
+ self.top.cmdFPGARead(0x12)
+ stat = self.top.cmdReadBufferReg()
+ return byte2int(stat[0])
+
+ def readSDOBufferHigh(self):
+ self.top.cmdFPGARead(0x10)
+
+ def readSDOBufferLow(self):
+ self.top.cmdFPGARead(0x13)
+
+ def rawSDIOState(self):
+ return bool(self.getStatusFlags() & self.STAT_SDIO)
+
+ def isBusy(self):
+ return bool(self.getStatusFlags() & self.STAT_BUSY)
+
+ def busyWait(self):
+ for i in range(0, 100):
+ if not self.isBusy():
+ return
+ self.top.hostDelay(0.000001)
+ self.throwError("Timeout in busywait.")
+
+ def getCodeInitializeTBLPAG(self, addr, wIdx=0):
+ mlw = (addr & 0xFFFF) << 4
+ mmb = (addr >> 12) & 0x000FF0
+ return (0x200000 | mmb, 0x880190, 0x200000 | mlw | (wIdx & 0x0F))
+
+ def getCodeSetNVMCON(self, NVMCON):
+ return (0x20000A | ((NVMCON & 0xFFFF) << 4), 0x883B0A)
+
+ def isWRset(self):
+ self.executeCode(self.codeExitResetVectorSimple)
+ self.executeCode((0x803B02, 0x883C22, 0x000000))
+ self.BufferedBytes = 0
+ self.Image = ""
+ self.readREGOUTword()
+ self.flushBufferToImage()
+ # self.executeCode((0x000000,))
+ return int(self.Image[1]) & 0x80
diff --git a/libtoprammer/chips/microchip16/pic24f04ka200dip14.py b/libtoprammer/chips/microchip16/pic24f04ka200dip14.py
new file mode 100644
index 0000000..d9aee5d
--- /dev/null
+++ b/libtoprammer/chips/microchip16/pic24f04ka200dip14.py
@@ -0,0 +1,84 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC24f04ka200 DIP18
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip16_common import *
+
+class Chip_Pic24f04ka200dip14(Chip_Microchip16_common):
+
+ voltageVDD = 3
+ voltageVPP = 7.75
+
+ logicalFlashProgramMemorySize = 0x800000
+ logicalFlashConfigurationMemorySize = 0x800000
+
+ def __init__(self):
+ Chip_Microchip16_common.__init__(self,
+ chipPackage="DIP14",
+ chipPinVCC=14,
+ chipPinsVPP=1,
+ chipPinGND=13,
+ signature="\x02\x84",
+ flashPageSize=0x200,
+ flashPages=1,
+ eepromPageSize=64,
+ eepromPages=1,
+ fuseBytes=16 * 2
+ )
+ self.configWordAddr = 0xF80000
+ self.programMemoryByteAddressRange = [(0, 2 * self.flashPageSize)]
+ self.configWordByteAddressRange = [(2 * self.configWordAddr, 2 * self.configWordAddr + 1)]
+
+ # self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
+ def sendWriteFlashInstr(self):
+ '''
+ '''
+ self.sendInstr(self.CMD_BEGIN_PROGRAMMING_ONLY_CYCLE)
+ self.top.hostDelay(self.delayTinternalProgDM)
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 00=LP osc, 01=XT osc"),
+ BitDescription(1, "FOSC[1], 10=HS osc, 11=RC osc"),
+ BitDescription(2, "WDTEN, 1=WDT enabled"),
+ BitDescription(3, "nPWRT"),
+ BitDescription(4, "nCP"),
+ BitDescription(5, "nCP"),
+ BitDescription(6, "nCP"),
+ BitDescription(7, "nCP"),
+ BitDescription(8, "nCP"),
+ BitDescription(9, "nCP"),
+ BitDescription(10, "nCP"),
+ BitDescription(11, "nCP"),
+ BitDescription(12, "nCP"),
+ BitDescription(13, "nCP"),
+)
+
+ChipDescription(
+ Chip_Pic24f04ka200dip14,
+ bitfile="microchip16dip14dip20",
+ chipID="pic24f04ka200dip14",
+ runtimeID=(0xDF01, 0x01),
+ chipVendors="Microchip",
+ description="PIC24F04KA200 - experimental mode !!!",
+ packages=(("DIP14", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/__init__.py b/libtoprammer/chips/microchip8/__init__.py
new file mode 100644
index 0000000..dabb5cb
--- /dev/null
+++ b/libtoprammer/chips/microchip8/__init__.py
@@ -0,0 +1,32 @@
+from pic10f200dip8 import *
+from pic10f202dip8 import *
+from pic10f320dip8 import *
+from pic10f322dip8 import *
+from pic12f1822dip8 import *
+from pic12f508dip8 import *
+from pic12f629dip8 import *
+from pic16f630dip14 import *
+from pic16f1824dip14 import *
+from pic16f1825dip14 import *
+from pic16f1826dip18 import *
+from pic16f1827dip18 import *
+from pic16f1828dip20 import *
+from pic16f1829dip20 import *
+from pic16lf1902dip28 import *
+from pic16lf1903dip28 import *
+from pic16lf1904dip40 import *
+from pic16lf1906dip28 import *
+from pic16lf1907dip40 import *
+from pic16f1933dip28 import *
+from pic16f1934dip40 import *
+from pic16f1936dip28 import *
+from pic16f1937dip40 import *
+from pic16f1938dip28 import *
+from pic16f1939dip40 import *
+from pic16f59dip40 import *
+from pic16f84adip18 import *
+from pic18f1220dip18 import *
+from pic18f2320dip28 import *
+from pic18f2321dip28 import *
+#from pic18f67j60sip6 import *
+#do not edit the text below this line
diff --git a/libtoprammer/chips/microchip8/makeSip6.py b/libtoprammer/chips/microchip8/makeSip6.py
new file mode 100644
index 0000000..e7f549f
--- /dev/null
+++ b/libtoprammer/chips/microchip8/makeSip6.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+
+"""
+# TOP2049 Open Source programming suite
+#
+# Commandline utility
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+import re
+import sys
+import os
+
+def clear():
+ inputFileName = '__init__.py'
+ tmpFileName = 'tmp'
+ fin = open(inputFileName)
+ ftmp = open(tmpFileName, 'w')
+ isToBeRemoved = False
+ for line in fin:
+ if isToBeRemoved:
+ matchObj = re.match('.*(pic\w+).*', line)
+ if matchObj:
+ print('removing file {}'.format(matchObj.group(1)))
+ os.remove('{}.py'.format(matchObj.group(1)))
+ else:
+ ftmp.write(line)
+ matchObj = re.match('#do not edit the text below this line.*', line)
+ if matchObj:
+ isToBeRemoved = True
+ fin.close()
+ ftmp.close()
+ os.rename(tmpFileName, inputFileName)
+
+def substitute(input, oldSocket, newSocket):
+ input = re.sub('(^\s*packages).*', lambda m:'{} = (("DIP10", ""), ),'.format(m.group(1)), input)
+ input = re.sub('(^\s*chipPackage).*', lambda m:'{} = "DIP10",'.format(m.group(1)), input)
+ input = re.sub('(^\s*chipPinVCC).*', lambda m:'{} = 9,'.format(m.group(1)), input)
+ input = re.sub('(^\s*chipPinsVPP).*', lambda m:'{} = 10,'.format(m.group(1)), input)
+ input = re.sub('(^\s*chipPinGND).*', lambda m:'{} = 8,'.format(m.group(1)), input)
+ input = re.sub('(^\s*runtimeID).*', lambda m:'{} = (0xDE05, 0x01),'.format(m.group(1)), input)
+ input = re.sub('(^\s*description).+"(.*)".*', lambda m:'{} = "{} - ICD",'.format(m.group(1), m.group(2)), input)
+ input = re.sub('(^\s*bitfile).*', lambda m:'{} = "microchip01sip6",'.format(m.group(1)), input)
+ input = re.sub("{}".format(oldSocket), "{}".format(newSocket), input)
+ return input
+
+
+def makeSip():
+ inputFileName = '__init__.py'
+ fin = open(inputFileName)
+ # from pic16f1824dip14 import *
+ dMCU = {}
+ for line in fin:
+ matchObj = re.match('#do not edit the text below this line.*', line)
+ if matchObj:
+ break
+ matchObj = re.match('.*(pic[0-9]+l?f\w+)(dip[0-9a]+).*', line)
+ print('matched {} - {}'.format(matchObj.group(1), matchObj.group(2)))
+ dMCU.setdefault(matchObj.group(1), matchObj.group(2))
+ fin.close()
+ finit = open("init", "a")
+ for item in dMCU.items():
+ fin = open("{}{}.py".format(item[0], item[1]))
+ fout = open("{}sip6.py".format(item[0]), 'w')
+ for line in fin:
+ fout.write(substitute(line, "{}".format(item[1]), "sip6"))
+ fout.close()
+ fin.close()
+ finit.write("from {}sip6 import *\n".format(item[0]))
+ finit.close()
+ print ('{} - {}'.format(item[0], item[1]))
+
+def main(argv):
+ clear()
+ # makeSip()
+
+if __name__ == "__main__":
+ xit(main(sys.argv))
diff --git a/libtoprammer/chips/microchip8/microchip8_18_common.py b/libtoprammer/chips/microchip8/microchip8_18_common.py
new file mode 100644
index 0000000..3e743c9
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_18_common.py
@@ -0,0 +1,394 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip8_18_common - basic file for 8bit PIC18 MCU
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chip import *
+
+class Chip_Microchip8_18_common(Chip):
+
+ STAT_BUSY = 0x01
+ STAT_SDIO = 0x02
+
+
+ PCMDBIT_4BITINSTR = 0
+ PCMDBIT_SENDDATA = 1
+ PCMDBIT_READDATA = 2
+ PCMDBIT_KEEPCLKHIGH = 7
+
+ CMD_CORE_INSTRUCTION = 0x0
+ CMD_SHIFT_OUT_TABLAT = 0x2
+ CMD_TR = 0x8
+ CMD_TRI = 0x9
+ CMD_TRD = 0xA
+ CMD_ITR = 0xB
+ CMD_TW = 0xC
+ CMD_TWII = 0xD
+ CMD_TWDD = 0xE
+ CMD_TW_START_PROG = 0xF
+
+
+ # EEPROM access: default on, if does not exist override it
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ # default delays - can be overridden
+ delayP2A = 400e-9 # Serial clock low time
+ delayP5 = 2.2e-6 # Delay between 4-bit command and command operand
+ delayP5A = 2.2e-6 # Delay between 4-bit command operand and next 4-bit command
+ delayP6 = 2.2e-6 # Delay between last SCK fall of command byte to first SCK rise of read data word
+ delayP9 = 1e-3 # SCK High time (minimum programming time)
+ delayP10 = 30e-6 # SCK Low time after programming (high-voltage discharge time)
+ delayP11 = 0.01 # Delay to allow self-timed data write or bulk erase to occur
+ delayP12 = 0.000002 # Input data hold time from nMCLR/Vpp rise
+ delayP13 = 0.0000001 # Vdd rise setup time to nMCLR/Vpp rise
+ delayP14 = 0.00000001 # Data out Valid from SCK rise
+ delayP15 = 0.000002 # PGM rise setup time to nMCLR/Vpp rise
+
+ userIDLocationSize = 8
+ userIDLocationAddr = 0x200000
+
+ deviceIDAddr = 0x3FFFFE
+ configWordAddr = 0x300000
+ deviceIDLength = 2
+ voltageVDD = 5
+ voltageVPP = 12
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip.__init__(self,
+ chipPackage=chipPackage,
+ chipPinVCC=chipPinVCC,
+ chipPinsVPP=chipPinsVPP,
+ chipPinGND=chipPinGND)
+ self.signature = signature
+ self.flashPageSize = flashPageSize # Flash page size, in words
+ self.flashPages = flashPages # Nr of flash pages
+ self.eepromPageSize = eepromPageSize # EEPROM page size, in bytes
+ self.eepromPages = eepromPages # Nr of EEPROM pages
+ self.fuseBytes = fuseBytes # Nr of fuse bytes
+ self.isInPmMode = False
+ self.BufferedBytes = 0
+ self.Image = ""
+ self.programMemoryByteAddressRange = [(0, self.flashPageSize)]
+ self.configWordByteAddressRange = [(self.configWordAddr, self.configWordAddr + self.fuseBytes)]
+ self.userIDLocationByteAddressRange = [(self.userIDLocationAddr, self.userIDLocationAddr + self.userIDLocationSize)]
+
+ def enterPM(self, force=False):
+ if self.isInPmMode and not force:
+ return
+ "Enter HV programming mode. Vdd first entry mode"
+ self.applyVCC(False)
+ self.applyVPP(False)
+ self.applyGND(False)
+ self.setPins(0, 0)
+ self.top.cmdSetVCCVoltage(self.voltageVDD)
+ self.top.cmdSetVPPVoltage(self.voltageVPP)
+ self.applyGND(True)
+ self.applyVCC(True)
+ self.top.hostDelay(10 * self.delayP13)
+ self.applyVPP(True)
+ self.top.hostDelay(102 * self.delayP12)
+ self.setTopProgrammerDelays()
+ self.isInPmMode = True
+
+ def readUserIdLocation(self):
+ return self.readSequentialBlock(self.userIDLocationAddr, self.userIDLocationSize, "Reading User ID Locations")
+
+ def readFuse(self):
+ return self.readSequentialBlock(self.configWordAddr, self.fuseBytes, "Reading Config Words")
+
+ def readSignature(self):
+ return self.readSequentialBlock(self.deviceIDAddr, self.deviceIDLength, "Reading Signature")
+
+ def readProgmem(self):
+ nrBytes = self.flashPages * self.flashPageSize
+ return self.readSequentialBlock(0, nrBytes, "Reading flash")
+
+ def readSequentialBlock(self, startAddr, nBytes, infoText):
+ self.enterPM()
+ self.progressMeterInit(infoText, nBytes)
+ self.BufferedBytes = 0
+ self.Image = ""
+ self.executeCode(self.getCodeAddrToTBLPTR(startAddr))
+ for byteAddr in range(0, nBytes):
+ self.send4bitReadInstruction(self.CMD_TRI)
+ self.progressMeter(byteAddr)
+ self.progressMeterFinish()
+ self.flushBufferToImage()
+ return self.Image
+
+ def writeSequentialBlock(self, startAddr, image, size, infoText):
+ if len(image) > size:
+ self.throwError("Invalid flash image size %d (expected <=%d)" % \
+ (len(image), self.userIDLocationSize))
+ self.enterPM()
+ self.executeCode((0x8EA6, 0x9CA6))
+ self.progressMeterInit(infoText, len(image) / 8)
+ for blockAddr in range(0, len(image), self.writeBufferSize):
+ #print("addr:{:x}".format(startAddr+blockAddr))
+ self.executeCode(self.getCodeAddrToTBLPTR(startAddr+blockAddr))
+ #for code in self.getCodeAddrToTBLPTR(startAddr+blockAddr):
+ # print("({:x}, ".format(code))
+ print(")\n")
+ self.writeNbytes(image[blockAddr:], self.writeBufferSize)
+ #self.executeCode((0x0, 0x0))
+ self.progressMeter(blockAddr)
+ self.progressMeterFinish()
+
+ def readEEPROM(self):
+ nrBytes = self.eepromPages * self.eepromPageSize
+ self.enterPM()
+ self.progressMeterInit("Reading EEPROM", nrBytes)
+ self.BufferedBytes = 0
+ self.Image = ""
+ self.executeCode((0x9EA6, 0x9CA6))
+ for byteAddr in range(0, nrBytes):
+ # print("set addr to {:x}\n".format(byteAddr))
+ self.setEEPROMAddr(byteAddr)
+ self.executeCode((0x80A6, 0x50A8, 0x6EF5))
+ self.send4bitReadInstruction(self.CMD_SHIFT_OUT_TABLAT)
+ self.progressMeter(byteAddr)
+ self.progressMeterFinish()
+ self.flushBufferToImage()
+ return self.Image
+
+ def writeEEPROM(self, image):
+ nrBytes = self.eepromPages * self.eepromPageSize
+ if len(image) > nrBytes:
+ self.throwError("Invalid flash image size {:d} (expected <={:d})".format(len(image), nrBytes))
+ self.enterPM()
+ self.progressMeterInit("Writing eeprom", len(image))
+ self.executeCode((0x9EA6, 0x9CA6))
+ for addr in range(0, len(image)):
+ self.progressMeter(addr)
+ #print("writing {:x} value to addr {:x}\n".format(byte2int(image[addr]), addr))
+ self.setEEPROMAddr(addr)
+ self.executeCode((0x0E00 | (byte2int(image[addr]) & 0xFF), 0x6EA8))
+ self.executeCode((0x84A6, 0x0E55, 0x6EA7, 0x0EAA, 0x6EA7))
+ self.executeCode((0x82A6, 0x0, 0x0))
+ self.top.hostDelay(self.delayP11 + self.delayP10)
+ self.executeCode((0x94A6,))
+ self.progressMeterFinish()
+
+ def writeNbytes(self, image, N):
+ if N % 2:
+ self.throwError("N should be even, not %d" % N)
+ isEmpty = True
+ #N = (pN, len(image))[len(image) < pN]
+ for idx in range(0, N):
+ if idx == len(image):
+ image += '\xFF'
+ elif image[idx] != '\xFF':
+ isEmpty = False
+ if(not isEmpty):
+ for wordAddr in range(0, N-2, 2):
+ self.send4bitWriteInstruction(self.CMD_TWII, byte2int(image[wordAddr]) | (byte2int(image[wordAddr + 1]) << 8))
+ self.send4bitWriteInstruction(self.CMD_TW_START_PROG, byte2int(image[N-2]) | (byte2int(image[N-1]) << 8))
+ self.top.cmdFPGAWrite(0x12, 0x81)
+ self.top.hostDelay(self.delayP9)
+ self.setPins(0)
+ self.top.cmdDelay(self.delayP10)
+ for i in range(0,4):
+ self.sendCommand(1)
+
+ def writeUserIdLocation(self, image):
+ self.writeSequentialBlock(self.userIDLocationAddr, image, self.userIDLocationSize, "Writing User ID Locations")
+
+ def checkSignature(self):
+ signature = self.readSignature()
+ if signature != self.signature:
+ msg = "Unexpected device signature. " + \
+ "Want %02X%02X%02X, but got %02X%02X%02X" % \
+ (byte2int(self.signature[0]), byte2int(self.signature[1]),
+ byte2int(self.signature[2]),
+ byte2int(signature[0]), byte2int(signature[1]),
+ byte2int(signature[2]))
+ if self.top.getForceLevel() >= 1:
+ self.printWarning(msg)
+ else:
+ self.throwError(msg)
+
+ def writeProgmem(self, image):
+ nrBytes = self.flashPages * self.flashPageSize
+ if len(image) > nrBytes:
+ self.throwError("Invalid flash image size %d (expected <=%d)" % \
+ (len(image), nrBytes))
+ self.writeSequentialBlock(0, image, nrBytes, "Writing flash")
+
+ def writeFuse(self, image):
+ self.enterPM()
+ if len(image) > self.fuseBytes:
+ self.throwError("Invalid Fuses image size %d (expected less than %d)" % \
+ (len(image), self.fuseBytes))
+ self.executeCode((0x8EA6, 0x8CA6, 0xEF00, 0xF800))
+ for fuseAddr in range(0,len(image)):
+ self.executeCode(self.getCodeAddrToTBLPTR(self.configWordAddr+fuseAddr))
+ if(fuseAddr & 0x01):
+ byte = byte2int(image[fuseAddr]) << 8
+ else:
+ byte = byte2int(image[fuseAddr])
+ self.send4bitWriteInstruction(self.CMD_TW_START_PROG, byte)
+ self.top.cmdFPGAWrite(0x12, 0x81)
+ #self.setPins(1)
+ self.top.hostDelay(self.delayP9)
+ self.setPins(0)
+ self.top.cmdDelay(self.delayP10)
+ for i in range(0,4):
+ self.sendCommand(1)
+ #self.executeCode((0x2AF6,))
+ self.writeSequentialBlock(self.configWordAddr, image, self.fuseBytes, "Writing fuses")
+ self.progressMeterInit("Writing fuses", 0)
+
+ def exitPM(self):
+ "Exit programming mode. Vdd last exit mode"
+ self.top.flushCommands()
+ self.setPins(0, 0)
+ self.applyVPP(False)
+ self.applyVCC(False)
+ self.applyGND(False)
+ self.isInPmMode = False
+
+# ready for 18F below
+ def send4bitReadInstruction(self, pInstruction):
+ def incBbAndCheckFillImage():
+ self.BufferedBytes += 1
+ if self.BufferedBytes == self.top.getBufferRegSize():
+ self.flushBufferToImage()
+ # self.sendCommand(1,0,1,pInstruction)
+ self.sendCommand(1, 0, 1, pInstruction)
+ # self.busyWait()
+ self.readSDOBufferHigh()
+ incBbAndCheckFillImage()
+
+ def send4bitWriteInstruction(self, pInstruction, pDataPayload):
+ # self.busyWait()
+ self.setSDI(pDataPayload)
+ #print("sending {:x}\n".format(pDataPayload))
+ self.sendCommand(1, 1, 0, pInstruction)
+ self.top.flushCommands()
+
+ def sendCommand(self, bit4bitInstr=1, bitSendData=0, bitReadData=0, cmd4bit=0, bitKeepClkHigh=0):
+ '''
+ `define CMDBIT_4BITINSTR 0
+ `define CMDBIT_SENDDATA 1
+ `define CMDBIT_READDATA 2
+ `define CMDBIT_KEEPCLKHIGH 7
+ '''
+ command = (cmd4bit & 0x0F) << 3
+ if bit4bitInstr:
+ command |= 2 ** self.PCMDBIT_4BITINSTR
+ if bitSendData:
+ command |= 2 ** self.PCMDBIT_SENDDATA
+ if bitReadData:
+ command |= 2 ** self.PCMDBIT_READDATA
+ if bitKeepClkHigh:
+ command |= 2 ** self.PCMDBIT_KEEPCLKHIGH
+ # print("cmd sending {:x}\n".format(command))
+ self.top.cmdFPGAWrite(0x12, command)
+ if(bitSendData or bitReadData):
+ self.top.cmdDelay(2 * 20 * 2 * self.delayP2A)
+ else:
+ self.top.cmdDelay(2 * 4 * 2 * self.delayP2A)
+
+ def setTopProgrammerDelays(self):
+ #print("tdel5:{:d}".format(int(math.ceil(self.delayP2A / 42e-9))))
+ #print("tdly:{:d}".format(int(math.ceil(self.delayP5 / 42e-9))))
+ self.top.cmdFPGAWrite(0x10, int(math.ceil(self.delayP2A / 42e-9)))
+ self.top.cmdFPGAWrite(0x11, int(math.ceil(self.delayP5 / 42e-9)))
+
+ def setSDI8(self, sdi):
+ self.top.cmdFPGAWrite(0x16, sdi & 0xFF)
+
+ def setSDI(self, sdi):
+ '''
+ 16 -set 16 bit sdi value
+ '''
+ for addr in (0x16, 0x17):
+ self.top.cmdFPGAWrite(addr, sdi & 0xFF)
+ sdi = sdi >> 8
+
+ def flushBufferToImage(self):
+ # print ("storing {:d} bytes to image".format(self.BufferedBytes))
+ if self.BufferedBytes > 0:
+ self.Image += self.top.cmdReadBufferReg(self.BufferedBytes)
+ self.BufferedBytes = 0
+
+ def sendInstruction(self, instr):
+ self.setSDI(instr)
+ self.sendCommand(1, 1) # send 4 times positive edge
+ # self.top.flushCommands()
+
+ def executeCode(self, code):
+ for instr in code:
+ self.sendInstruction(instr)
+
+ def setPins(self, ICSPCLK=0, SDIOVALUE=0, SDIODRIVEN=1):
+ '''
+ 16 - setPins
+ '''
+ data = 0
+ if ICSPCLK:
+ data |= 1
+ if SDIODRIVEN:
+ data |= 2
+ if SDIOVALUE:
+ data |= 4
+ self.top.cmdFPGAWrite(0x15, data)
+
+ def getStatusFlags(self):
+ '''
+ [0] - BUSY
+ [1] - SDO
+ '''
+ self.flushBufferToImage()
+ self.top.cmdFPGARead(0x12)
+ stat = self.top.cmdReadBufferReg()
+ return byte2int(stat[0])
+
+ def readSDOBufferHigh(self):
+ self.top.cmdFPGARead(0x14)
+
+ def readSDOBufferLow(self):
+ self.top.cmdFPGARead(0x15)
+
+ def rawSDIOState(self):
+ return bool(self.getStatusFlags() & self.STAT_SDIO)
+
+ def isBusy(self):
+ return bool(self.getStatusFlags() & self.STAT_BUSY)
+
+ def busyWait(self):
+ for i in range(0, 100):
+ if not self.isBusy():
+ return
+ self.top.hostDelay(0.000001)
+ self.throwError("Timeout in busywait.")
+
+ def getCodeAddrToTBLPTR(self, addr):
+ ub = (addr >> 16) & 0xFF
+ hb = (addr >> 8) & 0xFF
+ lb = addr & 0xFF
+ return ((0x0E00 | ub), 0x6EF8, (0x0E00 | hb), 0x6EF7, (0x0E00 | lb), 0x6EF6)
diff --git a/libtoprammer/chips/microchip8/microchip8_18f1220family.py b/libtoprammer/chips/microchip8/microchip8_18f1220family.py
new file mode 100644
index 0000000..eb77386
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_18f1220family.py
@@ -0,0 +1,61 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip8 - 18f1220 family - 8bit PIC MCU
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chips.microchip8.microchip8_18_common import *
+
+class microchip8_18f1220family(Chip_Microchip8_18_common):
+
+ voltageVDD = 4.5
+ voltageVPP = 9
+
+ writeBufferSize = 8
+ eraseBufferSize = 64
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip_Microchip8_18_common.__init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes)
+
+ def erase(self):
+ self.progressMeterInit("Erasing chip", 0)
+ self.enterPM(True)
+ self.executeCode(self.getCodeAddrToTBLPTR(0x3C0004))
+ self.send4bitWriteInstruction(self.CMD_TW, 0x0080)
+ self.executeCode((0x0000,))
+ self.sendCommand(1)
+ self.top.cmdDelay(self.delayP11 + self.delayP10)
+ for i in range(0,4):
+ self.sendCommand(1)
+ self.top.flushCommands()
+ self.progressMeterFinish()
+
+ def setEEPROMAddr(self, addr):
+ self.executeCode((0x0E00 | (addr & 0xFF), 0x6EA9))
diff --git a/libtoprammer/chips/microchip8/microchip8_18f2221family.py b/libtoprammer/chips/microchip8/microchip8_18f2221family.py
new file mode 100644
index 0000000..dca8dfd
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_18f2221family.py
@@ -0,0 +1,73 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip8 - 18f2221 family - 8bit PIC MCU
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chips.microchip8.microchip8_18_common import *
+
+class microchip8_18f2221family(Chip_Microchip8_18_common):
+
+ voltageVDD = 5
+ voltageVPP = 11
+
+ delayP2A = 0.0000008 # Serial clock low time
+ delayP5 = 0.0000015 # Delay between 4-bit command and command operand
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip_Microchip8_18_common.__init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes)
+
+ def erase(self):
+ self.progressMeterInit("Erasing chip", 0)
+ self.enterPM(True)
+ self.executeCode(self.getCodeAddrToTBLPTR(0x3C0005))
+ self.send4bitWriteInstruction(self.CMD_TW, 0x3F3F)
+ self.executeCode(self.getCodeAddrToTBLPTR(0x3C0004))
+ self.send4bitWriteInstruction(self.CMD_TW, 0x8F8F)
+ self.executeCode((0x0000,))
+ self.sendCommand(1)
+ self.top.hostDelay(self.delayP11 + self.delayP10)
+ for i in range(0,4):
+ self.sendCommand(1)
+ self.top.flushCommands()
+ self.progressMeterFinish()
+
+ def eraseRow(self, rowAddr):
+ self.executeCode((0x8EA6, 0x9CA6, 0x84A6))
+ self.executeCode(self.getCodeAddrToTBLPTR(rowAddr))
+ self.executeCode((0x88A6, 0x82A6))
+ self.sendCommand(1, 0, 0, 0x0, 1)
+ self.top.hostDelay(self.delayP9)
+ self.setPins(0)
+ self.top.hostDelay(self.delayP10)
+
+ def setEEPROMAddr(self, addr):
+ self.executeCode((0x0E00 | (addr & 0xFF), 0x6EA9, (0x0E00 | ((addr >> 8) & 0xFF)), 0x6EAA))
+
diff --git a/libtoprammer/chips/microchip8/microchip8_18f97j60family.py b/libtoprammer/chips/microchip8/microchip8_18f97j60family.py
new file mode 100644
index 0000000..8270792
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_18f97j60family.py
@@ -0,0 +1,103 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip8 - 18f97j60 family - 8bit PIC MCU
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chips.microchip8.microchip8_18_common import *
+
+class microchip8_18f97j60family(Chip_Microchip8_18_common):
+
+ voltageVDD = 3
+ voltageVPP = 3
+
+ delayP5A = 0.000000040 # Delay between 4-bit command operand and next 4-bit command
+ delayP9 = 0.0034 # SCK High time (minimum programming time)
+ delayP10 = 0.000005 # SCK Low time after programming (high-voltage discharge time)
+ delayP11 = 0.475 # Delay to allow self-timed data write or bulk erase to occur
+ delayP12 = 0.0004 # Input data hold time from nMCLR/Vpp rise
+ delayP19 = 0.000001 # Delay from first nMCLR fall to first PGC rise for key sequence on PGD
+ delayP20 = 0.00000004 # Delay from last PGC fall for key sequence on PGD to second nMCLR rise
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip_Microchip8_18_common.__init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes)
+
+ def enterPM(self, force=False):
+ if self.isInPmMode and not force:
+ return
+ "Enter HV programming mode. Vdd first entry mode"
+ self.applyVCC(False)
+ self.applyVPP(False)
+ self.applyGND(False)
+ self.setPins(0, 0)
+ #self.top.cmdSetVCCVoltage(self.voltageVDD)
+ self.top.cmdSetVPPVoltage(self.voltageVPP)
+ self.applyGND(True)
+ self.applyVCC(True)
+ self.top.hostDelay(self.delayP13)
+ self.applyVPP(True)
+ self.applyVPP(False)
+ self.top.hostDelay(self.delayP19)
+ self.setTopProgrammerDelays()
+ #program entry code
+ #print("sending enterpm")
+ self.top.cmdFPGAWrite(0x18,0xFF)
+ self.top.hostDelay(self.delayP20)
+ self.applyVPP(True)
+ self.top.hostDelay(self.delayP12)
+
+ self.isInPmMode = True
+
+ def erase(self):
+ self.progressMeterInit("Erasing chip", 0)
+ self.enterPM(True)
+ self.executeCode(self.getCodeAddrToTBLPTR(0x3C0004))
+ self.send4bitWriteInstruction(self.CMD_TW, 0x0080)
+ self.executeCode((0x0000,))
+ self.sendCommand(1)
+ self.top.hostDelay(self.delayP11 + self.delayP10)
+ for i in range(0,4):
+ self.sendCommand(1)
+ self.top.flushCommands()
+ self.progressMeterFinish()
+
+ def writeSequentialBlock(self, startAddr, image, size, infoText):
+ if len(image) > size:
+ self.throwError("Invalid flash image size %d (expected <=%d)" % \
+ (len(image), self.userIDLocationSize))
+ self.enterPM()
+ self.executeCode((0x8EA6, 0x9CA6))
+ self.progressMeterInit(infoText, len(image) / 8)
+ self.executeCode(self.getCodeAddrToTBLPTR(startAddr))
+ for blockAddr in range(0, len(image), 8):
+ self.write8bytes(image[blockAddr:])
+ self.progressMeter(blockAddr)
+ self.progressMeterFinish()
+ self.exitPM() \ No newline at end of file
diff --git a/libtoprammer/chips/microchip8/microchip8_common.py b/libtoprammer/chips/microchip8/microchip8_common.py
new file mode 100644
index 0000000..0a53d5a
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_common.py
@@ -0,0 +1,512 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip8 common - basic file for 8bit PIC MCU
+#
+# Copyright (c) 2012 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chip import *
+import math
+
+class Chip_Microchip8_common(Chip):
+ CMD_LOAD_DATA_FOR_PGM = 0x02
+ CMD_LOAD_DATA_FOR_DM = 0x03
+ CMD_READ_DATA_FROM_PGM = 0x04
+ CMD_READ_DATA_FROM_DM = 0x05
+ CMD_INCREMENT_ADDRESS = 0x06
+ CMD_BULK_ERASE_PGM = 0x09
+ CMD_BULK_ERASE_DM = 0x0B
+
+ PCMDBIT_4BITINSTR = 0
+ PCMDBIT_SENDDATA = 1
+ PCMDBIT_READDATA = 2
+
+ STAT_BUSY = 0x01
+ STAT_SDIO = 0x02
+
+ # EEPROM access: default off, if exists override it
+ SUPPORT_EEPROMREAD = (0 << 4)
+ SUPPORT_EEPROMWRITE = (0 << 5)
+
+ # default delays - can be overridden
+ delayTdly5 = 0.00000015
+ delayTdis = 0.0001
+ delayTprog = 0.001
+ delayTdly = 0.000001
+ delayTera = 0.01
+
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip.__init__(self,
+ chipPackage=chipPackage,
+ chipPinVCC=chipPinVCC,
+ chipPinsVPP=chipPinsVPP,
+ chipPinGND=chipPinGND)
+ self.signature = signature
+ self.flashPageSize = flashPageSize # Flash page size, in words
+ self.flashPages = flashPages # Nr of flash pages
+ self.eepromPageSize = eepromPageSize # EEPROM page size, in bytes
+ self.eepromPages = eepromPages # Nr of EEPROM pages
+ self.fuseBytes = fuseBytes # Nr of fuse bytes
+ self.PC = 0
+ self.isInPmMode = False
+
+ # if(eepromPageSize == 0):
+ # self.SUPPORT_EEPROMREAD = (0 << 4)
+ # self.SUPPORT_EEPROMWRITE = (0 << 5)
+
+ def erase(self):
+ if(hasattr(self, 'osccalAddr')):
+ self.__erase(keepOSCCAL=True)
+ else:
+ self.__erase(keepOSCCAL=False)
+
+ def __erase(self, keepConfigWord=False, keepUserIDLocation=False, keepOSCCAL=False, keepEEPROM=False):
+ OSCCAL = 0xfff
+ self.enterPM()
+ if(keepOSCCAL):
+ self.progressMeterInit("Reading OSCCAL)", 0)
+ self.setPC(self.osccalAddr)
+ self.sendReadFlashInstr()
+ self.top.cmdDelay(self.delayTdly)
+ self.readSDOBufferLow()
+ self.readSDOBufferHigh()
+ OSCCAL = self.top.cmdReadBufferReg16()
+ self.progressMeterFinish()
+ if(hasattr(self, 'osccalBackupAddr') and OSCCAL == 0xfff):
+ self.progressMeterInit("OSCCAL value lost, restoring from backup location ...", 0)
+ print("OSCCAL value lost, restoring from backup location ...")
+ self.setPC(self.osccalBackupAddr - self.osccalAddr)
+ self.sendReadFlashInstr()
+ self.top.cmdDelay(self.delayTdly)
+ self.readSDOBufferLow()
+ self.readSDOBufferHigh()
+ OSCCAL = self.top.cmdReadBufferReg16()
+ self.progressMeterFinish()
+ # print ("osccal: %x\n" % OSCCAL)
+ if(keepConfigWord):
+ self.progressMeterInit("Reading ConfigWord for backup", 0)
+ CW = self.getConfigWord()
+ self.progressMeterFinish()
+ # erase User ID Location and backup osccal Tooo
+ # erase User ID Location and backup osccal Tooo
+ if(not keepUserIDLocation):
+ self.enterConfigArea()
+ self.setPC(self.userIDLocationAddr)
+ self.progressMeterInit("Erasing chip", 0)
+ self.bulkErasePGM()
+ self.progressMeterFinish()
+ # OSCCAL=0x3454
+ # OSCCAL=0x0C0A
+ if(keepOSCCAL and OSCCAL != 0xfff):
+ self.exitPM()
+ self.enterPM()
+ self.progressMeterInit("Writing osccal, value %x" % OSCCAL, 0)
+ print("Writing osccal, value %x" % OSCCAL)
+ self.setPC(self.osccalAddr)
+ # print("PC is set to %x" % self.PC)
+ self.send6bitWriteInstruction(self.CMD_LOAD_DATA_FOR_PGM, OSCCAL)
+ self.top.cmdDelay(self.delayTdly)
+ self.sendWriteFlashInstr()
+ self.progressMeterFinish()
+ if(keepConfigWord):
+ self.progressMeterInit("Writing ConfigWord, value %x" % CW, 0)
+ self.writeConfigWord(CW)
+ self.progressMeterFinish()
+ if((not keepEEPROM) and self.SUPPORT_EEPROMWRITE):
+ self.progressMeterInit("Erasing EEPROM", 0)
+ self.bulkEraseDM()
+ self.progressMeterFinish()
+ self.exitPM()
+
+ def bulkErasePGM(self):
+ self.sendCommand(0, 0, 0, self.CMD_BULK_ERASE_PGM)
+ self.top.cmdDelay(self.delayTera) # Tera
+
+ def bulkEraseDM(self):
+ self.sendCommand(0, 0, 0, self.CMD_BULK_ERASE_DM)
+ self.top.cmdDelay(self.delayTera) # Tera
+
+ def readProgmem(self):
+ nrWords = self.flashPages * self.flashPageSize
+ image = ""
+ self.enterPM()
+ self.setPC(0)
+ self.progressMeterInit("Reading flash", nrWords)
+ bufferedBytes = 0
+ for word in range(0, nrWords):
+ self.sendReadFlashInstr()
+ # self.top.cmdDelay(0.00002) #20us wait - inconsistent data if skipped
+ self.top.cmdDelay(self.delayTdly)
+
+ self.readSDOBufferLow()
+ bufferedBytes += 1
+ self.readSDOBufferHigh()
+ bufferedBytes += 1
+ if bufferedBytes == self.top.getBufferRegSize():
+ image += self.top.cmdReadBufferReg(bufferedBytes)
+ self.progressMeter(word)
+ bufferedBytes = 0
+ self.incrementPC(1)
+ image += self.top.cmdReadBufferReg(bufferedBytes)
+ self.progressMeterFinish()
+ # self.exitPM()
+ return image
+
+ def readEEPROM(self):
+ nrWords = self.eepromPages * self.eepromPageSize
+ image = ""
+ self.enterPM()
+ self.progressMeterInit("Reading eeprom", nrWords)
+ bufferedBytes = 0
+ for word in range(0, nrWords):
+ self.sendReadEEPROMInstr()
+ self.top.cmdDelay(self.delayTdly) # 20us wait - inconsistent data if skipped
+ self.readSDOBufferLow()
+ bufferedBytes += 1
+ if bufferedBytes == self.top.getBufferRegSize():
+ image += self.top.cmdReadBufferReg(bufferedBytes)
+ self.progressMeter(word)
+ bufferedBytes = 0
+ self.incrementPC(1)
+ image += self.top.cmdReadBufferReg(bufferedBytes)
+ self.progressMeterFinish()
+ # self.exitPM()
+ return image
+
+ def writeEEPROM(self, image):
+ nrWords = self.eepromPages * self.eepromPageSize
+ if len(image) > nrWords:
+ self.throwError("Invalid flash image size %d (expected <=%d)" % len(image))
+ self.enterPM()
+ self.progressMeterInit("Writing eeprom", nrWords)
+ bufferedBytes = 0
+ for addr in range(0, len(image)):
+ self.progressMeter(addr)
+ byte = byte2int(image[addr])
+ if byte != 0xff:
+ self.send6bitWriteInstruction(self.CMD_LOAD_DATA_FOR_DM, byte)
+ self.top.cmdDelay(self.delayTdly)
+ self.sendWriteFlashInstrDM()
+ self.incrementPC(1)
+ self.progressMeterFinish()
+ # self.exitPM()
+
+ def writeProgmem(self, image):
+ nrWords = self.flashPages * self.flashPageSize
+ if len(image) > nrWords * 2 or len(image) % 2 != 0:
+ self.throwError("Invalid flash image size %d (expected <=%d and word aligned)" % \
+ (len(image), nrWords * 2))
+ self.progressMeterInit("Writing flash", len(image) // 2)
+ self.enterPM()
+ self.setPC(0)
+ for wordAddr in range(0, len(image) // 2):
+ self.progressMeter(wordAddr)
+ # do not swap following two lines
+ WD = (byte2int(image[wordAddr * 2 + 1]) << 8) | byte2int(image[wordAddr * 2 + 0])
+ if(WD != (ord(self.defaultWord[1]) << 8) + ord(self.defaultWord[0])):
+ self.send6bitWriteInstruction(self.CMD_LOAD_DATA_FOR_PGM, WD)
+ self.top.cmdDelay(self.delayTdly)
+ self.sendWriteFlashInstr()
+ self.incrementPC(1)
+ self.progressMeterFinish()
+ # self.exitPM()
+
+ def readFuse(self):
+ self.enterPM()
+ fuses = []
+ self.progressMeterInit("Reading fuses (configuration word)", 0)
+ for CW in self.getConfigWord():
+ fuses.append(int2byte(CW & 0x00ff))
+ fuses.append(int2byte((CW >> 8) & 0x00ff))
+ self.progressMeterFinish()
+ return b"".join(fuses)
+
+ def readUserIdLocation(self):
+ self.enterPM()
+ self.enterConfigArea()
+ self.setPC(self.userIDLocationAddr)
+ self.progressMeterInit("Reading User ID Location", 0)
+ for i in range(0, self.userIDLocationSize):
+ self.sendReadFlashInstr()
+ self.top.hostDelay(self.delayTdly)
+ self.readSDOBufferLow()
+ self.readSDOBufferHigh()
+ self.incrementPC(1)
+ # self.exitPM()
+ self.progressMeterFinish()
+ return self.top.cmdReadBufferReg()[0:2 * self.userIDLocationSize]
+
+ def writeUserIdLocation(self, image):
+ if len(image) > self.userIDLocationSize * 2 or len(image) % 2 != 0:
+ self.throwError("Invalid flash image size %d (expected <=%d and word aligned)" % \
+ (len(image), self.userIDLocationSize * 2))
+ self.enterPM()
+ self.enterConfigArea()
+ self.setPC(self.userIDLocationAddr)
+ self.progressMeterInit("Writing User ID Location", (len(image) // 2) - 1)
+ for word in range(0, (len(image) // 2)):
+ self.progressMeter(word)
+ # do not swap following two lines
+ WD = (byte2int(image[word * 2 + 1]) << 8) | byte2int(image[word * 2 + 0])
+ if(WD != (ord(self.defaultWord[1]) << 8) + ord(self.defaultWord[0])):
+ self.send6bitWriteInstruction(self.CMD_LOAD_DATA_FOR_PGM, WD)
+ self.sendWriteFlashInstr()
+ self.incrementPC(1)
+ self.top.hostDelay(self.delayTdly)
+ self.sendWriteFlashInstr()
+ self.progressMeterFinish()
+ # self.exitPM()
+
+ def getConfigWordSize(self):
+ return self.fuseBytes // 2
+
+ def getConfigWord(self):
+ self.enterPM()
+ self.enterConfigArea()
+ self.setPC(self.configWordAddr)
+ retVal = []
+ for i in range(0, self.getConfigWordSize()):
+ self.sendReadFlashInstr()
+ self.top.cmdDelay(self.delayTdly)
+ self.readSDOBufferLow()
+ self.readSDOBufferHigh()
+ self.incrementPC(1)
+ retVal.append(self.top.cmdReadBufferReg16())
+
+ return retVal
+
+ def writeFuse(self, image):
+ if len(image) != 2 * self.getConfigWordSize():
+ self.throwError("Invalid Fuses image size %d (expected %d)" % \
+ (len(image), 2 * self.getConfigWordSize()))
+ self.progressMeterInit("Writing fuses", 0)
+ # print "image1:%x,,%x,,%x" % (byte2int(image[0]),byte2int(image[1]),byte2int(image[1])<<8)
+ CW = []
+ for tBytes in zip(image[::2], image[1::2]):
+ CW.append((byte2int(tBytes[1]) << 8) | byte2int(tBytes[0]))
+ self.writeConfigWord(CW)
+ self.progressMeterFinish()
+
+ def writeConfigWord(self, listConfigWord16):
+ # Externally timed writes are not supported
+ # for Configuration and Calibration bits. Any
+ # externally timed write to the Configuration
+ # or Calibration Word will have no effect on
+ # the targeted word.
+ self.enterPM()
+ self.enterConfigArea()
+ self.setPC(self.configWordAddr)
+ for configWord16 in listConfigWord16:
+ # print "write CW {:x}".format(configWord16)
+ self.send6bitWriteInstruction(self.CMD_LOAD_DATA_FOR_PGM, configWord16)
+ self.top.cmdDelay(self.delayTdly)
+ self.sendWriteFlashInstrCW()
+ self.incrementPC(1)
+ self.top.flushCommands()
+
+
+
+ def enterPM(self):
+ if self.isInPmMode and self.isInsideProgramMemoryArea:
+ self.resetPC()
+ return
+ self.PC = self.initPcValue
+ self.isInsideProgramMemoryArea = True
+ "Enter HV programming mode. Vdd first entry mode"
+ self.applyVCC(False)
+ self.applyVPP(False)
+ self.applyGND(False)
+ self.setPins(0, 0)
+ self.top.cmdSetVCCVoltage(self.voltageVDD)
+ self.top.cmdSetVPPVoltage(self.voltageVPP)
+ # self.top.cmdEnableZifPullups(True)
+ self.applyGND(True)
+
+ self.applyVCC(True)
+ # self.top.cmdDelay(0.000005)
+
+ for i in range(0, 2):
+ self.applyVPP(True)
+ # self.top.cmdDelay(0.000005)
+ self.applyVPP(False)
+ # self.top.cmdDelay(0.000031)
+ self.applyVPP(True)
+ # self.top.cmdEnableZifPullups(True)
+
+ # self.top.cmdDelay(0.000005) #least 5us is required to reach Vdd first entry PM
+ self.setTopProgrammerDelays()
+ self.isInPmMode = True
+
+ def checkSignature(self):
+ signature = self.readSignature()
+ if signature != self.signature:
+ msg = "Unexpected device signature. " + \
+ "Want %02X%02X%02X, but got %02X%02X%02X" % \
+ (byte2int(self.signature[0]), byte2int(self.signature[1]),
+ byte2int(self.signature[2]),
+ byte2int(signature[0]), byte2int(signature[1]),
+ byte2int(signature[2]))
+ if self.top.getForceLevel() >= 1:
+ self.printWarning(msg)
+ else:
+ self.throwError(msg)
+
+ def exitPM(self):
+ "Exit HV programming mode. Vdd last exit mode"
+ self.top.flushCommands()
+ self.setPins(0, 0)
+ self.applyVPP(False)
+ self.applyGND(False)
+ self.top.hostDelay(self.delayTdly)
+ self.applyVCC(False)
+ self.isInPmMode = False
+
+ def sendReadFlashInstr(self):
+ '''
+ '''
+ self.sendCommand(0, 0, 1, self.CMD_READ_DATA_FROM_PGM)
+
+ def sendWriteFlashInstr(self):
+ '''
+ to be overriden
+ '''
+ pass
+
+ def sendReadEEPROMInstr(self):
+ '''
+ '''
+ self.sendCommand(0, 0, 1, self.CMD_READ_DATA_FROM_DM)
+
+ def send6bitReadInstruction(self, pInstruction):
+ def incBbAndCheckFillImage():
+ self.BufferedBytes += 1
+ if self.BufferedBytes == self.top.getBufferRegSize():
+ self.flushBufferToImage()
+ # self.sendCommand(1,0,1,pInstruction)
+ self.sendCommand(0, 0, 1, pInstruction)
+ # self.busyWait()
+ self.readSDOBufferHigh()
+ incBbAndCheckFillImage()
+
+ def send6bitWriteInstruction(self, pInstruction, pDataPayload):
+ # self.busyWait()
+ self.setSDI(pDataPayload)
+ # print("sending {:x}\n".format(pDataPayload))
+ self.sendCommand(0, 1, 0, pInstruction)
+ self.top.flushCommands()
+
+ def setSDI(self, sdi):
+ '''
+ set 14 bit sdi value
+ '''
+ self.top.cmdFPGAWrite(0x13, sdi & 0xFF)
+ self.top.cmdFPGAWrite(0x14, (sdi >> 8) & 0x3F)
+
+ def sendCommand(self, bit4bitInstr=0, bitSendData=0, bitReadData=0, cmd4bit=0):
+ '''
+ `define CMDBIT_4BITINSTR 0
+ `define CMDBIT_SENDDATA 1
+ `define CMDBIT_READDATA 2
+ '''
+ command = (cmd4bit & 0x1F) << 3
+ if bit4bitInstr:
+ command |= 2 ** self.PCMDBIT_4BITINSTR
+ if bitSendData:
+ command |= 2 ** self.PCMDBIT_SENDDATA
+ if bitReadData:
+ command |= 2 ** self.PCMDBIT_READDATA
+ # print("cmd sending {:x}\n".format(command))
+ self.top.cmdFPGAWrite(0x12, command)
+
+ def setTopProgrammerDelays(self):
+ #print("tdel5:{:d}".format(int(math.ceil(self.delayTdly5 / 42e-9))))
+ #print("tdly:{:d}".format(int(math.ceil(self.delayTdly / 42e-9))))
+ self.top.cmdFPGAWrite(0x10, int(math.ceil(self.delayTdly5 / 42e-9)))
+ self.top.cmdFPGAWrite(0x11, int(math.ceil(self.delayTdly / 42e-9)))
+
+# def runCommandSync(self, command):
+# self.loadCommand(command)
+# self.busyWait()
+ def resetPC(self):
+ '''can be overriden'''
+ self.setPC(self.initPcValue)
+
+ def setPC(self, address):
+ '''to be overriden'''
+ pass
+
+ def incrementPC(self, count):
+ '''to be overriden'''
+ pass
+
+ def enterConfigArea(self, wordLatched=0):
+ '''to be overriden'''
+ pass
+
+ def setPins(self, ICSPCLK=0, SDIOVALUE=0, SDIODRIVEN=1):
+ '''
+ setPins
+ '''
+ data = 0
+ if ICSPCLK:
+ data |= 1
+ if SDIODRIVEN:
+ data |= 2
+ if SDIOVALUE:
+ data |= 4
+ self.top.cmdFPGAWrite(0x15, data)
+
+ def getStatusFlags(self):
+ '''
+ '''
+ self.top.cmdFPGARead(0x12)
+ stat = self.top.cmdReadBufferReg()
+ return byte2int(stat[0])
+
+ def readSDOBufferHigh(self):
+ self.top.cmdFPGARead(0x10)
+
+ def readSDOBufferLow(self):
+ self.top.cmdFPGARead(0x13)
+
+ def rawSDIOState(self):
+ return bool(self.getStatusFlags() & self.STAT_SDIO)
+
+ def busy(self):
+ return bool(self.getStatusFlags() & self.STAT_BUSY)
+
+# def busyWait(self):
+# for i in range(0, 100):
+# if not self.busy():
+# return
+# self.top.hostDelay(0.01)
+# self.throwError("Timeout in busywait.")
+
+# def waitHighSDIO(self):
+# for i in range(0, 100):
+# if self.rawSDOState():
+# return
+# self.top.hostDelay(0.01)
+# self.throwError("Timeout waiting for SDO.")
diff --git a/libtoprammer/chips/microchip8/microchip8_singlePMarea.py b/libtoprammer/chips/microchip8/microchip8_singlePMarea.py
new file mode 100644
index 0000000..bd720c0
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_singlePMarea.py
@@ -0,0 +1,78 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# pic8_singlePMarea - file for older 8bit PIC MCUs
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chips.microchip8.microchip8_common import *
+
+class microchip8_singlePMarea(Chip_Microchip8_common):
+ CMD_BEGIN_PROGRAMMING = 0x08
+ CMD_END_PROGRAMMING = 0x0E
+
+ userIDLocationSize = 4
+ SUPPORT_SIGREAD = (0 << 1)
+
+ voltageVDD = 5
+ voltageVPP = 13
+ defaultWord = [b'\xFF', b'\x0F']
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip_Microchip8_common.__init__(self, chipPackage, chipPinVCC, chipPinsVPP, chipPinGND, signature, flashPageSize, flashPages, eepromPageSize, eepromPages, fuseBytes)
+ self.initPcValue = self.logicalFlashSize - 1
+ self.configWordAddr = self.logicalFlashSize - 1
+ self.osccalAddr = self.flashPageSize - 1
+ self.userIDLocationAddr = self.flashPageSize
+ self.osccalBackupAddr = self.userIDLocationAddr + self.userIDLocationSize
+ self.programMemoryByteAddressRange = [(0, 2 * self.flashPageSize)]
+ self.configWordByteAddressRange = [(2 * self.configWordAddr, 2 * self.configWordAddr + 1), (2 * 0xFFF, 2 * 0xFFF + 1)]
+ self.userIDLocationByteAddressRange = [(2 * self.userIDLocationAddr, 2 * (self.userIDLocationAddr + self.userIDLocationSize) - 1)]
+
+ def setPC(self, address):
+ while(self.PC != address):
+ self.incrementPC(1)
+
+ def incrementPC(self, count):
+ for address in range(0, count):
+ self.sendCommand(0, 0, 0, self.CMD_INCREMENT_ADDRESS)
+ self.PC += 1
+ if (self.PC == self.logicalFlashSize):
+ self.PC = 0
+
+ def sendWriteFlashInstr(self):
+ '''
+ '''
+ # self.loadCommand(self.PROGCMD_SENDDATA)
+ # self.top.hostDelay(0.000005)
+ self.sendCommand(0, 0, 0, self.CMD_BEGIN_PROGRAMMING)
+ self.top.cmdDelay(self.delayTprog) # 025) #Tprog
+ self.sendCommand(0, 0, 0, self.CMD_END_PROGRAMMING)
+ self.top.cmdDelay(self.delayTdis) # Tdis
+
+ def sendWriteFlashInstrDM(self):
+ self.sendWriteFlashInstr()
+
+ def sendWriteFlashInstrCW(self):
+ self.sendWriteFlashInstr()
diff --git a/libtoprammer/chips/microchip8/microchip8_splittedPMarea.py b/libtoprammer/chips/microchip8/microchip8_splittedPMarea.py
new file mode 100644
index 0000000..dd3902f
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_splittedPMarea.py
@@ -0,0 +1,132 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# pic8_splittedPMarea - file for newer 8bit PIC MCUs
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chips.microchip8.microchip8_common import *
+
+class microchip8_splittedPMarea(Chip_Microchip8_common):
+ CMD_LOAD_CONFIGURATION = 0x00
+
+ logicalFlashProgramMemorySize = 0x2000
+ logicalFlashConfigurationMemorySize = 0x2000
+
+ CMD_BEGIN_INTERNALLY_TIMED_PROGRAMMING = 0x08
+ CMD_BEGIN_EXTERNALLY_TIMED_PROGRAMMING = 0x18
+ CMD_END_EXTERNALLY_TIMED_PROGRAMMING = 0x0A
+ CMD_ROW_ERASE_PGM = 0x11
+
+ delayTinternalProgDM = 0.005
+ delayTinternalProgPM = 0.0025
+ # overriding:
+ delayTdis = 0.0003
+ delayTprog = 0.0021
+ delayTdly = 0.0000015
+ delayTera = 0.005
+
+ defaultWord = [b'\xFF', b'\x3F']
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ Chip_Microchip8_common.__init__(self, chipPackage, chipPinVCC, chipPinsVPP, chipPinGND, signature, flashPageSize, flashPages, eepromPageSize, eepromPages, fuseBytes)
+ self.isInsideProgramMemoryArea = True
+ self.initPcValue = 0
+ self.userIDLocationAddr = self.logicalFlashProgramMemorySize
+ self.deviceIDAddr = self.logicalFlashProgramMemorySize + 0x06
+ self.configWordAddr = self.logicalFlashProgramMemorySize + 0x07
+ self.programMemoryByteAddressRange = [(0, 2 * self.flashPageSize)]
+ self.configWordByteAddressRange = [(2 * self.configWordAddr, 2 * self.configWordAddr + 1)]
+ self.userIDLocationByteAddressRange = [(2 * self.userIDLocationAddr, 2 * (self.userIDLocationAddr + self.userIDLocationSize) - 1)]
+
+ def incrementPC(self, count):
+ for address in range(0, count):
+ self.sendCommand(0, 0, 0, self.CMD_INCREMENT_ADDRESS)
+ self.PC += 1
+ if(self.isInsideProgramMemoryArea):
+ if (self.PC == self.logicalFlashProgramMemorySize):
+ self.PC = 0
+ else:
+ if (self.PC == self.logicalFlashConfigurationMemorySize):
+ self.PC = self.logicalFlashProgramMemorySize
+
+ def enterConfigArea(self, wordLatched=0):
+ self.send6bitWriteInstruction(self.CMD_LOAD_CONFIGURATION, wordLatched)
+ self.PC = self.logicalFlashProgramMemorySize
+ self.isInsideProgramMemoryArea = False
+
+ def setPC(self, address):
+ if(self.isInsideProgramMemoryArea):
+ if(address >= self.logicalFlashProgramMemorySize):
+ raise(TOPException('Cannot set PC to address inside PM {:x}'.format(address)))
+ else:
+ if(address < self.logicalFlashProgramMemorySize):
+ raise(TOPException('Cannot set PC to address outside PM {:x}'.format(address)))
+ while(self.PC != address):
+ self.incrementPC(1)
+
+ def readSignature(self):
+ self.progressMeterInit("Reading signature", 0)
+ self.enterPM()
+ self.enterConfigArea()
+ self.setPC(self.deviceIDAddr)
+ idSize = 1
+ for i in range(0, idSize):
+ self.sendReadFlashInstr()
+ self.top.hostDelay(0.00002)
+ self.readSDOBufferLow()
+ self.readSDOBufferHigh()
+ self.incrementPC(1)
+ self.progressMeterFinish()
+ return self.top.cmdReadBufferReg()[0:2 * idSize]
+
+ def sendWriteFlashInstrExternallyTimed(self):
+ '''
+ '''
+ self.sendCommand(0, 0, 0, self.CMD_BEGIN_EXTERNALLY_TIMED_PROGRAMMING)
+ self.top.hostDelay(self.delayTprog)
+ self.sendCommand(0, 0, 0, self.CMD_END_EXTERNALLY_TIMED_PROGRAMMING)
+ self.top.hostDelay(self.delayTdis)
+
+ def sendWriteFlashInstrPM(self):
+ '''
+ '''
+ self.sendCommand(0, 0, 0, self.CMD_BEGIN_INTERNALLY_TIMED_PROGRAMMING)
+ self.top.hostDelay(self.delayTinternalProgPM)
+
+ def sendWriteFlashInstrCW(self):
+ '''
+ '''
+ self.sendCommand(0, 0, 0, self.CMD_BEGIN_INTERNALLY_TIMED_PROGRAMMING)
+ self.top.hostDelay(self.delayTinternalProgDM)
+
+ def sendWriteFlashInstr(self):
+ '''
+ '''
+ self.sendWriteFlashInstrPM()
+
+ def sendWriteFlashInstrDM(self):
+ '''
+ '''
+ self.sendWriteFlashInstrExternallyTimed()
diff --git a/libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py b/libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py
new file mode 100644
index 0000000..b7bd991
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py
@@ -0,0 +1,72 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# pic8_splittedPMarea - file for newer 8bit PIC MCUs
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chips.microchip8.microchip8_splittedPMarea import *
+
+class microchip8_splittedPMarea_hasResetPC(microchip8_splittedPMarea):
+
+ CMD_RESET_ADDRESS = 0x16
+
+ userIDLocationSize = 4
+ voltageVDD = 3
+ voltageVPP = 8.5
+
+ logicalFlashProgramMemorySize = 0x8000
+ logicalFlashConfigurationMemorySize = 0x8000
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ microchip8_splittedPMarea.__init__(self, chipPackage, chipPinVCC, chipPinsVPP, chipPinGND, signature, flashPageSize, flashPages, eepromPageSize, eepromPages, fuseBytes)
+
+ def setPC(self, address):
+ if(self.isInsideProgramMemoryArea):
+ if(address >= self.logicalFlashProgramMemorySize):
+ raise(TOPException('Cannot set PC to address inside PM {:x}'.format(address)))
+ if(address < self.PC):
+ self.resetPC()
+ self.setPC(address)
+ else:
+ if(address < self.logicalFlashProgramMemorySize):
+ raise(TOPException('Cannot set PC to address outside PM {:x}'.format(address)))
+ if(address < self.PC):
+ self.resetPC()
+ self.enterConfigArea()
+ self.setPC(address)
+ while(self.PC != address):
+ self.incrementPC(1)
+
+ def resetPC(self):
+ if hasattr(self, 'osccalAddr'):
+ if not hasattr(self, 'CMD_RESET_ADDRESS'):
+ print("reset instruction is not supported")
+ self.exitPM()
+ self.enterPM()
+ else:
+ self.sendCommand(0, 0, 0, self.CMD_RESET_ADDRESS)
+ self.PC = 0
+ self.isInsideProgramMemoryArea = True
+
diff --git a/libtoprammer/chips/microchip8/pic10f200dip8.py b/libtoprammer/chips/microchip8/pic10f200dip8.py
new file mode 100644
index 0000000..71dba66
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic10f200dip8.py
@@ -0,0 +1,71 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC10F200, PIC10F204 and PIC10f220 DIP8
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_singlePMarea import *
+
+class Chip_Pic10F200dip8(microchip8_singlePMarea):
+
+ # CONFIGURATION WORD FOR PIC10F200/202/204/206
+ # X X X X X X X MCLRE /CP WDT X X
+ logicalFlashSize = 0x200
+
+ def __init__(self):
+ microchip8_singlePMarea.__init__(self,
+ chipPackage="DIP8",
+ chipPinVCC=2,
+ chipPinsVPP=8,
+ chipPinGND=7,
+ signature="\x09\x18\x24\x35",
+ flashPageSize=0x100,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=2
+ )
+
+
+fuseDesc = (
+ BitDescription(0, "Unused"),
+ BitDescription(1, "Unused"),
+ BitDescription(2, "WDTE"),
+ BitDescription(3, "!CP"),
+ BitDescription(4, "MCLRE"),
+ BitDescription(5, "Unused"),
+ BitDescription(6, "Unused"),
+ BitDescription(7, "Unused"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "Unused"),
+ BitDescription(10, "Unused"),
+ BitDescription(11, "Unused"),
+)
+
+ChipDescription(
+ Chip_Pic10F200dip8,
+ bitfile="pic10fxxxdip8",
+ chipID="pic10f200dip8",
+ runtimeID=(0xDE01, 0x01),
+ chipVendors="Microchip",
+ description="PIC10F200, PIC10F204, PIC10F220",
+ packages=(("DIP8", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic10f202dip8.py b/libtoprammer/chips/microchip8/pic10f202dip8.py
new file mode 100644
index 0000000..c875729
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic10f202dip8.py
@@ -0,0 +1,71 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC10F202, PIC10F206 and PIC10f222 DIP8
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_singlePMarea import *
+
+class Chip_Pic10F202dip8(microchip8_singlePMarea):
+
+ # CONFIGURATION WORD FOR PIC10F200/202/204/206
+ # X X X X X X X MCLRE /CP WDT X X
+ logicalFlashSize = 0x400
+
+ def __init__(self):
+ microchip8_singlePMarea.__init__(self,
+ chipPackage="DIP8",
+ chipPinVCC=2,
+ chipPinsVPP=8,
+ chipPinGND=7,
+ signature="\x09\x18\x24\x35",
+ flashPageSize=0x200,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=2
+ )
+
+
+fuseDesc = (
+ BitDescription(0, "Unused"),
+ BitDescription(1, "Unused"),
+ BitDescription(2, "WDTE"),
+ BitDescription(3, "!CP"),
+ BitDescription(4, "MCLRE"),
+ BitDescription(5, "Unused"),
+ BitDescription(6, "Unused"),
+ BitDescription(7, "Unused"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "Unused"),
+ BitDescription(10, "Unused"),
+ BitDescription(11, "Unused"),
+)
+
+ChipDescription(
+ Chip_Pic10F202dip8,
+ bitfile="pic10fxxxdip8",
+ chipID="pic10f202dip8",
+ runtimeID=(0xDE01, 0x01),
+ chipVendors="Microchip",
+ description="PIC10F202, PIC10F206, PIC10F222",
+ packages=(("DIP8", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic10f320dip8.py b/libtoprammer/chips/microchip8/pic10f320dip8.py
new file mode 100644
index 0000000..69c73dc
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic10f320dip8.py
@@ -0,0 +1,71 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC10F320 DIP8
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic10F320dip8(microchip8_splittedPMarea_hasResetPC):
+
+ logicalFlashProgramMemorySize = 0x2000
+ logicalFlashConfigurationMemorySize = 0x2000
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP8",
+ chipPinVCC=2,
+ chipPinsVPP=8,
+ chipPinGND=7,
+ signature="\xA1\x29",
+ flashPageSize=0x100,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=2
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC, 1=CLKIN, 0=internal"),
+ BitDescription(1, "BOREN[0]"),
+ BitDescription(2, "BOREN[1]"),
+ BitDescription(3, "WDTE[0]"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=RA3 is nMCLR, weak pull-up enabled"),
+ BitDescription(7, "nCP"),
+ BitDescription(8, "LVP"),
+ BitDescription(9, "LPBOREN"),
+ BitDescription(10, "BORV"),
+ BitDescription(11, "WRT[0]"),
+ BitDescription(12, "WRT[1] 11=write protection off"),
+ BitDescription(13, "Unused"),
+)
+
+ChipDescription(
+ Chip_Pic10F320dip8,
+ bitfile="pic10fxxxdip8",
+ chipID="pic10f320dip8",
+ runtimeID=(0xDE01, 0x01),
+ chipVendors="Microchip",
+ description="PIC10F320, PIC10LF320",
+ packages=(("DIP8", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic10f322dip8.py b/libtoprammer/chips/microchip8/pic10f322dip8.py
new file mode 100644
index 0000000..9ad7d96
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic10f322dip8.py
@@ -0,0 +1,71 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC10F322 DIP8
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic10F322dip8(microchip8_splittedPMarea_hasResetPC):
+
+ logicalFlashProgramMemorySize = 0x2000
+ logicalFlashConfigurationMemorySize = 0x2000
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP8",
+ chipPinVCC=2,
+ chipPinsVPP=8,
+ chipPinGND=7,
+ signature="\x82\x29",
+ flashPageSize=0x200,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=2
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC, 1=CLKIN, 0=internal"),
+ BitDescription(1, "BOREN[0]"),
+ BitDescription(2, "BOREN[1]"),
+ BitDescription(3, "WDTE[0]"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=RA3 is nMCLR, weak pull-up enabled"),
+ BitDescription(7, "nCP"),
+ BitDescription(8, "LVP"),
+ BitDescription(9, "LPBOREN"),
+ BitDescription(10, "BORV"),
+ BitDescription(11, "WRT[0]"),
+ BitDescription(12, "WRT[1] 11=write protection off"),
+ BitDescription(13, "Unused"),
+)
+
+ChipDescription(
+ Chip_Pic10F322dip8,
+ bitfile="pic10fxxxdip8",
+ chipID="pic10f322dip8",
+ runtimeID=(0xDE01, 0x01),
+ chipVendors="Microchip",
+ description="PIC10F322, PIC10LF322",
+ packages=(("DIP8", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic12f1822dip8.py b/libtoprammer/chips/microchip8/pic12f1822dip8.py
new file mode 100644
index 0000000..a5667bb
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic12f1822dip8.py
@@ -0,0 +1,91 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC12F1822 DIP8
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic12F1822dip8(microchip8_splittedPMarea_hasResetPC):
+
+ rowSize = 16
+ nLatches = 16
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP8",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=8,
+ signature="\x08\x27",
+ flashPageSize=0x800,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_Pic12F1822dip8,
+ bitfile="microchip01dip8",
+ chipID="pic12f1822dip8",
+ runtimeID=(0xDE02, 0x01),
+ chipVendors="Microchip",
+ description="PIC12F1822, PIC12LF1822",
+ packages=(("DIP8", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic12f508dip8.py b/libtoprammer/chips/microchip8/pic12f508dip8.py
new file mode 100644
index 0000000..2779b58
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic12f508dip8.py
@@ -0,0 +1,67 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC12F508 DIP8
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_singlePMarea import *
+
+class Chip_Pic12F508dip8(microchip8_singlePMarea):
+
+ logicalFlashSize = 0x400
+
+ def __init__(self):
+ microchip8_singlePMarea.__init__(self,
+ chipPackage="DIP8",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=8,
+ signature="",
+ flashPageSize=0x200,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=2
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0] 00=LP, 01=XT, 10=INTOSC, 11=EXTRC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "WDTE"),
+ BitDescription(3, "!CP"),
+ BitDescription(4, "MCLRE"),
+ BitDescription(5, "Unused"),
+ BitDescription(6, "Unused"),
+ BitDescription(7, "Unused"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "Unused"),
+ BitDescription(10, "Unused"),
+ BitDescription(11, "Unused"),
+)
+ChipDescription(
+ Chip_Pic12F508dip8,
+ bitfile="microchip01dip8",
+ chipID="pic12f508dip8",
+ runtimeID=(0xDE02, 0x01),
+ chipVendors="Microchip",
+ description="PIC12F508",
+ fuseDesc=fuseDesc,
+ packages=(("DIP8", ""),),
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic12f629dip8.py b/libtoprammer/chips/microchip8/pic12f629dip8.py
new file mode 100644
index 0000000..efbb6c3
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic12f629dip8.py
@@ -0,0 +1,81 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC12F629 DIP8
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea import *
+
+class Chip_Pic12F629dip8(microchip8_splittedPMarea):
+ voltageVDD = 5
+ voltageVPP = 9
+
+ userIDLocationSize = 4
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ CMD_BEGIN_INTERNALLY_TIMED_PROGRAMMING = 0x08
+ delayTinternalProgPM = 0.002
+ delayTinternalProgDM = 0.005
+
+ def __init__(self):
+ microchip8_splittedPMarea.__init__(self,
+ chipPackage="DIP8",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=8,
+ signature="\xCB\x0F",
+ flashPageSize=0x400, # 1024 words
+ flashPages=1,
+ eepromPageSize=128,
+ eepromPages=1,
+ fuseBytes=2
+ )
+ self.configWordAddr = 0x2007
+ self.osccalAddr = self.flashPageSize - 1
+ # self.configWordByteAddressRange = self.configWordByteAddressRange.append((2*0xFFF, 2*0xFFF+1))
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE, 0=WDT disabled, 1=WDT enabled"),
+ BitDescription(4, "nPWRTE"),
+ BitDescription(5, "MCLRE"),
+ BitDescription(6, "BODEN, 0=BOD disabled"),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "Unused"),
+ BitDescription(10, "Unused"),
+ BitDescription(11, "Unused"),
+ BitDescription(12, "BG[0], Band Gap Calibration bits, 00 = Lowest band gap voltage"),
+ BitDescription(13, "BG[1]"),
+)
+
+ChipDescription(
+ Chip_Pic12F629dip8,
+ bitfile="microchip01dip8",
+ chipID="pic12F629dip8",
+ runtimeID=(0xDE02, 0x01),
+ chipVendors="Microchip",
+ description="PIC12F629, PIC12F675",
+ packages=(("DIP8", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1823dip14.py b/libtoprammer/chips/microchip8/pic16f1823dip14.py
new file mode 100644
index 0000000..c33f4f0
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1823dip14.py
@@ -0,0 +1,91 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1823 DIP14
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1823dip14(microchip8_splittedPMarea_hasResetPC):
+
+ rowSize = 32
+ nLatches = 32
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP14",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=14,
+ signature="\x43\x27",
+ flashPageSize=0x0800,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_Pic16F1823dip14,
+ bitfile="microchip01dip14dip20",
+ chipID="pic16f1823dip14",
+ runtimeID=(0xDE03, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1823, PIC16LF1823",
+ packages=(("DIP14", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1824dip14.py b/libtoprammer/chips/microchip8/pic16f1824dip14.py
new file mode 100644
index 0000000..1eac356
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1824dip14.py
@@ -0,0 +1,90 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1824 DIP14
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1824dip14(microchip8_splittedPMarea_hasResetPC):
+
+ nLatches = 32
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP14",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=14,
+ signature="\x43\x27",
+ flashPageSize=0x1000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_Pic16F1824dip14,
+ bitfile="microchip01dip14dip20",
+ chipID="pic16f1824dip14",
+ runtimeID=(0xDE03, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1824, PIC16LF1824",
+ packages=(("DIP14", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1825dip14.py b/libtoprammer/chips/microchip8/pic16f1825dip14.py
new file mode 100644
index 0000000..814161e
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1825dip14.py
@@ -0,0 +1,88 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1825 DIP14
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1825dip14(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP14",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=14,
+ signature="\x43\x27",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_Pic16F1825dip14,
+ bitfile="microchip01dip14dip20",
+ chipID="pic16f1825dip14",
+ runtimeID=(0xDE03, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1825, PIC16LF1825",
+ packages=(("DIP14", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1826dip18.py b/libtoprammer/chips/microchip8/pic16f1826dip18.py
new file mode 100644
index 0000000..73a2a5b
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1826dip18.py
@@ -0,0 +1,88 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1826 DIP18
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_PIC16F1826dip18(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP18",
+ chipPinVCC=14,
+ chipPinsVPP=4,
+ chipPinGND=5,
+ signature="\x43\x27",
+ flashPageSize=0x800,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_PIC16F1826dip18,
+ bitfile="microchip01dip18",
+ chipID="PIC16F1826dip18",
+ runtimeID=(0xDE04, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1826, PIC16LF1826",
+ packages=(("DIP18", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1827dip18.py b/libtoprammer/chips/microchip8/pic16f1827dip18.py
new file mode 100644
index 0000000..316fafa
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1827dip18.py
@@ -0,0 +1,88 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1827 dip18
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1827dip18(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP18",
+ chipPinVCC=14,
+ chipPinsVPP=4,
+ chipPinGND=5,
+ signature="\x43\x27",
+ flashPageSize=0x1000, # 4kWords
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_Pic16F1827dip18,
+ bitfile="microchip01dip18",
+ chipID="pic16f1827dip18",
+ runtimeID=(0xDE04, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1827, PIC16LF1827",
+ packages=(("dip18", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1828dip20.py b/libtoprammer/chips/microchip8/pic16f1828dip20.py
new file mode 100644
index 0000000..ac061bb
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1828dip20.py
@@ -0,0 +1,88 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1828 DIP20
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1828dip14(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP20",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=20,
+ signature="\x43\x27",
+ flashPageSize=0x1000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_Pic16F1828dip14,
+ bitfile="microchip01dip14dip20",
+ chipID="pic16f1828dip14",
+ runtimeID=(0xDE03, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1828, PIC16LF1828",
+ packages=(("DIP20", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1829dip20.py b/libtoprammer/chips/microchip8/pic16f1829dip20.py
new file mode 100644
index 0000000..7bcfd30
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1829dip20.py
@@ -0,0 +1,88 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1829 DIP14
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1829dip14(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="DIP20",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=20,
+ signature="\x43\x27",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+)
+
+ChipDescription(
+ Chip_Pic16F1829dip14,
+ bitfile="microchip01dip14dip20",
+ chipID="pic16f1829dip20",
+ runtimeID=(0xDE03, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1829, PIC16LF1829",
+ packages=(("DIP20", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1933dip28.py b/libtoprammer/chips/microchip8/pic16f1933dip28.py
new file mode 100644
index 0000000..77dc828
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1933dip28.py
@@ -0,0 +1,90 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1933 dip28
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1933dip28(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x68\x23",
+ flashPageSize=0x1000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 000=LP, 001=XT, 010=HS, 011=EXTRC"),
+ BitDescription(1, "FOSC[1], 100=INTOSC, 101=ECL - Low power mode"),
+ BitDescription(2, "FOSC[2], 110=ECM - Medium power mode, 111=ECH - High power mode"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "VCAPEN[0] - only for PIC16F193x, 00=Vcap enabled on RA0"),
+ BitDescription(21, "VCAPEN[1], 01=Vcap enabled on RA5, 10=Vcap enabled on RA6, 11=disabled "),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV, 1=Brown-out Reset voltage set to 1.9V"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16F1933dip28,
+ bitfile="microchip01dip28",
+ chipID="pic16f1933dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1933",
+ packages=(("dip28", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1934dip40.py b/libtoprammer/chips/microchip8/pic16f1934dip40.py
new file mode 100644
index 0000000..0af8d29
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1934dip40.py
@@ -0,0 +1,90 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1934 dip40
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1934dip40(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip40",
+ chipPinVCC=32,
+ chipPinsVPP=1,
+ chipPinGND=31,
+ signature="\x68\x23",
+ flashPageSize=0x1000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 000=LP, 001=XT, 010=HS, 011=EXTRC"),
+ BitDescription(1, "FOSC[1], 100=INTOSC, 101=ECL - Low power mode"),
+ BitDescription(2, "FOSC[2], 110=ECM - Medium power mode, 111=ECH - High power mode"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "VCAPEN[0] - only for PIC16F193x, 00=Vcap enabled on RA0"),
+ BitDescription(21, "VCAPEN[1], 01=Vcap enabled on RA5, 10=Vcap enabled on RA6, 11=disabled "),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV, 1=Brown-out Reset voltage set to 1.9V"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16F1934dip40,
+ bitfile="microchip01dip40",
+ chipID="pic16f1934dip40",
+ runtimeID=(0xDE08, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1934",
+ packages=(("dip40", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1936dip28.py b/libtoprammer/chips/microchip8/pic16f1936dip28.py
new file mode 100644
index 0000000..dee716b
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1936dip28.py
@@ -0,0 +1,90 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1936 dip28
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1936dip28(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x68\x23",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 000=LP, 001=XT, 010=HS, 011=EXTRC"),
+ BitDescription(1, "FOSC[1], 100=INTOSC, 101=ECL - Low power mode"),
+ BitDescription(2, "FOSC[2], 110=ECM - Medium power mode, 111=ECH - High power mode"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "VCAPEN[0] - only for PIC16F193x, 00=Vcap enabled on RA0"),
+ BitDescription(21, "VCAPEN[1], 01=Vcap enabled on RA5, 10=Vcap enabled on RA6, 11=disabled "),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV, 1=Brown-out Reset voltage set to 1.9V"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16F1936dip28,
+ bitfile="microchip01dip28",
+ chipID="pic16f1936dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1936",
+ packages=(("dip28", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1937dip40.py b/libtoprammer/chips/microchip8/pic16f1937dip40.py
new file mode 100644
index 0000000..fc86ffb
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1937dip40.py
@@ -0,0 +1,90 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1937 dip40
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1937dip40(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip40",
+ chipPinVCC=32,
+ chipPinsVPP=1,
+ chipPinGND=31,
+ signature="\x68\x23",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 000=LP, 001=XT, 010=HS, 011=EXTRC"),
+ BitDescription(1, "FOSC[1], 100=INTOSC, 101=ECL - Low power mode"),
+ BitDescription(2, "FOSC[2], 110=ECM - Medium power mode, 111=ECH - High power mode"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "VCAPEN[0] - only for PIC16F193x, 00=Vcap enabled on RA0"),
+ BitDescription(21, "VCAPEN[1], 01=Vcap enabled on RA5, 10=Vcap enabled on RA6, 11=disabled "),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV, 1=Brown-out Reset voltage set to 1.9V"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16F1937dip40,
+ bitfile="microchip01dip40",
+ chipID="pic16f1937dip40",
+ runtimeID=(0xDE08, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1937",
+ packages=(("dip40", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1938dip28.py b/libtoprammer/chips/microchip8/pic16f1938dip28.py
new file mode 100644
index 0000000..9b2af00
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1938dip28.py
@@ -0,0 +1,90 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1938 dip28
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1938dip28(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x68\x23",
+ flashPageSize=0x4000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 000=LP, 001=XT, 010=HS, 011=EXTRC"),
+ BitDescription(1, "FOSC[1], 100=INTOSC, 101=ECL - Low power mode"),
+ BitDescription(2, "FOSC[2], 110=ECM - Medium power mode, 111=ECH - High power mode"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "VCAPEN[0] - only for PIC16F193x, 00=Vcap enabled on RA0"),
+ BitDescription(21, "VCAPEN[1], 01=Vcap enabled on RA5, 10=Vcap enabled on RA6, 11=disabled "),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV, 1=Brown-out Reset voltage set to 1.9V"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16F1938dip28,
+ bitfile="microchip01dip28",
+ chipID="pic16f1938dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1938",
+ packages=(("dip28", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f1939dip40.py b/libtoprammer/chips/microchip8/pic16f1939dip40.py
new file mode 100644
index 0000000..c94bb65
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f1939dip40.py
@@ -0,0 +1,90 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F1939 dip40
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16F1939dip40(microchip8_splittedPMarea_hasResetPC):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip40",
+ chipPinVCC=32,
+ chipPinsVPP=1,
+ chipPinGND=31,
+ signature="\x68\x23",
+ flashPageSize=0x4000,
+ flashPages=1,
+ eepromPageSize=256,
+ eepromPages=1,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 000=LP, 001=XT, 010=HS, 011=EXTRC"),
+ BitDescription(1, "FOSC[1], 100=INTOSC, 101=ECL - Low power mode"),
+ BitDescription(2, "FOSC[2], 110=ECM - Medium power mode, 111=ECH - High power mode"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(13, "FCMEM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "VCAPEN[0] - only for PIC16F193x, 00=Vcap enabled on RA0"),
+ BitDescription(21, "VCAPEN[1], 01=Vcap enabled on RA5, 10=Vcap enabled on RA6, 11=disabled "),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "PLLEN, 0=4xPLL disabled"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV, 1=Brown-out Reset voltage set to 1.9V"),
+ BitDescription(27, "Unused"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16F1939dip40,
+ bitfile="microchip01dip40",
+ chipID="pic16f1939dip40",
+ runtimeID=(0xDE08, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F1939",
+ packages=(("dip40", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f59dip40.py b/libtoprammer/chips/microchip8/pic16f59dip40.py
new file mode 100644
index 0000000..a575a7b
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f59dip40.py
@@ -0,0 +1,70 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F59 SIP6
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_singlePMarea import *
+
+
+class Chip_Pic16F59dip40(microchip8_singlePMarea):
+
+ logicalFlashSize = 0x1000
+
+
+ def __init__(self):
+ microchip8_singlePMarea.__init__(self,
+ chipPackage="DIP40",
+ chipPinVCC=15,
+ chipPinsVPP=14,
+ chipPinGND=5,
+ signature="",
+ flashPageSize=0x200,
+ flashPages=4,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=2
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC0"),
+ BitDescription(1, "FOSC1 - 00=LP, 01=XT, 10=HS, 11=RC"),
+ BitDescription(2, "WDTE"),
+ BitDescription(3, "!CP"),
+ BitDescription(4, "Unused"),
+ BitDescription(5, "Unused"),
+ BitDescription(6, "Unused"),
+ BitDescription(7, "Unused"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "Unused"),
+ BitDescription(10, "Unused"),
+ BitDescription(11, "Unused"),
+)
+
+ChipDescription(
+ Chip_Pic16F59dip40,
+ bitfile="microchip01dip40",
+ chipID="pic16f59dip40",
+ runtimeID=(0xDE06, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F59",
+ packages=(("DIP40", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f630dip14.py b/libtoprammer/chips/microchip8/pic16f630dip14.py
new file mode 100644
index 0000000..32f6c73
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f630dip14.py
@@ -0,0 +1,81 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F630 DIP14
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea import *
+
+class Chip_Pic16F630dip14(microchip8_splittedPMarea):
+ voltageVDD = 5
+ voltageVPP = 9
+
+ userIDLocationSize = 4
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ CMD_BEGIN_INTERNALLY_TIMED_PROGRAMMING = 0x08
+ delayTinternalProgPM = 0.002
+ delayTinternalProgDM = 0.005
+
+ def __init__(self):
+ microchip8_splittedPMarea.__init__(self,
+ chipPackage="DIP14",
+ chipPinVCC=1,
+ chipPinsVPP=4,
+ chipPinGND=14,
+ signature="\x08\x27",
+ flashPageSize=0x400, # 1024 words
+ flashPages=1,
+ eepromPageSize=128,
+ eepromPages=1,
+ fuseBytes=2
+ )
+ self.configWordAddr = 0x2007
+ self.osccalAddr = self.flashPageSize - 1
+ # self.configWordByteAddressRange = self.configWordByteAddressRange.append((2*0xFFF, 2*0xFFF+1))
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "FOSC[2]"),
+ BitDescription(3, "WDTE, 0=WDT disabled, 1=WDT enabled"),
+ BitDescription(4, "nPWRTE"),
+ BitDescription(5, "MCLRE"),
+ BitDescription(6, "BODEN, 0=BOD disabled"),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "nCPD, 1=data memory code protection is disabled"),
+ BitDescription(9, "Unused"),
+ BitDescription(10, "Unused"),
+ BitDescription(11, "Unused"),
+ BitDescription(12, "BG[0], Band Gap Calibration bits, 00 = Lowest band gap voltage"),
+ BitDescription(13, "BG[1]"),
+)
+
+ChipDescription(
+ Chip_Pic16F630dip14,
+ bitfile="microchip01dip14dip20",
+ chipID="pic16F630dip14",
+ runtimeID=(0xDE03, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F630, PIC16F676",
+ packages=(("DIP14", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16f84adip18.py b/libtoprammer/chips/microchip8/pic16f84adip18.py
new file mode 100644
index 0000000..c89b503
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16f84adip18.py
@@ -0,0 +1,97 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16F84 DIP18
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea import *
+
+class Chip_Pic16F84adip18(microchip8_splittedPMarea):
+ CMD_BEGIN_ERASE_PROGRAMMING_CYCLE = 0x8
+ CMD_BEGIN_PROGRAMMING_ONLY_CYCLE = 0x18
+
+ voltageVDD = 5
+ voltageVPP = 13
+
+ delayTinternalProgPM = 0.004
+
+ userIDLocationSize = 4
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ def __init__(self):
+ microchip8_splittedPMarea.__init__(self,
+ chipPackage="DIP18",
+ chipPinVCC=14,
+ chipPinsVPP=4,
+ chipPinGND=5,
+ signature="\x60\x05",
+ flashPageSize=0x200,
+ flashPages=1,
+ eepromPageSize=64,
+ eepromPages=1,
+ fuseBytes=2
+ )
+
+ def sendWriteFlashInstr(self):
+ '''
+ '''
+ self.sendCommand(0, 0, 0, self.CMD_BEGIN_PROGRAMMING_ONLY_CYCLE)
+ self.top.cmdDelay(self.delayTinternalProgDM)
+
+ def sendWriteFlashInstrDM(self):
+ self.sendWriteFlashInstr()
+
+ def bulkErasePGM(self):
+ self.sendCommand(0, 0, 0, self.CMD_BULK_ERASE_PGM)
+ self.sendCommand(0, 0, 0, self.CMD_BEGIN_PROGRAMMING_ONLY_CYCLE)
+ self.top.cmdDelay(self.delayTera) # Tera
+
+ def bulkEraseDM(self):
+ self.sendCommand(0, 0, 0, self.CMD_BULK_ERASE_DM)
+ self.sendCommand(0, 0, 0, self.CMD_BEGIN_PROGRAMMING_ONLY_CYCLE)
+ self.top.cmdDelay(self.delayTera) # Tera
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 00=LP osc, 01=XT osc"),
+ BitDescription(1, "FOSC[1], 10=HS osc, 11=RC osc"),
+ BitDescription(2, "WDTEN, 1=WDT enabled"),
+ BitDescription(3, "nPWRT"),
+ BitDescription(4, "nCP"),
+ BitDescription(5, "nCP"),
+ BitDescription(6, "nCP"),
+ BitDescription(7, "nCP"),
+ BitDescription(8, "nCP"),
+ BitDescription(9, "nCP"),
+ BitDescription(10, "nCP"),
+ BitDescription(11, "nCP"),
+ BitDescription(12, "nCP"),
+ BitDescription(13, "nCP"),
+)
+
+ChipDescription(
+ Chip_Pic16F84adip18,
+ bitfile="microchip01dip18",
+ chipID="pic16f84adip18",
+ runtimeID=(0xDE04, 0x01),
+ chipVendors="Microchip",
+ description="PIC16F84A, PIC16LF84A",
+ packages=(("DIP18", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16lf1902dip28.py b/libtoprammer/chips/microchip8/pic16lf1902dip28.py
new file mode 100644
index 0000000..d20ec7d
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16lf1902dip28.py
@@ -0,0 +1,87 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16LF1902 dip28
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16LF1902dip28(microchip8_splittedPMarea_hasResetPC):
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x22\x2c",
+ flashPageSize=0x800,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 00=INTOSC, 11=ECH - High power mode"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "Unused"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "Unused"),
+ BitDescription(13, "Unused"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "Unused"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "nULPBOR, 1= Ultra low-power BOR is disabled"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16LF1902dip28,
+ bitfile="microchip01dip28",
+ chipID="pic16lf1902dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC16LF1902",
+ packages=(("dip28", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16lf1903dip28.py b/libtoprammer/chips/microchip8/pic16lf1903dip28.py
new file mode 100644
index 0000000..b47961c
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16lf1903dip28.py
@@ -0,0 +1,87 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16LF1903 dip28
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16LF1903dip28(microchip8_splittedPMarea_hasResetPC):
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x22\x2c",
+ flashPageSize=0x1000,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 00=INTOSC, 11=ECH - High power mode"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "Unused"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "Unused"),
+ BitDescription(13, "Unused"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "Unused"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "nULPBOR, 1= Ultra low-power BOR is disabled"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16LF1903dip28,
+ bitfile="microchip01dip28",
+ chipID="pic16lf1903dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC16LF1903",
+ packages=(("dip28", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16lf1904dip40.py b/libtoprammer/chips/microchip8/pic16lf1904dip40.py
new file mode 100644
index 0000000..88b0f1d
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16lf1904dip40.py
@@ -0,0 +1,87 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16LF1904 dip40
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16LF1904dip40(microchip8_splittedPMarea_hasResetPC):
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip40",
+ chipPinVCC=32,
+ chipPinsVPP=1,
+ chipPinGND=31,
+ signature="\x81\x2c",
+ flashPageSize=0x1000,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 00=INTOSC, 11=ECH - High power mode"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "Unused"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "Unused"),
+ BitDescription(13, "Unused"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "Unused"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "nULPBOR, 1= Ultra low-power BOR is disabled"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16LF1904dip40,
+ bitfile="microchip01dip40a",
+ chipID="pic16lf1904dip40",
+ runtimeID=(0xDE08, 0x01),
+ chipVendors="Microchip",
+ description="PIC16LF1904",
+ packages=(("dip40", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16lf1906dip28.py b/libtoprammer/chips/microchip8/pic16lf1906dip28.py
new file mode 100644
index 0000000..451acd5
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16lf1906dip28.py
@@ -0,0 +1,87 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16LF1906 dip28
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16LF1906dip28(microchip8_splittedPMarea_hasResetPC):
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x22\x2c",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 00=INTOSC, 11=ECH - High power mode"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "Unused"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "Unused"),
+ BitDescription(13, "Unused"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "Unused"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "nULPBOR, 1= Ultra low-power BOR is disabled"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16LF1906dip28,
+ bitfile="microchip01dip28",
+ chipID="pic16lf1906dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC16LF1906",
+ packages=(("dip28", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic16lf1907dip40.py b/libtoprammer/chips/microchip8/pic16lf1907dip40.py
new file mode 100644
index 0000000..210bd07
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic16lf1907dip40.py
@@ -0,0 +1,87 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC16LF1907dip40
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_splittedPMarea_hasResetPC import *
+
+class Chip_Pic16LF1907dip40(microchip8_splittedPMarea_hasResetPC):
+
+ def __init__(self):
+ microchip8_splittedPMarea_hasResetPC.__init__(self,
+ chipPackage="dip40",
+ chipPinVCC=32,
+ chipPinsVPP=1,
+ chipPinGND=31,
+ signature="\x81\x2c",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=0,
+ eepromPages=0,
+ fuseBytes=4
+ )
+
+fuseDesc = (
+ BitDescription(0, "FOSC[0], 00=INTOSC, 11=ECH - High power mode"),
+ BitDescription(1, "FOSC[1]"),
+ BitDescription(2, "Unused"),
+ BitDescription(3, "WDTE[0], 00=WDT disabled, 11=WDT enabled"),
+ BitDescription(4, "WDTE[1]"),
+ BitDescription(5, "nPWRTE"),
+ BitDescription(6, "MCLRE, 1=nMCLR/Vpp pin is nMCLR, weak pull-up enabled, ignored if LVP=1 "),
+ BitDescription(7, "nCP 1=program memory code protection is disabled"),
+ BitDescription(8, "Unused"),
+ BitDescription(9, "BOREN[0], 00=BOR disabled"),
+ BitDescription(10, "BOREN[1]"),
+ BitDescription(11, "nCLKOUTEN, 0=CLKOUT is enabled on CLKOUT pin"),
+ BitDescription(12, "Unused"),
+ BitDescription(13, "Unused"),
+ BitDescription(14, "NA"),
+ BitDescription(15, "NA"),
+
+ BitDescription(16, "WRT[0], 11=Write protection off"),
+ BitDescription(17, "WRT[1]"),
+ BitDescription(18, "Unused"),
+ BitDescription(19, "Unused"),
+ BitDescription(20, "Unused"),
+ BitDescription(21, "Unused"),
+ BitDescription(22, "Unused"),
+ BitDescription(23, "Unused"),
+ BitDescription(24, "Unused"),
+ BitDescription(25, "STVREN, 1=Stack overflow or underflow will cause a reset"),
+ BitDescription(26, "BORV"),
+ BitDescription(27, "nULPBOR, 1= Ultra low-power BOR is disabled"),
+ BitDescription(28, "nDEBUG, 0=ICSPCLK and ICSPDAT are dedicated to the debugger"),
+ BitDescription(29, "LVP 1=Low-voltage programming enabled"),
+ BitDescription(30, "NA"),
+ BitDescription(31, "NA"),
+)
+
+ChipDescription(
+ Chip_Pic16LF1907dip40,
+ bitfile="microchip01dip40a",
+ chipID="pic16lf1907dip40",
+ runtimeID=(0xDE08, 0x01),
+ chipVendors="Microchip",
+ description="PIC16LF1907",
+ packages=(("dip40", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic18f1220dip18.py b/libtoprammer/chips/microchip8/pic18f1220dip18.py
new file mode 100644
index 0000000..dff6fe4
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic18f1220dip18.py
@@ -0,0 +1,179 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC18F1220 DIP18
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_18f1220family import *
+
+class Chip_PIC18F1220dip18(microchip8_18f1220family):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ writeBufferSize = 8
+ eraseBufferSize = 64
+
+ def __init__(self):
+ microchip8_18f1220family.__init__(self,
+ chipPackage="DIP18",
+ chipPinVCC=14,
+ chipPinsVPP=4,
+ chipPinGND=5,
+ signature="\xE7\x07",
+ flashPageSize=0x1000,
+ flashPages=1,
+ eepromPageSize=0x100,
+ eepromPages=1,
+ fuseBytes=14
+ )
+
+
+fuseDesc = (
+ BitDescription(0o00, "NA"),
+ BitDescription(0o01, "NA"),
+ BitDescription(0o02, "NA"),
+ BitDescription(0o03, "NA"),
+ BitDescription(0o04, "NA"),
+ BitDescription(0o05, "NA"),
+ BitDescription(0o06, "NA"),
+ BitDescription(0o07, "NA"),
+ BitDescription(0o10, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(0o11, "FOSC[1]"),
+ BitDescription(0o12, "FOSC[2]"),
+ BitDescription(0o13, "FOSC[3]"),
+ BitDescription(0o14, "NA"),
+ BitDescription(0o15, "NA"),
+ BitDescription(0o16, "FSCM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(0o17, "IESO, 0=Internal/External Switchover mode is disabled"),
+
+ BitDescription(0o20, "nPWRT"),
+ BitDescription(0o21, "BOR"),
+ BitDescription(0o22, "BORV[0]"),
+ BitDescription(0o23, "BORV[1]"),
+ BitDescription(0o24, "NA"),
+ BitDescription(0o25, "NA"),
+ BitDescription(0o26, "NA"),
+ BitDescription(0o27, "NA"),
+ BitDescription(0o30, "WDT, 0=WDT disabled, 1=WDT enabled"),
+ BitDescription(0o31, "WDTPS[0]"),
+ BitDescription(0o32, "WDTPS[1]"),
+ BitDescription(0o33, "WDTPS[2]"),
+ BitDescription(0o34, "WDTPS[3]"),
+ BitDescription(0o35, "NA"),
+ BitDescription(0o36, "NA"),
+ BitDescription(0o37, "NA"),
+
+ BitDescription(0o40, "NA"),
+ BitDescription(0o41, "NA"),
+ BitDescription(0o42, "NA"),
+ BitDescription(0o43, "NA"),
+ BitDescription(0o44, "NA"),
+ BitDescription(0o45, "NA"),
+ BitDescription(0o46, "NA"),
+ BitDescription(0o47, "NA"),
+ BitDescription(0o50, "NA"),
+ BitDescription(0o51, "NA"),
+ BitDescription(0o52, "NA"),
+ BitDescription(0o53, "NA"),
+ BitDescription(0o54, "NA"),
+ BitDescription(0o55, "NA"),
+ BitDescription(0o56, "NA"),
+ BitDescription(0o57, "MCLRE"),
+
+ BitDescription(0o60, "STVR"),
+ BitDescription(0o61, "NA"),
+ BitDescription(0o62, "LVP"),
+ BitDescription(0o63, "NA"),
+ BitDescription(0o64, "NA"),
+ BitDescription(0o65, "NA"),
+ BitDescription(0o66, "NA"),
+ BitDescription(0o67, "nDEBUG"),
+ BitDescription(0o70, "NA"),
+ BitDescription(0o71, "NA"),
+ BitDescription(0o72, "NA"),
+ BitDescription(0o73, "NA"),
+ BitDescription(0o74, "NA"),
+ BitDescription(0o75, "NA"),
+ BitDescription(0o76, "NA"),
+ BitDescription(0o77, "NA"),
+
+ BitDescription(0o100, "CP[0]"),
+ BitDescription(0o101, "CP[1]"),
+ BitDescription(0o102, "NA"),
+ BitDescription(0o103, "NA"),
+ BitDescription(0o104, "NA"),
+ BitDescription(0o105, "NA"),
+ BitDescription(0o106, "NA"),
+ BitDescription(0o107, "NA"),
+ BitDescription(0o110, "NA"),
+ BitDescription(0o111, "NA"),
+ BitDescription(0o112, "NA"),
+ BitDescription(0o113, "NA"),
+ BitDescription(0o114, "NA"),
+ BitDescription(0o115, "NA"),
+ BitDescription(0o116, "CPB"),
+ BitDescription(0o117, "CPD"),
+
+ BitDescription(0o120, "WRT[0]"),
+ BitDescription(0o121, "WRT[1]"),
+ BitDescription(0o122, "NA"),
+ BitDescription(0o123, "NA"),
+ BitDescription(0o124, "NA"),
+ BitDescription(0o125, "NA"),
+ BitDescription(0o126, "NA"),
+ BitDescription(0o127, "NA"),
+ BitDescription(0o130, "NA"),
+ BitDescription(0o131, "NA"),
+ BitDescription(0o132, "NA"),
+ BitDescription(0o133, "NA"),
+ BitDescription(0o134, "NA"),
+ BitDescription(0o135, "WRTC"),
+ BitDescription(0o136, "WRTB"),
+ BitDescription(0o137, "WRTD"),
+
+ BitDescription(0o140, "EBTR[0]"),
+ BitDescription(0o141, "EBTR[1]"),
+ BitDescription(0o142, "NA"),
+ BitDescription(0o143, "NA"),
+ BitDescription(0o144, "NA"),
+ BitDescription(0o145, "NA"),
+ BitDescription(0o146, "NA"),
+ BitDescription(0o147, "NA"),
+ BitDescription(0o150, "NA"),
+ BitDescription(0o151, "NA"),
+ BitDescription(0o152, "NA"),
+ BitDescription(0o153, "NA"),
+ BitDescription(0o154, "NA"),
+ BitDescription(0o155, "NA"),
+ BitDescription(0o156, "EBTRB"),
+ BitDescription(0o157, "NA"),
+)
+
+ChipDescription(
+ Chip_PIC18F1220dip18,
+ bitfile="microchip01dip18",
+ chipID="PIC18F1220dip18",
+ runtimeID=(0xDE04, 0x01),
+ chipVendors="Microchip",
+ description="PIC18F1220",
+ packages=(("DIP18", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic18f2320dip28.py b/libtoprammer/chips/microchip8/pic18f2320dip28.py
new file mode 100644
index 0000000..5314130
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic18f2320dip28.py
@@ -0,0 +1,179 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC18F2320 DIP18
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_18f1220family import *
+
+class Chip_PIC18F2320dip28(microchip8_18f1220family):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ writeBufferSize = 8
+ eraseBufferSize = 64
+
+ def __init__(self):
+ microchip8_18f1220family.__init__(self,
+ chipPackage="DIP28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x80\x05",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=0x100,
+ eepromPages=1,
+ fuseBytes=14
+ )
+
+
+fuseDesc = (
+ BitDescription(0o00, "NA"),
+ BitDescription(0o01, "NA"),
+ BitDescription(0o02, "NA"),
+ BitDescription(0o03, "NA"),
+ BitDescription(0o04, "NA"),
+ BitDescription(0o05, "NA"),
+ BitDescription(0o06, "NA"),
+ BitDescription(0o07, "NA"),
+ BitDescription(0o10, "FOSC[0], 0=LP, 100=INTOSC"),
+ BitDescription(0o11, "FOSC[1]"),
+ BitDescription(0o12, "FOSC[2]"),
+ BitDescription(0o13, "FOSC[3]"),
+ BitDescription(0o14, "NA"),
+ BitDescription(0o15, "NA"),
+ BitDescription(0o16, "FSCM, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(0o17, "IESO, 0=Internal/External Switchover mode is disabled"),
+
+ BitDescription(0o20, "nPWRT"),
+ BitDescription(0o21, "BOR"),
+ BitDescription(0o22, "BORV[0]"),
+ BitDescription(0o23, "BORV[1]"),
+ BitDescription(0o24, "NA"),
+ BitDescription(0o25, "NA"),
+ BitDescription(0o26, "NA"),
+ BitDescription(0o27, "NA"),
+ BitDescription(0o30, "WDT, 0=WDT disabled, 1=WDT enabled"),
+ BitDescription(0o31, "WDTPS[0]"),
+ BitDescription(0o32, "WDTPS[1]"),
+ BitDescription(0o33, "WDTPS[2]"),
+ BitDescription(0o34, "WDTPS[3]"),
+ BitDescription(0o35, "NA"),
+ BitDescription(0o36, "NA"),
+ BitDescription(0o37, "NA"),
+
+ BitDescription(0o40, "NA"),
+ BitDescription(0o41, "NA"),
+ BitDescription(0o42, "NA"),
+ BitDescription(0o43, "NA"),
+ BitDescription(0o44, "NA"),
+ BitDescription(0o45, "NA"),
+ BitDescription(0o46, "NA"),
+ BitDescription(0o47, "NA"),
+ BitDescription(0o50, "NA"),
+ BitDescription(0o51, "NA"),
+ BitDescription(0o52, "NA"),
+ BitDescription(0o53, "NA"),
+ BitDescription(0o54, "NA"),
+ BitDescription(0o55, "NA"),
+ BitDescription(0o56, "NA"),
+ BitDescription(0o57, "MCLRE"),
+
+ BitDescription(0o60, "STVR"),
+ BitDescription(0o61, "NA"),
+ BitDescription(0o62, "LVP"),
+ BitDescription(0o63, "NA"),
+ BitDescription(0o64, "NA"),
+ BitDescription(0o65, "NA"),
+ BitDescription(0o66, "NA"),
+ BitDescription(0o67, "nDEBUG"),
+ BitDescription(0o70, "NA"),
+ BitDescription(0o71, "NA"),
+ BitDescription(0o72, "NA"),
+ BitDescription(0o73, "NA"),
+ BitDescription(0o74, "NA"),
+ BitDescription(0o75, "NA"),
+ BitDescription(0o76, "NA"),
+ BitDescription(0o77, "NA"),
+
+ BitDescription(0o100, "CP[0]"),
+ BitDescription(0o101, "CP[1]"),
+ BitDescription(0o102, "CP[2]"),
+ BitDescription(0o103, "CP[3]"),
+ BitDescription(0o104, "NA"),
+ BitDescription(0o105, "NA"),
+ BitDescription(0o106, "NA"),
+ BitDescription(0o107, "NA"),
+ BitDescription(0o110, "NA"),
+ BitDescription(0o111, "NA"),
+ BitDescription(0o112, "NA"),
+ BitDescription(0o113, "NA"),
+ BitDescription(0o114, "NA"),
+ BitDescription(0o115, "NA"),
+ BitDescription(0o116, "CPB"),
+ BitDescription(0o117, "CPD"),
+
+ BitDescription(0o120, "WRT[0]"),
+ BitDescription(0o121, "WRT[1]"),
+ BitDescription(0o122, "NA"),
+ BitDescription(0o123, "NA"),
+ BitDescription(0o124, "NA"),
+ BitDescription(0o125, "NA"),
+ BitDescription(0o126, "NA"),
+ BitDescription(0o127, "NA"),
+ BitDescription(0o130, "NA"),
+ BitDescription(0o131, "NA"),
+ BitDescription(0o132, "NA"),
+ BitDescription(0o133, "NA"),
+ BitDescription(0o134, "NA"),
+ BitDescription(0o135, "WRTC"),
+ BitDescription(0o136, "WRTB"),
+ BitDescription(0o137, "WRTD"),
+
+ BitDescription(0o140, "EBTR[0]"),
+ BitDescription(0o141, "EBTR[1]"),
+ BitDescription(0o142, "NA"),
+ BitDescription(0o143, "NA"),
+ BitDescription(0o144, "NA"),
+ BitDescription(0o145, "NA"),
+ BitDescription(0o146, "NA"),
+ BitDescription(0o147, "NA"),
+ BitDescription(0o150, "NA"),
+ BitDescription(0o151, "NA"),
+ BitDescription(0o152, "NA"),
+ BitDescription(0o153, "NA"),
+ BitDescription(0o154, "NA"),
+ BitDescription(0o155, "NA"),
+ BitDescription(0o156, "EBTRB"),
+ BitDescription(0o157, "NA"),
+)
+
+ChipDescription(
+ Chip_PIC18F2320dip28,
+ bitfile="microchip01dip28",
+ chipID="PIC18F2320dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC18F2320",
+ packages=(("DIP18", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic18f2321dip28.py b/libtoprammer/chips/microchip8/pic18f2321dip28.py
new file mode 100644
index 0000000..2f66b8c
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic18f2321dip28.py
@@ -0,0 +1,179 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC18F2320 DIP18
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_18f2221family import *
+
+class Chip_PIC18F2321dip28(microchip8_18f2221family):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ writeBufferSize = 8
+ eraseBufferSize = 64
+
+ def __init__(self):
+ microchip8_18f2221family.__init__(self,
+ chipPackage="DIP28",
+ chipPinVCC=20,
+ chipPinsVPP=1,
+ chipPinGND=19,
+ signature="\x22\x21",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=0x100,
+ eepromPages=1,
+ fuseBytes=14
+ )
+
+
+fuseDesc = (
+ BitDescription(0o00, "NA"),
+ BitDescription(0o01, "NA"),
+ BitDescription(0o02, "NA"),
+ BitDescription(0o03, "NA"),
+ BitDescription(0o04, "NA"),
+ BitDescription(0o05, "NA"),
+ BitDescription(0o06, "NA"),
+ BitDescription(0o07, "NA"),
+ BitDescription(0o10, "FOSC[0], 0000=LP, 1000=internal RC oscillator, RA6=CLKO"),
+ BitDescription(0o11, "FOSC[1]"),
+ BitDescription(0o12, "FOSC[2]"),
+ BitDescription(0o13, "FOSC[3]"),
+ BitDescription(0o14, "NA"),
+ BitDescription(0o15, "NA"),
+ BitDescription(0o16, "FCMEN, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(0o17, "IESO, 0=Internal/External Switchover mode is disabled"),
+
+ BitDescription(0o20, "nPWRTEN"),
+ BitDescription(0o21, "BOREN[0]"),
+ BitDescription(0o22, "BOREN[1]"),
+ BitDescription(0o23, "BORV[0]"),
+ BitDescription(0o24, "BORV[1]"),
+ BitDescription(0o25, "NA"),
+ BitDescription(0o26, "NA"),
+ BitDescription(0o27, "NA"),
+ BitDescription(0o30, "WDTEN, 0=WDT disabled, 1=WDT enabled"),
+ BitDescription(0o31, "WDTPS[0]"),
+ BitDescription(0o32, "WDTPS[1]"),
+ BitDescription(0o33, "WDTPS[2]"),
+ BitDescription(0o34, "WDTPS[3]"),
+ BitDescription(0o35, "NA"),
+ BitDescription(0o36, "NA"),
+ BitDescription(0o37, "NA"),
+
+ BitDescription(0o40, "NA"),
+ BitDescription(0o41, "NA"),
+ BitDescription(0o42, "NA"),
+ BitDescription(0o43, "NA"),
+ BitDescription(0o44, "NA"),
+ BitDescription(0o45, "NA"),
+ BitDescription(0o46, "NA"),
+ BitDescription(0o47, "NA"),
+ BitDescription(0o50, "NA"),
+ BitDescription(0o51, "PBADEN"),
+ BitDescription(0o52, "LPT1OSC"),
+ BitDescription(0o53, "NA"),
+ BitDescription(0o54, "NA"),
+ BitDescription(0o55, "NA"),
+ BitDescription(0o56, "NA"),
+ BitDescription(0o57, "MCLRE"),
+
+ BitDescription(0o60, "STVREN"),
+ BitDescription(0o61, "NA"),
+ BitDescription(0o62, "LVP"),
+ BitDescription(0o63, "NA"),
+ BitDescription(0o64, "BBSIZ[0]"),
+ BitDescription(0o65, "BBSIZ[1]"),
+ BitDescription(0o66, "XINST"),
+ BitDescription(0o67, "nDEBUG"),
+ BitDescription(0o70, "NA"),
+ BitDescription(0o71, "NA"),
+ BitDescription(0o72, "NA"),
+ BitDescription(0o73, "NA"),
+ BitDescription(0o74, "NA"),
+ BitDescription(0o75, "NA"),
+ BitDescription(0o76, "NA"),
+ BitDescription(0o77, "NA"),
+
+ BitDescription(0o100, "CP[0]"),
+ BitDescription(0o101, "CP[1]"),
+ BitDescription(0o102, "CP[2]/NA"),
+ BitDescription(0o103, "CP[3]/NA"),
+ BitDescription(0o104, "CP[4]/NA"),
+ BitDescription(0o105, "CP[5]/NA"),
+ BitDescription(0o106, "NA"),
+ BitDescription(0o107, "NA"),
+ BitDescription(0o110, "NA"),
+ BitDescription(0o111, "NA"),
+ BitDescription(0o112, "NA"),
+ BitDescription(0o113, "NA"),
+ BitDescription(0o114, "NA"),
+ BitDescription(0o115, "NA"),
+ BitDescription(0o116, "CPB"),
+ BitDescription(0o117, "CPD"),
+
+ BitDescription(0o120, "WRT[0]"),
+ BitDescription(0o121, "WRT[1]"),
+ BitDescription(0o122, "WRT[2]/NA"),
+ BitDescription(0o123, "WRT[3]/NA"),
+ BitDescription(0o124, "WRT[4]/NA"),
+ BitDescription(0o125, "WRT[5]/NA"),
+ BitDescription(0o126, "NA"),
+ BitDescription(0o127, "NA"),
+ BitDescription(0o130, "NA"),
+ BitDescription(0o131, "NA"),
+ BitDescription(0o132, "NA"),
+ BitDescription(0o133, "NA"),
+ BitDescription(0o134, "NA"),
+ BitDescription(0o135, "WRTC"),
+ BitDescription(0o136, "WRTB"),
+ BitDescription(0o137, "WRTD"),
+
+ BitDescription(0o140, "EBTR[0]"),
+ BitDescription(0o141, "EBTR[1]"),
+ BitDescription(0o142, "EBTR[2]/NA"),
+ BitDescription(0o143, "EBTR[3]/NA"),
+ BitDescription(0o144, "EBTR[4]/NA"),
+ BitDescription(0o145, "EBTR[5]/NA"),
+ BitDescription(0o146, "NA"),
+ BitDescription(0o147, "NA"),
+ BitDescription(0o150, "NA"),
+ BitDescription(0o151, "NA"),
+ BitDescription(0o152, "NA"),
+ BitDescription(0o153, "NA"),
+ BitDescription(0o154, "NA"),
+ BitDescription(0o155, "NA"),
+ BitDescription(0o156, "EBTRB"),
+ BitDescription(0o157, "NA"),
+)
+
+ChipDescription(
+ Chip_PIC18F2321dip28,
+ bitfile="microchip01dip28",
+ chipID="PIC18F2321dip28",
+ runtimeID=(0xDE07, 0x01),
+ chipVendors="Microchip",
+ description="PIC18F2321",
+ packages=(("DIP28", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/chips/microchip8/pic18f67j60sip6.py b/libtoprammer/chips/microchip8/pic18f67j60sip6.py
new file mode 100644
index 0000000..0c2791a
--- /dev/null
+++ b/libtoprammer/chips/microchip8/pic18f67j60sip6.py
@@ -0,0 +1,111 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# Microchip PIC18F67J60 SIP6
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from microchip8_18f97j60family import *
+
+class Chip_PIC18F67J60sip6(microchip8_18f97j60family):
+
+ SUPPORT_EEPROMREAD = (1 << 4)
+ SUPPORT_EEPROMWRITE = (1 << 5)
+
+ writeBufferSize = 8
+ eraseBufferSize = 64
+
+ def __init__(self):
+ microchip8_18f97j60family.__init__(self,
+ chipPackage="DIP10",
+ chipPinVCC=9,
+ chipPinsVPP=10,
+ chipPinGND=8,
+ signature="\x22\x21",
+ flashPageSize=0x2000,
+ flashPages=1,
+ eepromPageSize=0x100,
+ eepromPages=1,
+ fuseBytes=6
+ )
+
+
+fuseDesc = (
+ BitDescription(0o00, "WDTEN"),
+ BitDescription(0o01, "NA"),
+ BitDescription(0o02, "NA"),
+ BitDescription(0o03, "NA"),
+ BitDescription(0o04, "NA"),
+ BitDescription(0o05, "STVREN"),
+ BitDescription(0o06, "XINST"),
+ BitDescription(0o07, "nDEBUG"),
+ BitDescription(0o10, "NA"),
+ BitDescription(0o11, "NA"),
+ BitDescription(0o12, "CP[0]"),
+ BitDescription(0o13, "NA"),
+ BitDescription(0o14, "NA"),
+ BitDescription(0o15, "NA"),
+ BitDescription(0o16, "NA"),
+ BitDescription(0o17, "NA"),
+
+ BitDescription(0o20, "FOSC[0]"),
+ BitDescription(0o21, "FOSC[1]"),
+ BitDescription(0o22, "FOSC[2]"),
+ BitDescription(0o23, "NA"),
+ BitDescription(0o24, "NA"),
+ BitDescription(0o25, "NA"),
+ BitDescription(0o26, "FCMEN, 0=Fail-Safe Clock Monitor is disabled"),
+ BitDescription(0o27, "IESO, 0=Internal/External Switchover mode is disabled"),
+ BitDescription(0o30, "WDTPS[0]"),
+ BitDescription(0o31, "WDTPS[1]"),
+ BitDescription(0o32, "WDTPS[2]"),
+ BitDescription(0o33, "WDTPS[3]"),
+ BitDescription(0o34, "NA"),
+ BitDescription(0o35, "NA"),
+ BitDescription(0o36, "NA"),
+ BitDescription(0o37, "NA"),
+
+ BitDescription(0o40, "NA"),
+ BitDescription(0o41, "NA"),
+ BitDescription(0o42, "NA"),
+ BitDescription(0o43, "NA"),
+ BitDescription(0o44, "NA"),
+ BitDescription(0o45, "NA"),
+ BitDescription(0o46, "NA"),
+ BitDescription(0o47, "NA"),
+ BitDescription(0o50, "NA"),
+ BitDescription(0o51, "NA"),
+ BitDescription(0o52, "NA"),
+ BitDescription(0o53, "NA"),
+ BitDescription(0o54, "NA"),
+ BitDescription(0o55, "ETHLED"),
+ BitDescription(0o56, "NA"),
+ BitDescription(0o57, "NA"),
+)
+
+ChipDescription(
+ Chip_PIC18F67J60sip6,
+ bitfile="microchip01sip6",
+ chipID="PIC18F67J60sip6",
+ runtimeID=(0xDE05, 0x01),
+ chipVendors="Microchip",
+ description="PIC18F67J60",
+ packages=(("sip6", ""),),
+ fuseDesc=fuseDesc,
+ maintainer="Pavel Stemberk <stemberk@gmail.com>",
+)
diff --git a/libtoprammer/fpga/src/microchip01/microchip01.vh b/libtoprammer/fpga/src/microchip01/microchip01.vh
index 4424256..a1ee767 100644
--- a/libtoprammer/fpga/src/microchip01/microchip01.vh
+++ b/libtoprammer/fpga/src/microchip01/microchip01.vh
@@ -25,111 +25,172 @@
`define DELAY42NSEC(D42NSEC) __delay_count <= (D42NSEC) - 1;//41.666 ns wait cycle if D42NSEC = 1
-`define CMD_SENDINSTR 1
-`define CMD_SENDDATA 2
-`define CMD_READDATA 3
+`define CMDBIT_4BITINSTR 0
+`define CMDBIT_SENDDATA 1
+`define CMDBIT_READDATA 2
+`define DATBIT_KEEPCLKHIGH 4
`define ALL_WITHOUT_ZIF(NAME_, ID_MAJOR_, ID_MINOR_) \
`BOTTOMHALF_BEGIN(NAME_, ID_MAJOR_, ID_MINOR_) \
/* Programmer context */ \
- reg [7:0] prog_count; \
+ reg [4:0] prog_count; \
reg dut_sci_manual; \
reg dut_sci_auto; \
wire dut_sci; \
- reg dut_sdio_driven; \
- reg dut_sdio_value; \
+ reg dut_sdio_driven_manual; \
+ reg dut_sdio_driven_auto; \
+ wire dut_sdio_driven; \
+ reg dut_sdio_value_manual; \
+ reg dut_sdio_value_auto; \
+ wire dut_sdio_value; \
reg dut_vpp; \
reg [15:0] sdi_buf; \
reg [15:0] sdo_buf; \
+ reg [5:0] instr; \
+ reg [3:0] dly5; \
+ reg [7:0] tdly; \
+ reg sdio_auto; \
+ wire is_command; \
\
initial begin \
prog_count <= 0; \
dut_sci_manual <= 0; \
dut_sci_auto <= 0; \
- dut_sdio_driven <= 0; \
- dut_sdio_value <= 0; \
+ dut_sdio_driven_auto <= 0; \
+ dut_sdio_driven_manual <= 0; \
+ dut_sdio_value_auto <= 0; \
+ dut_sdio_value_manual <= 0; \
sdi_buf <= 0; \
sdo_buf <= 0; \
+ instr <= 0; \
dut_vpp <= 0; \
+ tdly <= 24; \
+ dly5 <= 5; \
+ sdio_auto <= 1; \
end \
\
`ASYNCPROC_BEGIN \
if (`CMD_IS_RUNNING) begin \
case (`CMD_STATE) \
0: begin \
- if (`CMD_IS(`CMD_SENDINSTR) || \
- `CMD_IS(`CMD_SENDDATA)) begin \
- dut_sdio_driven <= 1; \
+ if ( \
+ !is_command && `CMD_NR[`CMDBIT_READDATA] \
+ ) begin \
+ dut_sdio_driven_auto <= 0; \
end else begin \
- dut_sdio_driven <= 0; \
+ dut_sdio_driven_auto <= 1; \
end \
+ if((prog_count == 4 && `CMD_NR[`CMDBIT_4BITINSTR]) || (prog_count == 6 && !`CMD_NR[`CMDBIT_4BITINSTR])) begin \
+ dut_sdio_value_auto <= 0; \
+ end \
`CMD_STATE_SET(1) \
- `DELAY42NSEC(5) \
+ `DELAY42NSEC(dly5) \
end \
1: begin \
dut_sci_auto <= 1; /* CLK hi 80ns after this moment we need to be prepared in CMD_READDATA case */ \
- case(`CMD_NR) \
- `CMD_SENDDATA: begin \
- dut_sdio_value <= sdi_buf[prog_count];\
+ if(is_command) begin \
+ dut_sdio_value_auto <= instr[prog_count];\
+ end else if(`CMD_NR[`CMDBIT_SENDDATA]) begin \
+ dut_sdio_value_auto <= sdi_buf[`CMD_NR[`CMDBIT_4BITINSTR]? prog_count-4 : prog_count-6];\
end \
- `CMD_SENDINSTR: begin \
- dut_sdio_value <= sdi_buf[prog_count+1];\
- end \
- endcase \
`CMD_STATE_SET(2) \
- `DELAY42NSEC(5) \
+ `DELAY42NSEC(dly5) \
end \
2: begin \
- if (`CMD_IS(`CMD_READDATA)) begin \
- sdo_buf[prog_count] <= zif[`DUT_SDIO];\
+ if (!is_command && `CMD_NR[`CMDBIT_READDATA]) begin \
+ sdo_buf[`CMD_NR[`CMDBIT_4BITINSTR]? prog_count-4 : prog_count-6] <= zif[`DUT_SDIO];\
end \
prog_count <= prog_count + 1; \
`CMD_STATE_SET(3) \
- `DELAY42NSEC(5) \
+ `DELAY42NSEC(dly5) \
end \
3: begin \
- dut_sci_auto <= 0; /* CLK lo */ \
- \
- if ((prog_count == 6 && `CMD_IS(`CMD_SENDINSTR)) ||\
- (prog_count == 16 && (`CMD_IS(`CMD_SENDDATA) ||\
- `CMD_IS(`CMD_READDATA)))) begin\
- `CMD_FINISH \
- prog_count <= 0; \
- if (`CMD_IS(`CMD_SENDINSTR) || \
- `CMD_IS(`CMD_SENDDATA)) begin\
- dut_sdio_driven <= 0; \
- end \
+ if ( \
+ (!`CMD_NR[`CMDBIT_READDATA] && !`CMD_NR[`CMDBIT_SENDDATA] && \
+ ( \
+ (prog_count == 4 && `CMD_NR[`CMDBIT_4BITINSTR]) || (prog_count == 6 && !`CMD_NR[`CMDBIT_4BITINSTR]) \
+ ) \
+ ) || (\
+ (`CMD_NR[`CMDBIT_READDATA] || `CMD_NR[`CMDBIT_SENDDATA]) && \
+ ( \
+ (prog_count == 20 && `CMD_NR[`CMDBIT_4BITINSTR]) || (prog_count == 22 && !`CMD_NR[`CMDBIT_4BITINSTR]) \
+ ) \
+ ) \
+ ) begin \
+ if(`CMD_NR[`CMDBIT_4BITINSTR] && instr[`DATBIT_KEEPCLKHIGH]) begin \
+ dut_sci_auto <= 1; /* keep CLK high for 4bit instruction commands if is it requested */ \
+ end else begin \
+ dut_sci_auto <= 0; /* CLK lo */ \
+ end \
+ if(`CMD_NR[`CMDBIT_4BITINSTR]) \
+ begin \
+ `CMD_STATE_SET(4) \
+ `DELAY42NSEC(dly5) \
+ end else begin \
+ `CMD_FINISH \
+ prog_count <= 0; \
+ dut_sdio_driven_auto <= 1; \
+ dut_sdio_value_auto <= 0; \
+ end \
end else begin \
- if (`CMD_IS(`CMD_READDATA)) begin\
- `DELAY42NSEC(40) \
- end else begin \
- `DELAY42NSEC(5) \
- end \
+ dut_sci_auto <= 0; /* CLK lo */ \
+ if((prog_count == 4 && `CMD_NR[`CMDBIT_4BITINSTR]) || (prog_count == 6 && !`CMD_NR[`CMDBIT_4BITINSTR])) begin \
+ `DELAY42NSEC(tdly) \
+ end else begin \
+ `DELAY42NSEC(dly5) \
+ end \
`CMD_STATE_SET(0) \
end \
end \
+ 4: begin \
+ `CMD_FINISH \
+ prog_count <= 0; \
+ dut_sdio_driven_auto <= 1; \
+ dut_sdio_value_auto <= 0; \
+ end \
endcase \
end \
`ASYNCPROC_END \
\
`DATAWRITE_BEGIN \
- `ADDR(2): begin /* Run command */ \
- `CMD_RUN(in_data) \
+ `ADDR(0): begin /* Set dly5 - base clock period half, 1=42ns*/ \
+ dly5 <= in_data[3:0]; \
+ end \
+ `ADDR(1): begin /* Set tdly - delay between command and data 1=42ns*/ \
+ tdly <= in_data; \
end \
- `ADDR(3): begin /* Load SDI LO BYTE sequence */ \
+ `ADDR(2): begin /* Run any command */ \
+ instr[4:0] <= in_data[7:3]; \
+ if(in_data[`CMDBIT_4BITINSTR]) \
+ begin \
+ dut_sci_manual <= in_data[7]; \
+ end \
+ `CMD_RUN(in_data & 8'h07) \
+ sdio_auto <= 1; \
+ end \
+ `ADDR(3): begin /* Load 14bit SDI LO BYTE sequence */ \
sdi_buf[0] <= 0; \
sdi_buf[8:1] <= in_data; \
end \
- `ADDR(4): begin /* Load SDI HI BYTE sequence */ \
+ `ADDR(4): begin /* Load 14bit SDI HI BYTE sequence */ \
sdi_buf[14:9] <= in_data[5:0]; \
sdi_buf[15] <= 0; \
end \
`ADDR(5): begin /* Set signals manually */ \
dut_sci_manual <= in_data[0]; /* SCI */ \
+ dut_sdio_driven_manual <= in_data[1]; /* SDIODRIVEN */ \
+ dut_sdio_value_manual <= in_data[2]; /* SDIOVALUE */ \
+ sdio_auto <= 0; \
+ end \
+ `ADDR(6): begin /* Load 16bit SDI LO BYTE sequence */ \
+ sdi_buf[7:0] <= in_data; \
+ end \
+ `ADDR(7): begin /* Load 16bit SDI HI BYTE sequence */ \
+ sdi_buf[15:8] <= in_data; \
end \
`DATAWRITE_END \
\
`DATAREAD_BEGIN \
- `ADDR(0): begin /* Get SDO sequence high (bits 8-13) */ \
+ `ADDR(0): begin /* Get 14bit SDO sequence high (bits 8-13) */ \
out_data[5:0] <= sdo_buf[14:9]; \
out_data[7:6] <= 0; \
end \
@@ -137,12 +198,21 @@
out_data[0] <= `CMD_IS_RUNNING; /* busy */ \
out_data[1] <= zif[`DUT_SDIO]; /* Raw SDO pin access */\
end \
- `ADDR(3): begin /* Get SDO sequence low (bits 0-7) */ \
+ `ADDR(3): begin /* Get 14bit SDO sequence low (bits 0-7) */ \
out_data[7:0] <= sdo_buf[8:1]; \
end \
+ `ADDR(4): begin /* Get 16bit SDO sequence high (bits 8-13) */ \
+ out_data[7:0] <= sdo_buf[15:8]; \
+ end \
+ `ADDR(5): begin /* Get 16bit SDO sequence low (bits 0-7) */ \
+ out_data[7:0] <= sdo_buf[7:0]; \
+ end \
`DATAREAD_END \
\
- assign dut_sci = `CMD_IS_RUNNING ? dut_sci_auto : dut_sci_manual;
+ assign dut_sci = `CMD_IS_RUNNING ? dut_sci_auto : dut_sci_manual;\
+ assign dut_sdio_driven = sdio_auto?dut_sdio_driven_auto:dut_sdio_driven_manual; \
+ assign dut_sdio_value = sdio_auto?dut_sdio_value_auto:dut_sdio_value_manual; \
+ assign is_command = (`CMD_NR[`CMDBIT_4BITINSTR] && prog_count < 4) || (!`CMD_NR[`CMDBIT_4BITINSTR] && prog_count < 6);
/* vim: filetype=verilog:shiftwidth=8:tabstop=8:softtabstop=8
*/
diff --git a/libtoprammer/fpga/src/microchip01/microchip01dip18/microchip01dip18.v b/libtoprammer/fpga/src/microchip01/microchip01dip18/microchip01dip18.v
index 8d5b005..6d7aec1 100644
--- a/libtoprammer/fpga/src/microchip01/microchip01dip18/microchip01dip18.v
+++ b/libtoprammer/fpga/src/microchip01/microchip01dip18/microchip01dip18.v
@@ -42,7 +42,7 @@
`ZIF_UNUSED(15)
`ZIF_UNUSED(16)
`ZIF_UNUSED(17)
- `ZIF_UNUSED(15)
+ `ZIF_UNUSED(18)
bufif0(zif[19], low, dut_vpp); /* VPP/Reset */
bufif0(zif[20], low, low); /* GND */
`ZIF_UNUSED(21)
diff --git a/libtoprammer/fpga/src/microchip01/microchip01dip28/Makefile b/libtoprammer/fpga/src/microchip01/microchip01dip28/Makefile
new file mode 100644
index 0000000..6717273
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip01/microchip01dip28/Makefile
@@ -0,0 +1,3 @@
+NAME:=microchip01dip28
+include ../../../common/makefile
+COMMONDIR:=../../../common
diff --git a/libtoprammer/fpga/src/microchip01/microchip01dip28/microchip01dip28.v b/libtoprammer/fpga/src/microchip01/microchip01dip28/microchip01dip28.v
new file mode 100644
index 0000000..9c18e3a
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip01/microchip01dip28/microchip01dip28.v
@@ -0,0 +1,77 @@
+/*
+ * TOP2049 Open Source programming suite
+ *
+ * Microchip DIP28 primary designed for MCU PIC16F1902 implementation
+ * FPGA bottomhalf implementation
+ *
+ * Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+`define DUT_SDIO 38
+`include "microchip01.vh"
+`ALL_WITHOUT_ZIF(microchip01dip28, 32'hDE07, 1)
+
+ `ZIF_UNUSED(1)
+ `ZIF_UNUSED(2)
+ `ZIF_UNUSED(3)
+ `ZIF_UNUSED(4)
+ `ZIF_UNUSED(5)
+ `ZIF_UNUSED(6)
+ `ZIF_UNUSED(7)
+ `ZIF_UNUSED(8)
+ `ZIF_UNUSED(9)
+ `ZIF_UNUSED(10)
+ bufif0(zif[11], low, dut_vpp); /* VPP/Reset */
+ `ZIF_UNUSED(12)
+ `ZIF_UNUSED(13)
+ `ZIF_UNUSED(14)
+ `ZIF_UNUSED(15)
+ `ZIF_UNUSED(16)
+ `ZIF_UNUSED(17)
+ `ZIF_UNUSED(18)
+ `ZIF_UNUSED(19)
+ `ZIF_UNUSED(20)
+ `ZIF_UNUSED(21)
+ `ZIF_UNUSED(22)
+ `ZIF_UNUSED(23)
+ `ZIF_UNUSED(24)
+ `ZIF_UNUSED(25)
+ `ZIF_UNUSED(26)
+ `ZIF_UNUSED(27)
+ `ZIF_UNUSED(28)
+ bufif0(zif[29], low, low); /* GND */
+ bufif0(zif[30], high, low); /* VCC */
+ `ZIF_UNUSED(31)
+ `ZIF_UNUSED(32)
+ `ZIF_UNUSED(33)
+ `ZIF_UNUSED(34)
+ `ZIF_UNUSED(35)
+ `ZIF_UNUSED(36)
+ bufif0(zif[37], dut_sci, low); /* SCI */
+ bufif0(zif[38], dut_sdio_value, !dut_sdio_driven); /* SDO */
+ `ZIF_UNUSED(39)
+ `ZIF_UNUSED(40)
+ `ZIF_UNUSED(41)
+ `ZIF_UNUSED(42)
+ `ZIF_UNUSED(43)
+ `ZIF_UNUSED(44)
+ `ZIF_UNUSED(45)
+ `ZIF_UNUSED(46)
+ `ZIF_UNUSED(47)
+ `ZIF_UNUSED(48)
+
+`BOTTOMHALF_END
diff --git a/libtoprammer/fpga/src/microchip01/microchip01dip40/Makefile b/libtoprammer/fpga/src/microchip01/microchip01dip40/Makefile
new file mode 100644
index 0000000..b6427d1
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip01/microchip01dip40/Makefile
@@ -0,0 +1,3 @@
+NAME:=microchip01dip40
+include ../../../common/makefile
+COMMONDIR:=../../../common
diff --git a/libtoprammer/fpga/src/microchip01/microchip01dip40/microchip01dip40.v b/libtoprammer/fpga/src/microchip01/microchip01dip40/microchip01dip40.v
new file mode 100644
index 0000000..589939f
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip01/microchip01dip40/microchip01dip40.v
@@ -0,0 +1,77 @@
+/*
+ * TOP2049 Open Source programming suite
+ *
+ * Microchip DIP40 implementation
+ * FPGA bottomhalf implementation
+ *
+ * Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+`define DUT_SDIO 13
+`include "microchip01.vh"
+`ALL_WITHOUT_ZIF(microchip01dip40, 32'hDE06, 1)
+
+ `ZIF_UNUSED(1)
+ `ZIF_UNUSED(2)
+ `ZIF_UNUSED(3)
+ `ZIF_UNUSED(4)
+ bufif0(zif[5], low, low); /* GND */
+ `ZIF_UNUSED(6)
+ `ZIF_UNUSED(7)
+ `ZIF_UNUSED(8)
+ `ZIF_UNUSED(9)
+ `ZIF_UNUSED(10)
+ `ZIF_UNUSED(11)
+ bufif0(zif[12], dut_sci, low); /* SCI */
+ bufif0(zif[13], dut_sdio_value, !dut_sdio_driven); /* SDO */
+ bufif0(zif[14], low, dut_vpp); /* VPP/Reset */
+ bufif0(zif[15], high, low); /* VCC */
+ `ZIF_UNUSED(16)
+ `ZIF_UNUSED(17)
+ `ZIF_UNUSED(18)
+ `ZIF_UNUSED(19)
+ `ZIF_UNUSED(20)
+ `ZIF_UNUSED(21)
+ `ZIF_UNUSED(22)
+ `ZIF_UNUSED(23)
+ `ZIF_UNUSED(24)
+ `ZIF_UNUSED(25)
+ `ZIF_UNUSED(26)
+ `ZIF_UNUSED(27)
+ `ZIF_UNUSED(28)
+ `ZIF_UNUSED(29)
+ `ZIF_UNUSED(30)
+ `ZIF_UNUSED(31)
+ `ZIF_UNUSED(32)
+ `ZIF_UNUSED(33)
+ `ZIF_UNUSED(34)
+ `ZIF_UNUSED(35)
+ `ZIF_UNUSED(36)
+ `ZIF_UNUSED(37)
+ `ZIF_UNUSED(38)
+ `ZIF_UNUSED(39)
+ `ZIF_UNUSED(40)
+ `ZIF_UNUSED(41)
+ `ZIF_UNUSED(42)
+ `ZIF_UNUSED(43)
+ `ZIF_UNUSED(44)
+ `ZIF_UNUSED(45)
+ `ZIF_UNUSED(46)
+ `ZIF_UNUSED(47)
+ `ZIF_UNUSED(48)
+
+`BOTTOMHALF_END
diff --git a/libtoprammer/fpga/src/microchip01/microchip01dip40a/Makefile b/libtoprammer/fpga/src/microchip01/microchip01dip40a/Makefile
new file mode 100644
index 0000000..f66af15
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip01/microchip01dip40a/Makefile
@@ -0,0 +1,3 @@
+NAME:=microchip01dip40a
+include ../../../common/makefile
+COMMONDIR:=../../../common
diff --git a/libtoprammer/fpga/src/microchip01/microchip01dip40a/microchip01dip40a.v b/libtoprammer/fpga/src/microchip01/microchip01dip40a/microchip01dip40a.v
new file mode 100644
index 0000000..14541be
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip01/microchip01dip40a/microchip01dip40a.v
@@ -0,0 +1,77 @@
+/*
+ * TOP2049 Open Source programming suite
+ *
+ * Microchip DIP40a primary desifned for MCU PIC16F1904 implementation
+ * FPGA bottomhalf implementation
+ *
+ * Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+`define DUT_SDIO 44
+`include "microchip01.vh"
+`ALL_WITHOUT_ZIF(microchip01dip40a, 32'hDE08, 1)
+
+ `ZIF_UNUSED(1)
+ `ZIF_UNUSED(2)
+ `ZIF_UNUSED(3)
+ `ZIF_UNUSED(4)
+ bufif0(zif[5], low, dut_vpp); /* VPP/Reset */
+ `ZIF_UNUSED(6)
+ `ZIF_UNUSED(7)
+ `ZIF_UNUSED(8)
+ `ZIF_UNUSED(9)
+ `ZIF_UNUSED(10)
+ `ZIF_UNUSED(11)
+ `ZIF_UNUSED(12)
+ `ZIF_UNUSED(13)
+ `ZIF_UNUSED(14)
+ `ZIF_UNUSED(15)
+ `ZIF_UNUSED(16)
+ `ZIF_UNUSED(17)
+ `ZIF_UNUSED(18)
+ `ZIF_UNUSED(19)
+ `ZIF_UNUSED(20)
+ `ZIF_UNUSED(21)
+ `ZIF_UNUSED(22)
+ `ZIF_UNUSED(23)
+ `ZIF_UNUSED(24)
+ `ZIF_UNUSED(25)
+ `ZIF_UNUSED(26)
+ `ZIF_UNUSED(27)
+ `ZIF_UNUSED(28)
+ `ZIF_UNUSED(29)
+ `ZIF_UNUSED(30)
+ `ZIF_UNUSED(31)
+ `ZIF_UNUSED(32)
+ `ZIF_UNUSED(33)
+ `ZIF_UNUSED(34)
+ bufif0(zif[35], low, low); /* GND */
+ bufif0(zif[36], high, low); /* VCC */
+ `ZIF_UNUSED(37)
+ `ZIF_UNUSED(38)
+ `ZIF_UNUSED(39)
+ `ZIF_UNUSED(40)
+ `ZIF_UNUSED(41)
+ `ZIF_UNUSED(42)
+ bufif0(zif[43], dut_sci, low); /* SCI */
+ bufif0(zif[44], dut_sdio_value, !dut_sdio_driven); /* SDO */
+ `ZIF_UNUSED(45)
+ `ZIF_UNUSED(46)
+ `ZIF_UNUSED(47)
+ `ZIF_UNUSED(48)
+
+`BOTTOMHALF_END
diff --git a/libtoprammer/fpga/src/microchip16/microchip16.vh b/libtoprammer/fpga/src/microchip16/microchip16.vh
new file mode 100644
index 0000000..8fdb1bf
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip16/microchip16.vh
@@ -0,0 +1,170 @@
+/*
+ * TOP2049 Open Source programming suite
+ *
+ * Microchip header file for 16 bit MCUs
+ * FPGA Main bottomhalf implementation
+ *
+ * Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+`include "common.vh"
+
+`define DELAY42NSEC(D42NSEC) __delay_count <= (D42NSEC) - 1;//41.666 ns wait cycle if D42NSEC = 1
+
+`define CMD_SENDSIXINSTR 0
+`define CMD_SENDREGOUTINSTR 1
+`define CMD_ENTERPM 2
+`define ENTERPM_SEQ 32'h4D434851
+`define ALL_WITHOUT_ZIF(NAME_, ID_MAJOR_, ID_MINOR_) \
+ `BOTTOMHALF_BEGIN(NAME_, ID_MAJOR_, ID_MINOR_) \
+ /* Programmer context */ \
+ reg [7:0] prog_count; \
+ reg dut_sci_manual; \
+ reg dut_sci_auto; \
+ wire dut_sci; \
+ reg dut_sdio_driven_manual; \
+ reg dut_sdio_driven_auto; \
+ wire dut_sdio_driven; \
+ reg dut_sdio_value_manual; \
+ reg dut_sdio_value_auto; \
+ wire dut_sdio_value; \
+ reg dut_vpp; \
+ reg [23:0] sdi_buf; \
+ reg [15:0] sdo_buf; \
+ reg [31:0] enterpm_seq; \
+ reg sdio_auto; \
+ \
+ initial begin \
+ prog_count <= 0; \
+ dut_sci_manual <= 0; \
+ dut_sci_auto <= 0; \
+ dut_sdio_driven_auto <= 0; \
+ dut_sdio_driven_manual <= 0; \
+ dut_sdio_value_auto <= 0; \
+ dut_sdio_value_manual <= 0; \
+ sdi_buf <= 0; \
+ sdo_buf <= 0; \
+ dut_vpp <= 0; \
+ sdio_auto <= 1; \
+ enterpm_seq <= `ENTERPM_SEQ ; \
+ end \
+ \
+ `ASYNCPROC_BEGIN \
+ if (`CMD_IS_RUNNING) begin \
+ case (`CMD_STATE) \
+ 0: begin \
+ case(`CMD_NR) \
+ `CMD_SENDSIXINSTR: begin \
+ dut_sdio_driven_auto <= 1; \
+ if (prog_count > 8) begin \
+ dut_sdio_value_auto <= sdi_buf[prog_count-9];\
+ end \
+ end \
+ `CMD_SENDREGOUTINSTR: begin \
+ if (prog_count == 0) begin \
+ dut_sdio_value_auto <= 1; \
+ end else begin \
+ dut_sdio_value_auto <= 0; \
+ end \
+ if (prog_count < 4 ) begin \
+ dut_sdio_driven_auto <= 1; \
+ end else begin \
+ dut_sdio_driven_auto <= 0; \
+ end \
+ end \
+ `CMD_ENTERPM: begin \
+ dut_sdio_driven_auto <= 1; \
+ dut_sdio_value_auto <= enterpm_seq[31-prog_count];\
+ end \
+ endcase \
+ `CMD_STATE_SET(1) \
+ `DELAY42NSEC(5) \
+ end \
+ 1: begin \
+ dut_sci_auto <= 1; \
+ if (`CMD_IS(`CMD_SENDREGOUTINSTR) && prog_count > 11 && prog_count < 28) begin \
+ sdo_buf[prog_count-12] <= zif[`DUT_SDIO];\
+ end \
+ `CMD_STATE_SET(2) \
+ `DELAY42NSEC(5) \
+ end \
+ 2: begin \
+ prog_count <= prog_count + 1; \
+ `CMD_STATE_SET(3) \
+ `DELAY42NSEC(5) \
+ end \
+ 3: begin \
+ dut_sci_auto <= 0; /* CLK lo */ \
+ \
+ if ( \
+ (prog_count == 32 && `CMD_IS(`CMD_ENTERPM)) ||\
+ (prog_count == 33 && `CMD_IS(`CMD_SENDSIXINSTR)) ||\
+ (prog_count == 28 && `CMD_IS(`CMD_SENDREGOUTINSTR)) \
+ ) begin \
+ `CMD_FINISH \
+ prog_count <= 0; \
+ dut_sdio_value_auto <= 0; \
+ end else begin \
+ `DELAY42NSEC(5) \
+ `CMD_STATE_SET(0) \
+ end \
+ end \
+ endcase \
+ end \
+ `ASYNCPROC_END \
+ \
+ `DATAWRITE_BEGIN \
+ `ADDR(0): begin /* Run command */ \
+ `CMD_RUN(in_data) \
+ sdio_auto <= 1; \
+ end \
+ `ADDR(3): begin /* Load SDI LO BYTE sequence */ \
+ sdi_buf[7:0] <= in_data; \
+ end \
+ `ADDR(4): begin /* Load SDI ME BYTE sequence */ \
+ sdi_buf[15:8] <= in_data; \
+ end \
+ `ADDR(5): begin /* Load SDI HI BYTE sequence */ \
+ sdi_buf[23:16] <= in_data; \
+ end \
+ `ADDR(9): begin /* Set signals manually */ \
+ dut_sci_manual <= in_data[0]; /* SCI */ \
+ dut_sdio_driven_manual <= in_data[1]; /* SDIODRIVEN */ \
+ dut_sdio_value_manual <= in_data[2]; /* SDIOVALUE */ \
+ sdio_auto <= 0; \
+ end \
+ `DATAWRITE_END \
+ \
+ `DATAREAD_BEGIN \
+ `ADDR(0): begin /* Get SDO sequence high (bits 8-13) */ \
+ out_data[7:0] <= 255; /*sdo_buf[15:8];*/ \
+ end \
+ `ADDR(2): begin /* Read status */ \
+ out_data[0] <= `CMD_IS_RUNNING; /* busy */ \
+ out_data[1] <= zif[`DUT_SDIO]; /* Raw SDO pin access */\
+ end \
+ `ADDR(3): begin /* Get SDO sequence low (bits 0-7) */ \
+ out_data[7:0] <= 0; /*sdo_buf[7:0]; */ \
+ end \
+ `DATAREAD_END \
+ \
+ assign dut_sci = `CMD_IS_RUNNING ? dut_sci_auto : dut_sci_manual; \
+ assign dut_sdio_driven = sdio_auto?dut_sdio_driven_auto:dut_sdio_driven_manual; \
+ assign dut_sdio_value = sdio_auto?dut_sdio_value_auto:dut_sdio_value_manual;
+
+/* vim: filetype=verilog:shiftwidth=8:tabstop=8:softtabstop=8
+ */
diff --git a/libtoprammer/fpga/src/microchip16/microchip16dip14dip20/Makefile b/libtoprammer/fpga/src/microchip16/microchip16dip14dip20/Makefile
new file mode 100644
index 0000000..3563189
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip16/microchip16dip14dip20/Makefile
@@ -0,0 +1,3 @@
+NAME:=microchip16dip14dip20
+include ../../../common/makefile
+COMMONDIR:=../../../common
diff --git a/libtoprammer/fpga/src/microchip16/microchip16dip14dip20/microchip16dip14dip20.v b/libtoprammer/fpga/src/microchip16/microchip16dip14dip20/microchip16dip14dip20.v
new file mode 100644
index 0000000..28955fa
--- /dev/null
+++ b/libtoprammer/fpga/src/microchip16/microchip16dip14dip20/microchip16dip14dip20.v
@@ -0,0 +1,77 @@
+/*
+ * TOP2049 Open Source programming suite
+ *
+ * Microchip DIP14 and DIP20 implementation
+ * FPGA bottomhalf implementation
+ *
+ * Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+`define DUT_SDIO 17
+`include "microchip16.vh"
+`ALL_WITHOUT_ZIF(microchip16dip14dip20, 32'hDF01, 1)
+
+ `ZIF_UNUSED(1)
+ `ZIF_UNUSED(2)
+ `ZIF_UNUSED(3)
+ `ZIF_UNUSED(4)
+ `ZIF_UNUSED(5)
+ `ZIF_UNUSED(6)
+ `ZIF_UNUSED(7)
+ `ZIF_UNUSED(8)
+ `ZIF_UNUSED(9)
+ `ZIF_UNUSED(10)
+ `ZIF_UNUSED(11)
+ `ZIF_UNUSED(12)
+ `ZIF_UNUSED(13)
+ `ZIF_UNUSED(14)
+ bufif0(zif[15], low, dut_vpp); /* VPP/Reset */
+ bufif0(zif[16], dut_sci, low); /* SCI - PGEC2 */
+ bufif0(zif[17], dut_sdio_value, !dut_sdio_driven); /* SDO - PGED2 */
+ `ZIF_UNUSED(18)
+ `ZIF_UNUSED(19)
+ `ZIF_UNUSED(20)
+ `ZIF_UNUSED(21)
+ `ZIF_UNUSED(22)
+ `ZIF_UNUSED(23)
+ `ZIF_UNUSED(24)
+ `ZIF_UNUSED(25)
+ `ZIF_UNUSED(26)
+ `ZIF_UNUSED(27)
+ `ZIF_UNUSED(28)
+ `ZIF_UNUSED(29)
+ `ZIF_UNUSED(30)
+ `ZIF_UNUSED(31)
+ `ZIF_UNUSED(32)
+ bufif0(zif[33], low, low); /* GND */
+ bufif0(zif[34], high, low); /* VCC */
+ `ZIF_UNUSED(35)
+ `ZIF_UNUSED(36)
+ `ZIF_UNUSED(37)
+ `ZIF_UNUSED(38)
+ `ZIF_UNUSED(39)
+ `ZIF_UNUSED(40)
+ `ZIF_UNUSED(41)
+ `ZIF_UNUSED(42)
+ `ZIF_UNUSED(43)
+ `ZIF_UNUSED(44)
+ `ZIF_UNUSED(45)
+ `ZIF_UNUSED(46)
+ `ZIF_UNUSED(47)
+ `ZIF_UNUSED(48)
+
+`BOTTOMHALF_END
bues.ch cgit interface