Capturing the power traces on the nRST trigger

I was going to collect the power traces bound to the nRST trigger and faced with the problem.
The logic of the script is:

  1. Initial setup of the CW.
  2. Set “rising_edge” trigger mode.
  3. Set triggering on the “nrst” line.
  4. Arm the CW.
  5. In the loop “Reset the target board (from CW) and capture the trace based on triggering the nrst line”

The problem is the “capture” call is blocking call and I cannot reset the target board to trigger capturing.

import chipwhisperer as cw

scope = cw.scope()
target =, cw.targets.SimpleSerial2)
scope.adc.basic_mode = "rising_edge"
# ... Blocking happens here until timeout
# How to reset the target board by = 'low'
time.sleep(0.05) = 'high_z' 

# so that to trigger capturing via the nrst line?

The trick is that once scope.arm() is called, the capture will happen (if the trigger is seen). scope.capture() just handles things on the Python side.
So try this instead: = 'low'
scope.arm() = 'high'
trace = scope.get_last_trace()
1 Like

Thanks a lot! I missed the fact the scope.arm() works asynchronous and the actual capturing happens on the trigger event.
One more question. What exactly does “”?
I have found it clears “SETTINGS_ARM” parameter and ultimately calls

   def setSettings(self, state, validate=False):
        cmd = bytearray(1)
        cmd[0] = state
        self.cached_settings = state
        self.sendMessage(CODE_WRITE, "SETTINGS_ADDR", cmd, Validate=validate)

and send the message to the SAM3U.

It’s actually redundant, I had forgotten that scope.capture() will do it for you (however there is no harm in repeating the call).

It disarms the scope, which allows it to be re-armed again later.

1 Like