Experiencing difficulty setting up when connecting via cw.scope:

Noob here, please be patient with me if I totally messed this up.

I tried the VirtualBox image and everything ran fine except the part when it came to testing the hardware.

So I moved to native Windows, but have the same deal now.

Here’s what I am getting:

ERROR:ChipWhisperer Scope:ChipWhisperer error state detected. Resetting and retrying connection…

OSError Traceback (most recent call last)
c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py in scope(scope_type, sn)
231 try:
→ 232 scope.con(sn)
233 except IOError:

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\base.py in con(self, sn)
57 def con(self, sn=None):
—> 58 if self._con(sn):
59 self.connectStatus = True

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\OpenADC.py in _con(self, sn)
246 if self.scopetype is not None:
→ 247 self.scopetype.con(sn)
248

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\openadc_interface\naeusbchip.py in con(self, sn)
101 try:
→ 102 self.getFWConfig().loadRequired()
103 except:

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadRequired(self, forceFirmware)
222 “”“Load firmware file or FPGA file only as required, skip otherwise”""
→ 223 self.loader.loadRequired(self.loadFPGA, forceFirmware)
224

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadRequired(self, callback, forceFirmware)
136 def loadRequired(self, callback, forceFirmware=False):
→ 137 callback()
138

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadFPGA(self)
249
→ 250 self.loader.loadFPGA()
251 scope_logger.info(‘FPGA programmed’)

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadFPGA(self)
143 if self.driver.isFPGAProgrammed() == False:
→ 144 self.driver.FPGAProgram(self.fpga_bitstream())
145 else:

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\fpga.py in FPGAProgram(self, bitstream, exceptOnDoneFailure)
83 if programStatus == False and exceptOnDoneFailure:
—> 84 raise IOError(“FPGA Done pin failed to go high, bad bitstream?”, bitstream)
85

OSError: [Errno FPGA Done pin failed to go high, bad bitstream?] <zipfile.ZipExtFile [closed]>

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last)
in
1 import chipwhisperer as cw
----> 2 scope = cw.scope()

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py in scope(scope_type, sn)
236 time.sleep(2)
237 scope = scope_type()
→ 238 scope.con(sn)
239 return scope
240

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\base.py in con(self, sn)
56
57 def con(self, sn=None):
—> 58 if self._con(sn):
59 self.connectStatus = True
60

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\OpenADC.py in _con(self, sn)
245 def _con(self, sn=None):
246 if self.scopetype is not None:
→ 247 self.scopetype.con(sn)
248
249 if hasattr(self.scopetype, “ser”) and hasattr(self.scopetype.ser, “_usbdev”):

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\openadc_interface\naeusbchip.py in con(self, sn)
100 # XXX: need to comment this out?
101 try:
→ 102 self.getFWConfig().loadRequired()
103 except:
104 self.dev.dis()

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadRequired(self, forceFirmware)
221 def loadRequired(self, forceFirmware=False):
222 “”“Load firmware file or FPGA file only as required, skip otherwise”""
→ 223 self.loader.loadRequired(self.loadFPGA, forceFirmware)
224
225 def loadFirmware(self):

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadRequired(self, callback, forceFirmware)
135
136 def loadRequired(self, callback, forceFirmware=False):
→ 137 callback()
138
139 def loadFPGA(self):

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadFPGA(self)
248 scope_logger.info(‘FPGA: DEBUG MODE: Using .bit file, date: %s’ % strdate)
249
→ 250 self.loader.loadFPGA()
251 scope_logger.info(‘FPGA programmed’)
252

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererFWLoader.py in loadFPGA(self)
142
143 if self.driver.isFPGAProgrammed() == False:
→ 144 self.driver.FPGAProgram(self.fpga_bitstream())
145 else:
146 scope_logger.info(“FPGA Configuration skipped - detected already programmed”)

c:\users\wesle\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\fpga.py in FPGAProgram(self, bitstream, exceptOnDoneFailure)
82
83 if programStatus == False and exceptOnDoneFailure:
—> 84 raise IOError(“FPGA Done pin failed to go high, bad bitstream?”, bitstream)
85
86 return programStatus

