How to get value of scope.io.tio(x) pin

Hi!
Any chance to get scope.tio.io(x) pin logic {0,1} value?
The getter returns the name of the function of the pin. When I set “high_z” I expect to get a logic value from somewhere.
Any help will be appreciated

Mostly good news: this feature does exist! It was contributed last year: https://github.com/newaetech/chipwhisperer/pull/119

The “mostly” part is that it involves an FPGA update, and without getting into all the details, what happened is that only the base FPGA bitfile received this feature update and so you’ll have to load it manually in order to get it.

But I tested it and it does work.

First, in hardware/capture/chipwhisperer-lite, do:
unzip cwlite_firmware.zip.

Then, as a example:

import chipwhisperer as cw
from chipwhisperer.hardware.naeusb.naeusb import NAEUSB
usb = NAEUSB()
usb.con()

from chipwhisperer.hardware.naeusb.fpga import FPGA
fpga = FPGA(usb)
fpga.FPGAProgram(open(r'../hardware/capture/chipwhisperer-lite/cwlite_interface.bit', 'rb'))

scope.io.tio1 = 'high_z'
scope.io.tio2 = 'high_z'
scope.io.tio3 = 'high_z'
scope.io.tio4 = 'high_z'

scope.advancedSettings.cwEXTRA.readTIOPins()

You can also read the IOs even if they’re not set to high_z.
What you won’t be able to do with this is use the phase offset feature for glitching.
We’ll put this on our todo list, so that it’s fully supported.

Jean-Pierre

Jean-Pierre, many thanks for the pointing out!

There is some strange behaviour: if I do exactly like you said it works, I get 1 when set pin high

But after I recycle the power the magic is disappeared, and I always get 0 on all pins.

Steps to reproduce:

  1. Take cw-light
  2. Reprogram, as you pointed out
  3. Set io.tio2 high (I just connect jumper from 3.3v to tio2)
  4. print(bin(scope.advancedSettings.cwEXTRA.readTIOPins()))10
  5. Recycle the power
  6. Setup:

scope = cw.scope()
target = cw.target(scope)
scope.io.hs2 = “glitch”
scope.clock.clkgen_freq = 120E6
scope.adc.basic_mode = “rising_edge”
scope.adc.samples = 500
scope.gain.db = 30
scope.glitch.clk_src = “clkgen”
scope.glitch.output = “enable_only”
scope.glitch.trigger_src = “ext_single”
scope.glitch.repeat = 2
scope.trigger.triggers = “tio4”
scope.glitch.ext_offset = 5500
scope.glitch.ext_offset = (scope.glitch.ext_offset / 100.0E6) * scope.clock.clkgen_freq
scope.io.tio1 = “high_z”
scope.io.tio2 = “high_z”
scope.io.tio3 = “high_z”
scope.io.tio4 = “high_z”

  1. Set io.tio2 high (connect jumper from 3.3v to tio2)
  2. print(bin(scope.advancedSettings.cwEXTRA.readTIOPins()))0

:frowning:

Ok, I see how I do it

For now I just reprogram the cw-light every time on setup

Thank you!

Yeah, the CW FPGA does not hold its bitfile across power cycles, so you must reprogram the bitfile every time.

Jean-Pierre