def showflags(): stat = raiden.flag_status() print("Current flags: %d" % stat) print(" Armed: %d" % raiden.is_armed()) print(" Trigger: %d" % raiden.is_triggered()) print(" Glitched: %d" % raiden.is_glitched()) print(" Finished: %d" % raiden.is_finished()) print(" Power: %d" % raiden.glitch_out())
# total test period is 2.04us so 2040 ns - one tick is 10 ns for delay in range(205): # for width in range(9): for width in [8]: raiden.arm(0) raiden.reset_glitcher() raiden.set_param(param="CMD_VSTART", value=1) raiden.set_param(param="CMD_GLITCH_COUNT", value=1) raiden.set_param(param="CMD_GLITCH_MAX", value=1) raiden.set_param(param="CMD_GLITCH_DELAY", seconds=delay) raiden.set_param(param="CMD_GLITCH_WIDTH", seconds=width) raiden.set_param(param="CMD_GLITCH_GAP", seconds=width) raiden.arm() lpc.write(b'g') while (not raiden.is_finished()): pass text = lpc.readline().decode("UTF-8").strip() if (text == '!'): print("") print('got it!') print('delay %d' % delay) print('width %d' % width) continue print('\rnope! delay %d\twidth %d' % (delay, width), end='') if (text != '.'): print("") print('something bad: %s' % text) exit(True) print("")
print("Exception", e) resp = None dev = None continue try: resp = dev.ctrl_transfer(bmRequestType=0x81, bRequest=0x6, wValue=0x2100, wIndex=0x0000, data_or_wLength=0xfde8) except Exception as e: print("exception ctrl_transfer ", e) dev = None resp = None continue while not raiden.is_finished(): pass print(resp) count += 1 if resp and len(resp) > 10000: print(resp) print( "Glitch work: delay: {0}, width: {1}, repeat: {2}\n". format(delay, width, repeat)) print("Len of resp", len(resp)) f = open("results-success.bin", "wb") f.write(bytearray(resp)) f.close() sys.exit(0) repeat += 1 width += 1