CWNANO SCA-01 Lab 2_1

So I was just here typing this problem up when I went back to try again and it worked so I deleted the post. As soon as I did the problem came back.

I did run the ChipWhisperer Setup Test.ipynb and it worked just fine.

I copied the Hardware code to the MAIN.
I didnt copy the creating a director but I did run it

I copied


Building the firmware
Then for connecitng to hardware I split it into three sections. it errors on section 2 or hangs on section 1. Like I said I reboot the VM and came back it hung the first time and then I reset the kernel and replugged the usb in and it work. Now it doesnt work at all. just fir SnG I restarted the kernel again and unplugged the USB and plugged it back in and it hangs on Section 1. I have 27 CWNANOs I can try others but I get the same for both of the two I have tried already.

section 1:

import chipwhisperer as cw
    if not scope.connectStatus:
except NameError:
    scope = cw.scope()

Section 2:

    target =
except IOError:
    print("INFO: Caught exception on reconnecting to target - attempting to reconnect to scope first.")
    print("INFO: This is a work-around when USB has died without Python knowing. Ignore errors above this line.")
    scope = cw.scope()
    target =

print("INFO: Found ChipWhispereršŸ˜")

The error reads like the USB is hung: If it is do I need to reboot the VM between every retest? That would be painful

USBErrorNoDevice                          Traceback (most recent call last)
Input In [20], in <cell line: 1>()
      1 try:
----> 2     target =
      3 except IOError:
      4     print("INFO: Caught exception on reconnecting to target - attempting to reconnect to scope first.")

File ~/work/projects/chipwhisperer/software/chipwhisperer/, in target(scope, target_type, **kwargs)
    350 """Create a target object and connect to it.
    352 Args:
    362     Connected target object specified by target_type.
    363 """
    364 rtn = target_type()
--> 365 rtn.con(scope, **kwargs)
    367 # need to check
    368 if type(rtn) in (targets.SimpleSerial, targets.SimpleSerial2) \
    369     and scope and scope._getNAEUSB().check_feature("SERIAL_200_BUFFER"):

File ~/work/projects/chipwhisperer/software/chipwhisperer/capture/targets/, in TargetTemplate.con(self, scope, **kwargs)
     63 try:
     64     self.connectStatus = True
---> 65     self._con(scope, **kwargs)
     66 except:
     67     self.dis()

File ~/work/projects/chipwhisperer/software/chipwhisperer/capture/targets/, in SimpleSerial._con(self, scope, **kwargs)
    181 def _con(self, scope = None, **kwargs):
    182     if not scope or not hasattr(scope, "qtadc"): Warning("You need a scope with OpenADC connected to use this Target")
--> 184     self.ser.con(scope)
    185     # 'x' flushes everything & sets system back to idle
    186     self.ser.write("xxxxxxxxxxxxxxxxxxxxxxxx")

File ~/work/projects/chipwhisperer/software/chipwhisperer/capture/targets/simpleserial_readers/, in SimpleSerial_ChipWhispererLite.con(self, scope)
     61     ser = scope._cwusb
     62     self.cwlite_usart = scope.usart
---> 63 self.cwlite_usart.init(baud=self._baud)

File ~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/, in USART.init(self, baud, stopbits, parity)
     99 cmdbuf.append(parity)
    100 cmdbuf.append(8)  # Data bits
--> 102 self._usartTxCmd(self.USART_CMD_INIT, cmdbuf)
    103 self._usartTxCmd(self.USART_CMD_ENABLE)
    104"Serial baud rate = {}".format(baud))

File ~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/, in USART._usartTxCmd(self, cmd, data)
    215 """
    216 Send a command to the USART interface (internal function).
    217 """
    219 # windex selects interface
--> 220 self._usb.sendCtrl(self.CMD_USART0_CONFIG, (self._usart_num << 8) | cmd, data)

File ~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/, in NAEUSB.sendCtrl(self, cmd, value, data)
    724 """
    725 Send data over control endpoint
    726 """
    727 # Vendor-specific, OUT, interface control transfer
--> 728 self.usbserializer.sendCtrl(cmd, value, data)

File ~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/, in NAEUSB_Backend.sendCtrl(self, cmd, value, data)
    469 # Vendor-specific, OUT, interface control transfer
    470 naeusb_logger.debug("WRITE_CTRL: bmRequestType: {:02X}, \
    471             bRequest: {:02X}, wValue: {:04X}, wIndex: {:04X}, data: {}".format(0x41, cmd, \
    472                 value, 0, data))
--> 473 self.handle.controlWrite(0x41, cmd, value, 0, data, timeout=self._timeout)

File ~/.pyenv/versions/3.9.7/envs/cw/lib/python3.9/site-packages/libusb1-3.0.0-py3.9.egg/usb1/, in USBDeviceHandle.controlWrite(self, request_type, request, value, index, data, timeout)
   1328 # pylint: enable=undefined-variable
   1329 data, _ = create_initialised_buffer(data)
-> 1330 return self._controlTransfer(request_type, request, value, index, data,
   1331                              sizeof(data), timeout)

File ~/.pyenv/versions/3.9.7/envs/cw/lib/python3.9/site-packages/libusb1-3.0.0-py3.9.egg/usb1/, in USBDeviceHandle._controlTransfer(self, request_type, request, value, index, data, length, timeout)
   1301 def _controlTransfer(
   1302         self, request_type, request, value, index, data, length, timeout):
   1303     result = libusb1.libusb_control_transfer(
   1304         self.__handle, request_type, request, value, index, data, length,
   1305         timeout,
   1306     )
-> 1307     mayRaiseUSBError(result)
   1308     return result

File ~/.pyenv/versions/3.9.7/envs/cw/lib/python3.9/site-packages/libusb1-3.0.0-py3.9.egg/usb1/, in mayRaiseUSBError(value, __raiseUSBError)
    121 def mayRaiseUSBError(
    122         value,
    123         # Avoid globals lookup on call to work during interpreter shutdown.
    124         __raiseUSBError=raiseUSBError,
    125     ):
    126     if value < 0:
--> 127         __raiseUSBError(value)
    128     return value

File ~/.pyenv/versions/3.9.7/envs/cw/lib/python3.9/site-packages/libusb1-3.0.0-py3.9.egg/usb1/, in raiseUSBError(value, __STATUS_TO_EXCEPTION_DICT, __USBError)
    113 def raiseUSBError(
    114         value,
    115         # Avoid globals lookup on call to work during interpreter shutdown.
    117         __USBError=USBError,
    118     ): # pylint: disable=dangerous-default-value
--> 119     raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)


section 3:

    prog = cw.programmers.STM32FProgrammer
    prog = cw.programmers.XMEGAProgrammer
    prog = None
import time
def reset_target(scope):
    if PLATFORM == "CW303" or PLATFORM == "CWLITEXMEGA": = 'low'
        time.sleep(0.05) = 'high_z' #XMEGA doesn't like pdic driven high
    else:  = 'low'
        time.sleep(0.05) = 'high_z'

This is a couple minutes later:


Sorry for the late reply here.

Can you try the following:

  1. Restart the VM
  2. Log into the VM (user/pass are both vagrant)
  3. Access jupyter from your web browser, then cause the error youā€™re describing to happen.
  4. From the command line, run the following: sudo dmesg > work/projects/chipwhisperer/jupyter/dmesg.txt.
  5. Access jupyter from your web browser (localhost:8888) and use that to download dmesg.txt
  6. Upload dmesg.txt.