Demos>CW-Pro Using SAD (Analog Pattern) Trigger - Attacking AES.ipynb

Hello,
I am trying to implement the Attacking AES Without A Trigger demo. On the other hand, I receive an error code when I compile the code in the Setup and Stream Mode section. I shared the whole error code at the end of this message. In case of connection issues, I shared the connection. Please let me know what I overlook. Thanks.


USBErrorIO Traceback (most recent call last)
~\chipwhisperer\jupyter\Setup_Scripts\Setup_Generic.ipynb in
19
20 try:
—> 21 target = cw.target(scope, target_type)
22 except IOError:
23 print(“INFO: Caught exception on reconnecting to target - attempting to reconnect to scope first.”)

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py in target(scope, target_type, **kwargs)
364 “”"
365 rtn = target_type()
→ 366 rtn.con(scope, **kwargs)
367
368 # need to check

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets_base.py in con(self, scope, **kwargs)
63 try:
64 self.connectStatus = True
—> 65 self._con(scope, **kwargs)
66 except:
67 self.dis()

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets\SimpleSerial.py in _con(self, scope)
171 if not scope or not hasattr(scope, “qtadc”): Warning(“You need a scope with OpenADC connected to use this Target”)
172
→ 173 self.ser.con(scope)
174 # ‘x’ flushes everything & sets system back to idle
175 self.ser.write(“xxxxxxxxxxxxxxxxxxxxxxxx”)

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets\simpleserial_readers\cwlite.py in con(self, scope)
61 ser = scope._cwusb
62 self.cwlite_usart = scope.usart
—> 63 self.cwlite_usart.init(baud=self._baud)
64
65

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\serial.py in init(self, baud, stopbits, parity)
99 cmdbuf.append(8) # Data bits
100
→ 101 self._usartTxCmd(self.USART_CMD_INIT, cmdbuf)
102 self._usartTxCmd(self.USART_CMD_ENABLE)
103 target_logger.info(“Serial baud rate = {}”.format(baud))

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\serial.py in _usartTxCmd(self, cmd, data)
217
218 # windex selects interface
→ 219 self._usb.sendCtrl(self.CMD_USART0_CONFIG, (self._usart_num << 8) | cmd, data)
220
221 def _usartRxCmd(self, cmd, dlen=1):

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in sendCtrl(self, cmd, value, data)
713 “”"
714 # Vendor-specific, OUT, interface control transfer
→ 715 self.usbserializer.sendCtrl(cmd, value, data)
716
717 def readCtrl(self, cmd : int, value : int=0, dlen : int=0) → bytearray:

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in sendCtrl(self, cmd, value, data)
465 bRequest: {:02X}, wValue: {:04X}, wIndex: {:04X}, data: {}".format(0x41, cmd,
466 value, 0, data))
→ 467 self.handle.controlWrite(0x41, cmd, value, 0, data, timeout=self._timeout)
468 #return self.usbdev().ctrl_transfer(0x41, cmd, value, 0, data, timeout=self._timeout)
469

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in controlWrite(self, request_type, request, value, index, data, timeout)
1329 data, _ = create_initialised_buffer(data)
1330 return self._controlTransfer(request_type, request, value, index, data,
→ 1331 sizeof(data), timeout)
1332
1333 def controlRead(

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in _controlTransfer(self, request_type, request, value, index, data, length, timeout)
1305 timeout,
1306 )
→ 1307 mayRaiseUSBError(result)
1308 return result
1309

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in mayRaiseUSBError(value, __raiseUSBError)
125 ):
126 if value < 0:
→ 127 __raiseUSBError(value)
128 return value
129

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in raiseUSBError(value, __STATUS_TO_EXCEPTION_DICT, __USBError)
117 __USBError=USBError,
118 ): # pylint: disable=dangerous-default-value
→ 119 raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
120
121 def mayRaiseUSBError(

USBErrorIO: LIBUSB_ERROR_IO [-1]


USBErrorIO Traceback (most recent call last)
in
----> 1 get_ipython().run_line_magic(‘run’, ‘"…/Setup_Scripts/Setup_Generic.ipynb"’)

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2346 kwargs[‘local_ns’] = self.get_local_scope(stack_depth)
2347 with self.builtin_trap:
→ 2348 result = fn(*args, **kwargs)
2349 return result
2350

~\WPy64-3771\python-3.7.7.amd64\lib\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

~\WPy64-3771\python-3.7.7.amd64\lib\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):

