def initAll(): print("Configuring ChipWhisperer") global scope, target,cs,jlink scope = cw.scope() target = cw.target(scope) scope.adc.samples = 5000 scope.adc.offset = 0 scope.adc.basic_mode = "rising_edge" scope.clock.clkgen_freq = 8000000 # 120000000 # 737060 scope.clock.adc_src = "clkgen_x1" scope.trigger.triggers = "tio4" scope.io.hs2 = "glitch" scope.glitch.clk_src = "clkgen" scope.glitch.output = "glitch_only" scope.io.glitch_lp = False scope.io.glitch_hp = True scope.glitch.trigger_src = 'ext_single' print("Configuring JLink") if len(sys.argv) > 1: lib = pylink.library.Library(sys.argv[1]) jlink = pylink.JLink(lib) else: jlink = pylink.JLink() jlink.open() print("Configuring ChipShouter") cs = chipshouter.ChipSHOUTER("/dev/ttyUSB0") if cs.armed == True: cs.armed = False cs.reset_config = True cs.voltage = 250 cs.clr_armed = True
def initAll(): print("Configuring CW") global scope, target, cs scope = cw.scope() target = cw.target(scope) scope.adc.samples = 5000 scope.adc.offset = 0 scope.adc.basic_mode = "rising_edge" scope.clock.clkgen_freq = 8000000 # 120000000 # 737060 scope.clock.adc_src = "clkgen_x1" scope.trigger.triggers = "tio4" scope.io.hs2 = "glitch" scope.glitch.clk_src = "clkgen" scope.glitch.output = "enable_only" scope.io.glitch_lp = False scope.io.glitch_hp = True scope.glitch.trigger_src = 'ext_single' print("Configuring CS") cs = chipshouter.ChipSHOUTER("/dev/ttyUSB0") cs.reset_config = True cs.voltage = 350 cs.clr_armed = True
outputs = [] widths = [] offsets = [] Range = namedtuple('Range', ['min', 'max', 'step']) gc = support.GlitchCore() gc.setRepeat(1) gc.setWidth(38.5) gc.setOffsetRange(29.0, 32.0, 0.5) gc.setExtOffsetRange(15, 30, 1) target.init() gc.lock() cs = chipshouter.ChipSHOUTER("/dev/ttyUSB0") cs.voltage = 450 cs.clr_armed = True print("Give it a sec...") time.sleep(3.0) print("OK go...") x = gc.generateFault() while x is not None: (width, offset, ext, repeat) = x scope.glitch.width = width scope.glitch.offset = offset scope.glitch.ext_offset = ext scope.glitch.repeat = 2 print(repeat)