I have an arduino uno giving a trigger thru a digital pin and i would like to read that using my CWLite to time a voltage glitch
Typically you would connect your target’s trigger to the CW-lite TIO4 pin, and use:
scope.trigger.module = 'basic'
scope.trigger.triggers = 'tio4'
Make sure that your target’s trigger is 3.3V, otherwise you risk damaging your CW-lite.
thanks but what’s the variable that stores the value of the gpio input? I need to basically say if(trigger_Val == HIGH): perform glitch
If you do it that way you will have lots of jitter and delay from all the layers, from the Python down to the USB driver. You don’t want that!
The scope.trigger
commands I gave above set up the ChipWhisperer hardware itself to trigger (and glitch, if configured accordingly) immediately when the trigger line is seen high, without any involvement (and delay) from software.
Go through our fault notebooks, they will teach you how to do this properly.
@jpthibault jpthibault if this is how the tio4 input trigger works, is there any way to monitor this state via python api? For example, after receiving a high state and generating a glitch, provide information about the condition that was executed.
Sorry, I don’t follow - what’s the information that are you looking for in this situation?
I wanted to ask if there is any way to verify via python whether the high state actually controlled the tio4 pin and the glitch was sent? correspondingly, is it possible to monitor the status of sending the glitch? Sample code that works without full process control:
SCOPETYPE = ‘OPENADC’
import chipwhisperer as cw
scope = cw.scope()
print(“INFO: Found ChipWhisperer😍”)
import time
import os
scope.clock.clkgen_freq = 50e6
scope.glitch.resetDCMs()
scope.glitch.clk_src = “clkgen”
scope.glitch.output = “enable_only”
scope.glitch.trigger_src = “ext_continuous”
scope.io.glitch_hp = True
scope.io.glitch_lp = False
scope.trigger.triggers = “tio4”
def run_glitch():
scope.arm()
scope.io.tio4 = ‘gpio_high’
#time.sleep(delay_sec)
scope.io.tio4 = ‘gpio_low’
In the code below, a loop is executed that changes the glitch parameters, but it is not able to identify whether the glitch has actually been changed, so the print status informing about sending the glitch works independently. I mean some dependency that can be verified, does cwlite have some cmd to monitor the glitch status?
for i in range(1,5):
for b in range(1,4):
print(f"GLITCH_STATUS: width = {scope.glitch.repeat}, delay = {scope.glitch.ext_offset}")
scope.glitch.repeat = i
scope.glitch.ext_offset = b
scope.io.glitch_lp = False
scope.io.glitch_hp = False
scope.io.glitch_hp = True
I don’t recommend glitching this way, at all.
Go through our glitching notebooks here to learn the recommended way.
The idea is that the scope is armed and a message is sent to the target, which then raises the trigger line, which then causes the glitch.
If the target never raises the trigger line, then scope.capture()
(or scope.capture_trace()
) will timeout. If there is no timeout, then you know that the glitch was applied.
There is no other way to know whether the trigger line was activated. You can poll it, but Python is relatively slow and so you are likely to miss the “trigger high” event by polling.
Ok i will follow these tutorials soon, anyway the scheme of action I described is necessary to trigger glitches via external ADC, it can be an oscilloscope.