def init(self, frequency = 1000000): # connect to DAP, check for SWD or JTAG self.mode = dapConnect(self.interface) # set clock frequency dapSWJClock(self.interface, frequency) # configure transfer dapTransferConfigure(self.interface) if (self.mode == DAP_MODE_SWD): # configure swd protocol dapSWDConfigure(self.interface) # switch from jtag to swd JTAG2SWD(self.interface) # read ID code logging.info('IDCODE: 0x%X', self.readDP(DP_REG['IDCODE'])) # clear errors dapWriteAbort(self.interface, 0x1e); elif (self.mode == DAP_MODE_JTAG): # configure jtag protocol dapJTAGConfigure(self.interface, 4) # Test logic reset, run test idle dapSWJSequence(self.interface, [0x1F]) # read ID code logging.info('IDCODE: 0x%X', dapJTAGIDCode(self.interface)) # clear errors self.writeDP(DP_REG['CTRL_STAT'], CTRLSTAT_STICKYERR | CTRLSTAT_STICKYCMP | CTRLSTAT_STICKYORUN) return
def init(self, frequency=1000000): # connect to DAP, check for SWD or JTAG self.mode = dapConnect(self.interface) # set clock frequency dapSWJClock(self.interface, frequency) # configure transfer dapTransferConfigure(self.interface) if (self.mode == DAP_MODE_SWD): # configure swd protocol dapSWDConfigure(self.interface) # switch from jtag to swd JTAG2SWD(self.interface) # read ID code logging.info('IDCODE: 0x%X', self.readDP(DP_REG['IDCODE'])) # clear errors dapWriteAbort(self.interface, 0x1e) elif (self.mode == DAP_MODE_JTAG): # configure jtag protocol dapJTAGConfigure(self.interface, 4) # Test logic reset, run test idle dapSWJSequence(self.interface, [0x1F]) # read ID code logging.info('IDCODE: 0x%X', dapJTAGIDCode(self.interface)) # clear errors self.writeDP( DP_REG['CTRL_STAT'], CTRLSTAT_STICKYERR | CTRLSTAT_STICKYCMP | CTRLSTAT_STICKYORUN) return
def init(self, frequency=1000000): # init dap IO dapConnect(self.interface) # set clock frequency dapSWJClock(self.interface, frequency) # configure transfer dapTransferConfigure(self.interface) # configure swd protocol dapSWDConfigure(self.interface) # switch from jtag to swd JTAG2SWD(self.interface) # read ID code logging.info('IDCODE: 0x%X', self.readDP(DP_REG['IDCODE'])) # clear abort err dapWriteAbort(self.interface, 0x1e) return
def init(self): # init dap IO dapConnect(self.interface) # set clock freq at 1000000Hz dapSWJClock(self.interface) # configure transfer dapTransferConfigure(self.interface) # configure swd protocol dapSWDConfigure(self.interface) # switch from jtag to swd JTAG2SWD(self.interface) # read ID code logging.info('IDCODE: 0x%X', self.readDP(DP_REG['IDCODE'])) # clear abort err dapWriteAbort(self.interface, 0x1e); return
def setClock(self, frequency): dapSWJClock(self.interface, frequency)