OSError: [Errno FPGA Done pin failed to go high, bad bitstream?] <zipfile.ZipExtFile [closed]>

Hi @wba sorry for the issues! This “bitstream problem” is generally the first that that should work. There are two possibilities:

  1. HW Issue (not very likely - the boards are tested a lot before they are shipped, so it would only be an in-transit damage).
  2. SW Issues.

What version are you on for native Windows? There were some changes in recent ChipWhisperer that sped up device programming/boot, but could be causing that issue perhaps.

Can you try bumping your ChipWhisperer to the latest release git version? This basically just requires you to run a “git pull” in the ChipWhisperer directory (on Windows, this is in C:\ChipWhisperer5_install_dir\git\home\portable\chipwhisperer). There is a git-cmd executable in the C:\ChipWhisperer5_install_dir\git directory. But @Alex_Dewar might have a smoother method in the latest.

A somewhat easier method would be if you have another computer to check with that. This would verify there is nothing odd such as the USB port isn’t supplying enough power or there is some timing issue.

You can also update the firmware to make sure nothing happened there: Updating Firmware — ChipWhisperer 5.6.1 documentation

If you still get that “bad bitstream” error we can expedite a replacement CW-Lite Capture to you, but I wouldn’t have as much hope for fixing the issue… we’ve occasionally seen incompatibility issues and similar which aren’t solved with just changing the hardware, but we can fix with firmware/software fixes.

Thanks for the reply. I am on Windows 10 Pro 19044.1466

Trying to run the git pull command but it keeps puking with:

error: The following untracked working tree files would be overwritten by merge:
openadc/controlsw/README.txt
openadc/controlsw/python/examples/adc-capture-example.py
openadc/controlsw/python/examples/old/cheap-capture-example.py
openadc/controlsw/python/examples/old/opensca-capture.py
openadc/controlsw/python/examples/old/sasebo-capture-example.py
openadc/controlsw/python/examples/old/smartcard-capture-example.py
openadc/controlsw/python/install_win.bat
openadc/controlsw/python/openadc/ExtendedParameter.py
openadc/controlsw/python/openadc/HelpWindow.py
openadc/controlsw/python/openadc/init.py
openadc/controlsw/python/openadc/openadc.py
openadc/controlsw/python/openadc/qt.py
openadc/controlsw/python/openadc/scan.py
openadc/controlsw/python/setup.py
openadc/controlsw/qt/capture_application/capture_application.pro
openadc/controlsw/qt/capture_application/capture_application.pro.user
openadc/controlsw/qt/capture_application/main.cpp
openadc/controlsw/qt/capture_application/mainwindow.cpp
openadc/controlsw/qt/capture_application/mainwindow.h
openadc/controlsw/qt/capture_application/mainwindow.ui

I’ll try to fix (already cycled through obvious stuff on stackoverflow). Will also try another machine and report back.

Ah - this might need us to do another version release… we removed a submodule IIRC but it’s barfing as the new files collide with that. This should be a quick fix:

Can you just delete the openadc folder (or rename it to be less dangerous if you want)? That should pull all the “new” files.

Already moved onto a different PC; clean install of Windows 10.

Started with Virtualbox, regrettably hit problems when testing the hardware

Executing “PLATFORM=“NOTHING”
%run Setup_Scripts/Setup_Generic.ipynb”

Results in:

INFO: Found ChipWhisperer😍

USBError Traceback (most recent call last)
~/work/projects/chipwhisperer/jupyter/Setup_Scripts/Setup_Generic.ipynb in
1 import time
2 time.sleep(0.05)
----> 3 scope.default_setup()
4 def reset_target(scope):
5 if PLATFORM == “CW303” or PLATFORM == “CWLITEXMEGA”:

~/work/projects/chipwhisperer/software/chipwhisperer/capture/scopes/OpenADC.py in default_setup(self)
165
166 self.clock.adc_src = “clkgen_x4”
→ 167 self.io.cdc_settings = 0
168
169 count = 0

~/work/projects/chipwhisperer/software/chipwhisperer/common/utils/util.py in setattr(self, name, value)
349
350 def setattr(self, name, value):
→ 351 if hasattr(self, ‘_new_attributes_disabled’) and self._new_attributes_disabled and not hasattr(self, name): # would this create a new attribute?
352 raise AttributeError(“Attempt to set unknown attribute in %s”%self.class, name)
353 super(DisableNewAttr, self).setattr(name, value)

~/work/projects/chipwhisperer/software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererExtra.py in cdc_settings(self)
210 if ver < ‘0.30’:
211 return None
→ 212 return self.cwe.oa.serial.get_cdc_settings()
213
214 @cdc_settings.setter

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in get_cdc_settings(self)
670
671 def get_cdc_settings(self):
→ 672 return self.usbtx.readCtrl(self.CMD_CDC_SETTINGS_EN, dlen=2)
673
674 def set_cdc_settings(self, port=[1, 1]):

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in readCtrl(self, cmd, value, dlen)
501 “”"
502 # Vendor-specific, IN, interface control transfer
→ 503 return self.usbdev().ctrl_transfer(0xC1, cmd, value, 0, dlen, timeout=self._timeout)
504
505 def cmdReadMem(self, addr, dlen):

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in ctrl_transfer(self, bmRequestType, bRequest, wValue, wIndex, data_or_wLength, timeout)
1077 wIndex,
1078 buff,
→ 1079 self.__get_timeout(timeout))
1080
1081 if isinstance(data_or_wLength, array.array) \

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/backend/libusb1.py in ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue, wIndex, data, timeout)
899 cast(addr, POINTER(c_ubyte)),
900 length,
→ 901 timeout))
902
903 return ret

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/backend/libusb1.py in _check(ret)
602 raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
603 else:
→ 604 raise USBError(_strerror(ret), ret, _libusb_errno[ret])
605
606 return ret

USBError: [Errno 32] Pipe error


USBError Traceback (most recent call last)
in
1 PLATFORM=“NOTHING”
----> 2 get_ipython().run_line_magic(‘run’, ‘Setup_Scripts/Setup_Generic.ipynb’)

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2342 kwargs[‘local_ns’] = self.get_local_scope(stack_depth)
2343 with self.builtin_trap:
→ 2344 result = fn(*args, **kwargs)
2345 return result
2346

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/decorator.py in fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
→ 232 return caller(func, *(extras + args), **kw)
233 fun.name = func.name
234 fun.doc = func.doc

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/IPython/core/magic.py in (f, *a, **k)
185 # but it’s overkill for just that one bit of state.
186 def magic_deco(arg):
→ 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/IPython/core/magics/execution.py in run(self, parameter_s, runner, file_finder)
722 with preserve_keys(self.shell.user_ns, ‘file’):
723 self.shell.user_ns[‘file’] = filename
→ 724 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
725 return
726

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/IPython/core/interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
2829 result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
2830 if raise_exceptions:
→ 2831 result.raise_error()
2832 elif not result.success:
2833 break

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/IPython/core/interactiveshell.py in raise_error(self)
329 raise self.error_before_exec
330 if self.error_in_exec is not None:
→ 331 raise self.error_in_exec
332
333 def repr(self):

[... skipping hidden 1 frame]

in
1 import time
2 time.sleep(0.05)
----> 3 scope.default_setup()
4 def reset_target(scope):
5 if PLATFORM == “CW303” or PLATFORM == “CWLITEXMEGA”:

~/work/projects/chipwhisperer/software/chipwhisperer/capture/scopes/OpenADC.py in default_setup(self)
165
166 self.clock.adc_src = “clkgen_x4”
→ 167 self.io.cdc_settings = 0
168
169 count = 0

