CWLite failure to call cw.scope()

I have the SCAPACK-L2 with a CWLite board. Running all of this natively on Ubuntu 20.04. I’m trying to work through the Jupyter notebooks and got to the first one (1 - Connecting to Hardware.ipynb) where something went wrong. I don’t remember what I did to end up in this state, but now when I try to run these two lines:

import chipwhisperer as cw
scope = cw.scope()

it errors out. Since I can’t get the cw.scope() line to work, I followed the steps of manually programming (using the instructions here). Even after the firmware flash, I still cannot call cw.scope(). Perhaps I am completely misunderstanding, so any help would be appreciated, thanks! Below is the output when I re-flash it, unplug, replug, and try to call cw.scope() (all manually from the python).

Python 3.9.5 (default, Jun  7 2022, 18:18:40) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chipwhisperer as cw
>>> cw.program_sam_firmware(hardware_type="cwlite")
Found /dev/ttyACM0
Loading cwlite firmware...
Opened!
Connecting...
Connected!
Erasing...
Erased!
Programming file SAM3U_CW1173.bin...
Programmed!
Verifying...
Verify OK!
Resetting...
Upgrade successful
>>> scope = cw.scope()
(ChipWhisperer Target ERROR|File fpga.py:104) FPGA programming failed. Typically either bad bitstream or prog speed too high (current 10000000)
(ChipWhisperer Scope ERROR|File __init__.py:339) ChipWhisperer error state detected. Resetting and retrying connection...
Traceback (most recent call last):
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/__init__.py", line 337, in scope
    rtn.con(**kwargs)
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/capture/scopes/OpenADC.py", line 512, in con
    self.scopetype.con(sn, idProduct, bitstream, force, prog_speed, **kwargs)
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/capture/scopes/openadc_interface/naeusbchip.py", line 79, in con
    self.fpga.FPGAProgram(self.getFWConfig().loader.fpga_bitstream(), prog_speed=prog_speed)
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/hardware/naeusb/fpga.py", line 105, in FPGAProgram
    raise IOError("FPGA Done pin failed to go high, bad bitstream?", bitstream)
OSError: [Errno FPGA Done pin failed to go high, bad bitstream?] <zipfile.ZipExtFile [closed]>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/__init__.py", line 340, in scope
    rtn._getNAEUSB().reset()
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py", line 986, in reset
    if self.check_feature("RESET", True):
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py", line 993, in check_feature
    prod_id = self.usbtx.device.getProductID()
AttributeError: 'NoneType' object has no attribute 'getProductID'
>>> 

I have tried flashing it twice now both in Windows and my Ubuntu system with the same results on both. Thanks again in advance for any help!

Hi,

Can you try connecting with scope = cw.scope(prog_speed=1E6)?

Sure, here are the results:

>>> cw.scope(prog_speed=1E6)
(ChipWhisperer Target ERROR|File fpga.py:104) FPGA programming failed. Typically either bad bitstream or prog speed too high (current 1000000)
(ChipWhisperer Scope ERROR|File __init__.py:339) ChipWhisperer error state detected. Resetting and retrying connection...
Traceback (most recent call last):
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/__init__.py", line 337, in scope
    rtn.con(**kwargs)
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/capture/scopes/OpenADC.py", line 512, in con
    self.scopetype.con(sn, idProduct, bitstream, force, prog_speed, **kwargs)
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/capture/scopes/openadc_interface/naeusbchip.py", line 79, in con
    self.fpga.FPGAProgram(self.getFWConfig().loader.fpga_bitstream(), prog_speed=prog_speed)
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/hardware/naeusb/fpga.py", line 105, in FPGAProgram
    raise IOError("FPGA Done pin failed to go high, bad bitstream?", bitstream)
OSError: [Errno FPGA Done pin failed to go high, bad bitstream?] <zipfile.ZipExtFile [closed]>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/__init__.py", line 340, in scope
    rtn._getNAEUSB().reset()
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py", line 986, in reset
    if self.check_feature("RESET", True):
  File "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py", line 993, in check_feature
    prod_id = self.usbtx.device.getProductID()
AttributeError: 'NoneType' object has no attribute 'getProductID'

I also tried the same thing with even slower prog_speeds of 1E5 and 1E4 with similar results.

For a little more info: I only have the CWLite connected to my PC using a USB cable directly into the back of my PC. I’ve also tried other USB cables to confirm that isn’t the issue. I’m running this all in the cw pyenv that the instructions have you set up. The CWLite is not connected to the UFO board, so there is no TARGET connected, but I don’t think that should be impacting anything with cw.scope().

Hi,

Sorry for the late response. Out of curiosity, can you try replacing "/home/dev001/Documents/for_fun/chip_whisperer/chipwhisperer/software/chipwhisperer/hardware/firmware/cwlite.py" with https://raw.githubusercontent.com/newaetech/chipwhisperer/5.1.1/software/chipwhisperer/hardware/firmware/cwlite.py, then unplug/replug and restart python?

Alex

No worries, I really appreciate the help!

I tried connecting after replacing my cwlite.py file and re-plugging the board, and got the same results as I’ve been getting. I confirmed the new version of the file was running with a print statement as well, so it’s definitely using the new file.

As a sanity check, that blue LED (D9) by the UART holes starts blinking when plugged in an idling. This is expected yeah?