~\WPy64-3771\python-3.7.7.amd64\lib\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

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
2833 result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
2834 if raise_exceptions:
→ 2835 result.raise_error()
2836 elif not result.success:
2837 break

~\WPy64-3771\python-3.7.7.amd64\lib\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
19
20 try:
—> 21 target = cw.target(scope, target_type)
22 except IOError:
23 print(“INFO: Caught exception on reconnecting to target - attempting to reconnect to scope first.”)

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py in target(scope, target_type, **kwargs)
364 “”"
365 rtn = target_type()
→ 366 rtn.con(scope, **kwargs)
367
368 # need to check

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets_base.py in con(self, scope, **kwargs)
63 try:
64 self.connectStatus = True
—> 65 self._con(scope, **kwargs)
66 except:
67 self.dis()

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets\SimpleSerial.py in _con(self, scope)
171 if not scope or not hasattr(scope, “qtadc”): Warning(“You need a scope with OpenADC connected to use this Target”)
172
→ 173 self.ser.con(scope)
174 # ‘x’ flushes everything & sets system back to idle
175 self.ser.write(“xxxxxxxxxxxxxxxxxxxxxxxx”)

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets\simpleserial_readers\cwlite.py in con(self, scope)
61 ser = scope._cwusb
62 self.cwlite_usart = scope.usart
—> 63 self.cwlite_usart.init(baud=self._baud)
64
65

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\serial.py in init(self, baud, stopbits, parity)
99 cmdbuf.append(8) # Data bits
100
→ 101 self._usartTxCmd(self.USART_CMD_INIT, cmdbuf)
102 self._usartTxCmd(self.USART_CMD_ENABLE)
103 target_logger.info(“Serial baud rate = {}”.format(baud))

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\serial.py in _usartTxCmd(self, cmd, data)
217
218 # windex selects interface
→ 219 self._usb.sendCtrl(self.CMD_USART0_CONFIG, (self._usart_num << 8) | cmd, data)
220
221 def _usartRxCmd(self, cmd, dlen=1):

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in sendCtrl(self, cmd, value, data)
713 “”"
714 # Vendor-specific, OUT, interface control transfer
→ 715 self.usbserializer.sendCtrl(cmd, value, data)
716
717 def readCtrl(self, cmd : int, value : int=0, dlen : int=0) → bytearray:

c:\users\cetin\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in sendCtrl(self, cmd, value, data)
465 bRequest: {:02X}, wValue: {:04X}, wIndex: {:04X}, data: {}".format(0x41, cmd,
466 value, 0, data))
→ 467 self.handle.controlWrite(0x41, cmd, value, 0, data, timeout=self._timeout)
468 #return self.usbdev().ctrl_transfer(0x41, cmd, value, 0, data, timeout=self._timeout)
469

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in controlWrite(self, request_type, request, value, index, data, timeout)
1329 data, _ = create_initialised_buffer(data)
1330 return self._controlTransfer(request_type, request, value, index, data,
→ 1331 sizeof(data), timeout)
1332
1333 def controlRead(

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in _controlTransfer(self, request_type, request, value, index, data, length, timeout)
1305 timeout,
1306 )
→ 1307 mayRaiseUSBError(result)
1308 return result
1309

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in mayRaiseUSBError(value, __raiseUSBError)
125 ):
126 if value < 0:
→ 127 __raiseUSBError(value)
128 return value
129

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb1_init_.py in raiseUSBError(value, __STATUS_TO_EXCEPTION_DICT, __USBError)
117 __USBError=USBError,
118 ): # pylint: disable=dangerous-default-value
→ 119 raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
120
121 def mayRaiseUSBError(

USBErrorIO: LIBUSB_ERROR_IO [-1]

Hi,

Can you run print(scope.fw_version_str) after you connect and post the result? We recently fixed some bugs related to streaming, so it might just be that you’re on an old firmware version.

Alex

Hello @Alex_Dewar ,
I wanted to inform those who have this problem. My connection in the picture is correct, so it will give you an idea(see all of the lights on). I got this error code because I connected devices by implementing “1 - Connecting to Hardware.ipynb” first.On the other hand, I get no error code when I implement this demo right after I connect devices on my computer. I think I need to disconnect and start over to implement a new application. It will be good if you share if there is an easier way to reset the device. Thank you!

Yeah, you need to disconnect after each notebook. Unfortunately, there’s nothing we can do about this - Windows doesn’t allow you to connect from multiple processes at the same time and there’s no way to auto disconnect.

Alex