~/work/projects/chipwhisperer/software/chipwhisperer/common/utils/util.py in setattr(self, name, value)
349
350 def setattr(self, name, value):
→ 351 if hasattr(self, ‘_new_attributes_disabled’) and self._new_attributes_disabled and not hasattr(self, name): # would this create a new attribute?
352 raise AttributeError(“Attempt to set unknown attribute in %s”%self.class, name)
353 super(DisableNewAttr, self).setattr(name, value)

~/work/projects/chipwhisperer/software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererExtra.py in cdc_settings(self)
210 if ver < ‘0.30’:
211 return None
→ 212 return self.cwe.oa.serial.get_cdc_settings()
213
214 @cdc_settings.setter

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in get_cdc_settings(self)
670
671 def get_cdc_settings(self):
→ 672 return self.usbtx.readCtrl(self.CMD_CDC_SETTINGS_EN, dlen=2)
673
674 def set_cdc_settings(self, port=[1, 1]):

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in readCtrl(self, cmd, value, dlen)
501 “”"
502 # Vendor-specific, IN, interface control transfer
→ 503 return self.usbdev().ctrl_transfer(0xC1, cmd, value, 0, dlen, timeout=self._timeout)
504
505 def cmdReadMem(self, addr, dlen):

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in ctrl_transfer(self, bmRequestType, bRequest, wValue, wIndex, data_or_wLength, timeout)
1077 wIndex,
1078 buff,
→ 1079 self.__get_timeout(timeout))
1080
1081 if isinstance(data_or_wLength, array.array) \

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/backend/libusb1.py in ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue, wIndex, data, timeout)
899 cast(addr, POINTER(c_ubyte)),
900 length,
→ 901 timeout))
902
903 return ret

~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/backend/libusb1.py in _check(ret)
602 raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
603 else:
→ 604 raise USBError(_strerror(ret), ret, _libusb_errno[ret])
605
606 return ret

USBError: [Errno 32] Pipe error

Did a git pull and re-executed this but still the same problem.

There are no other USB devices plugged in and I’ve gone through several of the USB ports. I don’t think the firmware upgrade will work because the scope function is executed as part of this and that function has yet to be executed successfully.

Perhaps worth mentioning is that there’s a green LED that starts flashing like crazy this time round when trying to test the hardware, it is near the USB power source and is labelled D4

OK I think it’s getting further - the firmware might be out of sync with the latest version. The quick way of updating it is to default back to the bootloader, described here: CW1173 ChipWhisperer-Lite - NewAE Hardware Product Documentation

This just can be shorted with a piece of wire, paperclip, etc. Once you do that plug it in and check it comes up as a serial port (if no driver it needs the Atmel USB-CDC driver, available here
Atmel 6124 CDC.zip (5.5 KB)).

Then from your “Target” chipwhisperer installation, run:

import chipwhisperer as cw
cw.program_sam_firmware(hardware_type='cwlite')

The API for older CW changed a bit with firmware updates, so see this section which has the new one & link to old one: Updating Firmware — ChipWhisperer 5.6.1 documentation

OK that should be fine! That means the FPGA programmed OK, so that “Done Error” was indeed just a software problem.

That is a good sign since it sounds like “everything works”, at least on the hardware level, and for some reason there was an issue with the one release. You could also go backwards if still having trouble to an older release for now which are somewhat better tested.

Sorry for the problems! Normally it should all “just work”, when it doesn’t we end up dancing around a bit to see where the issue is… but hopefully stable after that.

PS - if you go to an older version of the ChipWhisperer, you can use the “force erase” method to clear out the firmware on the CW-Lite. You can then run the upgrade method from the older ChipWhisperer installer to ensure it’s a compatible firmware version.

Older (pre-5.6) releases use this API:

import chipwhisperer as cw
programmer = cw.SAMFWLoader(scope=None)
programmer.program("COMxx", hardware_type='cwlite')

Where "COMxx" is com port number on windows, or replace with \dev\ttyUSB0 etc on Linux.

I managed to upgrade the firmware. So far so good. Thanks for the help!

1 Like