Streaming mode MWE

Hi all,
I’ve been trying to set up streaming mode with the CW-Pro again recently and I cannot get it to work.
Here my minimal working example on AES without streaming:

import chipwhisperer as cw

scope = cw.scope()
target = cw.target(scope)
scope.default_setup()
# scope.adc.stream_mode = True
scope.clock.adc_src = "clkgen_x1"
scope.adc.samples = 100000
programmer = cw.programmers.STM32FProgrammer
cw.program_target(scope, programmer, path_to_hex)
target.simpleserial_write("k", bytearray([0x2b, 0x7e, 0x15, 0x16,
                                          0x28, 0xae, 0xd2, 0xa6,
                                          0xab, 0xf7, 0x15, 0x88,
                                          0x09, 0xcf, 0x4f, 0x3c]))
target.simpleserial_wait_ack()
scope.arm()
target.simpleserial_write("p", bytearray([0x6b, 0xc1, 0xbe, 0xe2,
                                          0x2e, 0x40, 0x9f, 0x96,
                                          0xe9, 0x3d, 0x7e, 0x11,
                                          0x73, 0x93, 0x17, 0x2a]))
response = target.simpleserial_read("r", 16)
scope.capture()
trace = scope.get_last_trace()

However, when I un-comment scope.adc.stream_mode = True, I get the following error message:

Traceback (most recent call last):
  File "test_stream.py", line 25, in <module>
    scope.capture()
  File "....", line 366, in capture
    return self.qtadc.capture(None)
  File "...", line 113, in capture
    timeout = self.sc.capture(offset, adc_freq, samples)
  File "....", line 2607, in capture
    scope_logger.warning('Timeout in OpenADC capture(), no trigger seen! Trigger forced, data is invalid. Status: %02x'%status)
UnboundLocalError: local variable 'status' referenced before assignment
WARNING:ChipWhisperer NAEUSB:Streaming: USB stream read timed out

Any idea what is missing to get it working ?

Thanks !

Brice

Hi Brice,

Can you post what scope.fw_version returns? We’ve recently fixed some bugs related to streaming mode, so it could just be that you need a firmware update.

Alex

Hi Alex,

Here’s the output of scope.fw_version:

{'major': 1, 'minor': 30, 'debug': 0}

Should I upgrade the firmware ?

Thanks,

Brice

Hi Brice,

Yeah, I’d recommend updating. Firmware version 1.61 should have a working stream mode.

Alex

Hi Alex,

I got the bin file from the Github repo under hardware/capture/chipwhisperer-cw1200/CW1200_SAM3UFW.bin and flashed it onto the CW1200. The firmware version is now 1.51. However, I get the following error:

OSError: Could not detect STM32F, check connections, BOOT MODE entry setup

Should I get a newer version from somewhere else ?

Brice

Hi Brice,

I’d recommend just following Updating Firmware — ChipWhisperer 5.6.1 documentation instead of using the .bin file directly.

If following the firmware update doesn’t give you 1.61, try replacing chipwhisperer/software/chipwhisperer/hardware/firmware/cw1200.py with Updating Firmware — ChipWhisperer 5.6.1 documentation, restarting the notebook (if you’re using one) and redoing the firmware update.

Alex

Hi Alex,

Updating the firmware to 1.61 and pulling the last ChipWhisperer version from Git fixed the issue.
Thanks for your help and for your work on this great tool !

Brice

1 Like