Problem in CW305_ECC

Hi everyone, I have already done ChipWhisperer Firmware Upgrade before I do this section(CW305_ECC), but when I follow the steps in CW305_ECC, some USBError happened


Does anyone know how to solve this error? Please help me.Thank you~

That’s strange, we should use the libusb1 backend on new firmware. Can you find both your capture and target boards in device manager and post the full error message?

Alex

Error message is below:

USBError Traceback (most recent call last)
in
6 scope.gain.db = 50
7 elif PLATFORM == ‘CWLITE’:
----> 8 scope.adc.samples = 24400
9 target.pll.pll_outfreq_set(50E6, 1)
10 target._clksleeptime = 30

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\common\utils\util.py in 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)
354
355

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py in samples(self, samples)
779 scope_logger.warning(“Sakura G samples must be divisible by 12, rounding up to {}…”.format(samples))
780
–> 781 if self._get_fifo_fill_mode() == “segment”:
782 diff = (3 - (samples - 1) % 3)
783 samples += diff

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py in _get_fifo_fill_mode(self)
967
968 def _get_fifo_fill_mode(self):
–> 969 result = self.oa.sendMessage(CODE_READ, ADDR_ADVCLK, maxResp=4)
970 mode = result[3] & 0x30
971

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py in sendMessage(self, mode, address, payload, Validate, maxResp, readMask)
2320 datalen = 1
2321
-> 2322 data = bytearray(self.serial.cmdReadMem(address, datalen))
2323 return data
2324

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
798 “”"
799
–> 800 return self.usbseralizer.cmdReadMem(addr, dlen)
801
802 def cmdWriteMem(self, addr, data):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
202 cmdpacket = self.make_cmd(self.CMD_READ_MEM, payload)
203
–> 204 return self.process_rx(self.txrx(tx=cmdpacket))
205
206 def cmdWriteMem(self, addr, data):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in txrx(self, tx)
311 addr = payload[0]
312 dlen = payload[1]
–> 313 response = self.cmdReadMem(addr, dlen)
314 naeusb_logger.debug(“CMD_READ_MEM: addr: {:08X}, dlen: {:08X}, response: {}”.format(addr, dlen, response))
315 elif cmd == self.CMD_WRITE_MEM:

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
520 pload.extend(packuint32(addr))
521 try:
–> 522 self.sendCtrl(cmd, data=pload)
523 except usb.USBError as e:
524 if “Pipe error” in str(e):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in sendCtrl(self, cmd, value, data)
494 “”"
495 # Vendor-specific, OUT, interface control transfer
–> 496 return self.usbdev().ctrl_transfer(0x41, cmd, value, 0, data, timeout=self._timeout)
497
498 def readCtrl(self, cmd, value=0, dlen=0):

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

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\backend\libusb0.py in ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue, wIndex, data, timeout)
607 cast(address, c_char_p),
608 length,
–> 609 timeout
610 ))
611

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\backend\libusb0.py in _check(ret)
445 if ret is not None and -ret == errno.ETIMEDOUT:
446 raise USBTimeoutError(errmsg, ret, -ret)
–> 447 raise USBError(errmsg, ret)
448
449 def _has_iso_transfer():

USBError: [Errno None] b’libusb0-dll:err [control_msg] sending control message failed, win error: \xb8\xcb\xb8m\xb5L\xaak\xbf\xeb\xc3\xd1\xa9R\xa5O\xa1C\r\n\n’

Sanity check: make sure we’ve loaded the right bitfile!

assert (target.get_fpga_buildtime() == ‘FPGA build time: 10/13/2020, 9:31’ or
target.get_fpga_buildtime() == ‘FPGA build time: 10/22/2020, 13:38’)

USBError Traceback (most recent call last)
in
----> 1 assert (target.get_fpga_buildtime() == ‘FPGA build time: 10/13/2020, 9:31’ or
2 target.get_fpga_buildtime() == ‘FPGA build time: 10/22/2020, 13:38’)

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets\CW305.py in get_fpga_buildtime(self)
183 “”“Returns date and time when FPGA bitfile was generated.
184 “””
–> 185 raw = self.fpga_read(self.REG_BUILDTIME, 4)
186 # definitions: Xilinx XAPP1232
187 day = raw[3] >> 3

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets\CW305.py in fpga_read(self, addr, readlen)
219 raise ValueError(“Invalid read len {}”.format(readlen))
220 addr = addr << self.bytecount_size
–> 221 data = self._naeusb.cmdReadMem(addr, readlen)
222 return data
223

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
798 “”"
799
–> 800 return self.usbseralizer.cmdReadMem(addr, dlen)
801
802 def cmdWriteMem(self, addr, data):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
202 cmdpacket = self.make_cmd(self.CMD_READ_MEM, payload)
203
–> 204 return self.process_rx(self.txrx(tx=cmdpacket))
205
206 def cmdWriteMem(self, addr, data):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in txrx(self, tx)
311 addr = payload[0]
312 dlen = payload[1]
–> 313 response = self.cmdReadMem(addr, dlen)
314 naeusb_logger.debug(“CMD_READ_MEM: addr: {:08X}, dlen: {:08X}, response: {}”.format(addr, dlen, response))
315 elif cmd == self.CMD_WRITE_MEM:

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
520 pload.extend(packuint32(addr))
521 try:
–> 522 self.sendCtrl(cmd, data=pload)
523 except usb.USBError as e:
524 if “Pipe error” in str(e):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in sendCtrl(self, cmd, value, data)
494 “”"
495 # Vendor-specific, OUT, interface control transfer
–> 496 return self.usbdev().ctrl_transfer(0x41, cmd, value, 0, data, timeout=self._timeout)
497
498 def readCtrl(self, cmd, value=0, dlen=0):

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

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\backend\libusb0.py in ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue, wIndex, data, timeout)
607 cast(address, c_char_p),
608 length,
–> 609 timeout
610 ))
611

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\backend\libusb0.py in _check(ret)
445 if ret is not None and -ret == errno.ETIMEDOUT:
446 raise USBTimeoutError(errmsg, ret, -ret)
–> 447 raise USBError(errmsg, ret)
448
449 def _has_iso_transfer():

USBError: [Errno None] b’libusb0-dll:err [control_msg] sending control message failed, win error: \xb8\xcb\xb8m\xb5L\xaak\xbf\xeb\xc3\xd1\xa9R\xa5O\xa1C\r\n\n’

This is the full error message and my device manager

Hi,

Can you uninstall the drivers for both the CW305 and the ChipWhisperer Lite in device manager? It looks like the devices are still using the old drivers. Instructions for that are here: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/using-device-manager-to-uninstall-devices-and-driver-packages

Alex

Hi,
I tried to uninstall the drivers for both the CW305 and the ChipWhisperer Lite in device manager, and I plugged in again to rerun CW305_ECC, but still got some error.


USBError Traceback (most recent call last)
in
6 scope.gain.db = 50
7 elif PLATFORM == ‘CWLITE’:
----> 8 scope.adc.samples = 24400
9 target.pll.pll_outfreq_set(50E6, 1)
10 target._clksleeptime = 30

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\common\utils\util.py in 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)
354
355

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py in samples(self, samples)
779 scope_logger.warning(“Sakura G samples must be divisible by 12, rounding up to {}…”.format(samples))
780
→ 781 if self._get_fifo_fill_mode() == “segment”:
782 diff = (3 - (samples - 1) % 3)
783 samples += diff

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py in _get_fifo_fill_mode(self)
967
968 def _get_fifo_fill_mode(self):
→ 969 result = self.oa.sendMessage(CODE_READ, ADDR_ADVCLK, maxResp=4)
970 mode = result[3] & 0x30
971

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py in sendMessage(self, mode, address, payload, Validate, maxResp, readMask)
2320 datalen = 1
2321
→ 2322 data = bytearray(self.serial.cmdReadMem(address, datalen))
2323 return data
2324

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
798 “”"
799
→ 800 return self.usbseralizer.cmdReadMem(addr, dlen)
801
802 def cmdWriteMem(self, addr, data):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
202 cmdpacket = self.make_cmd(self.CMD_READ_MEM, payload)
203
→ 204 return self.process_rx(self.txrx(tx=cmdpacket))
205
206 def cmdWriteMem(self, addr, data):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in txrx(self, tx)
311 addr = payload[0]
312 dlen = payload[1]
→ 313 response = self.cmdReadMem(addr, dlen)
314 naeusb_logger.debug(“CMD_READ_MEM: addr: {:08X}, dlen: {:08X}, response: {}”.format(addr, dlen, response))
315 elif cmd == self.CMD_WRITE_MEM:

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in cmdReadMem(self, addr, dlen)
520 pload.extend(packuint32(addr))
521 try:
→ 522 self.sendCtrl(cmd, data=pload)
523 except usb.USBError as e:
524 if “Pipe error” in str(e):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in sendCtrl(self, cmd, value, data)
494 “”"
495 # Vendor-specific, OUT, interface control transfer
→ 496 return self.usbdev().ctrl_transfer(0x41, cmd, value, 0, data, timeout=self._timeout)
497
498 def readCtrl(self, cmd, value=0, dlen=0):

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

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

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\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 5] Input/Output Error

And the device CW305 and the ChipWhisperer Lite in device manager will be below universal serial bus.Is it correct?

Yup, they’ve got the right driver now.

It seems like there’s been a few unintended changes with the newest FPGA bitstream. Can you try downloading https://github.com/newaetech/chipwhisperer/blob/9c8b5560fb6a954d24ee97dc4eb3091ff0a46484/software/chipwhisperer/hardware/firmware/cwlite.py and replacing chipwhisperer/software/hardware/firmware/cwlite.py in your ChipWhisperer installation?

The bitstream is programmed on startup+connect, so if you unplug+replug and reconnect, the new bitstream will be reloaded.

Alex

1 Like

Hi Alex,
Do I need to reinstall driver(ex:cwlite_usbdriver and cw305_usbdriver) for my cwlite and cw305 board?

Oscar

I tried to download and replaced cwlite.py in your ChipWhisperer installation, and directly use ChipWhisperer Firmware Upgrade.ipynb to upgrade, and ten I go to execute CW305_ECC in Jupyter notebook,but when I run this one, it will get some error:


NotImplementedError Traceback (most recent call last)
in
1 import chipwhisperer as cw
2
----> 3 scope = cw.scope()
4 scope.gain.db = 50
5 scope.adc.offset = 0

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py in scope(scope_type, sn)
227 from chipwhisperer.common.utils.util import get_cw_type
228 if scope_type is None:
→ 229 scope_type = get_cw_type(sn)
230 scope = scope_type()
231 try:

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\common\utils\util.py in get_cw_type(sn)
498
499 cwusb = NAEUSB()
→ 500 possible_sn = cwusb.get_possible_devices(idProduct=possible_ids)
501 name = “”
502 if len(possible_sn) == 0:

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in get_possible_devices(self, idProduct)
667
668 def get_possible_devices(self, idProduct):
→ 669 return self.usbseralizer.get_possible_devices(idProduct)
670
671 def get_cdc_settings(self):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in get_possible_devices(self, idProduct)
135 “”“Get a list of connected USB devices.”“”
136 cmdpacket = self.make_cmd(self.GET_POSSIBLE_DEVICES, idProduct)
→ 137 return self.process_rx(self.txrx(tx=cmdpacket))
138
139 def process_rx(self, inp):

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in txrx(self, tx)
324 #naeusb_logger.debug(“CMD_WRITE_MEM_SAM3U: addr: {}”) #skip this one for now
325 elif cmd == self.GET_POSSIBLE_DEVICES:
→ 326 response = self.get_possible_devices(payload)
327 elif cmd == self.OPEN:
328 response = self.open(serial_number=payload)

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in get_possible_devices(self, idProduct, dictonly, backend)
468 raise
469 if dictonly:
→ 470 devlist = [{‘sn’: d.serial_number, ‘product’: d.product, ‘pid’: d.idProduct, ‘vid’: d.idVendor} for d in devlist]
471
472 try:

c:\users\oscar\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py in (.0)
468 raise
469 if dictonly:
→ 470 devlist = [{‘sn’: d.serial_number, ‘product’: d.product, ‘pid’: d.idProduct, ‘vid’: d.idVendor} for d in devlist]
471
472 try:

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\core.py in serial_number(self)
852 “”"
853 if self._serial_number is None:
→ 854 self._serial_number = util.get_string(self, self.iSerialNumber)
855 return self._serial_number
856

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\util.py in get_string(dev, index, langid)
309
310 if langid is None:
→ 311 langids = dev.langids
312 if 0 == len(langids):
313 raise ValueError(“The device has no langid”

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\core.py in langids(self)
839 if self._langids is None:
840 try:
→ 841 self._langids = util.get_langids(self)
842 except USBError:
843 self._langids = ()

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\util.py in get_langids(dev)
268 254,
269 DESC_TYPE_STRING,
→ 270 0
271 )
272

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\control.py in get_descriptor(dev, desc_size, desc_type, desc_index, wIndex)
173 wValue = wValue,
174 wIndex = wIndex,
→ 175 data_or_wLength = desc_size)
176
177 if len(desc) < 2:

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\core.py in ctrl_transfer(self, bmRequestType, bRequest, wValue, wIndex, data_or_wLength, timeout)
1059 buff = _interop.as_array(data_or_wLength)
1060
→ 1061 self._ctx.managed_open()
1062
1063 # Thanks to Johannes Stezenbach to point me out that we need to

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\core.py in wrapper(self, *args, **kwargs)
111 try:
112 self.lock.acquire()
→ 113 return f(self, *args, **kwargs)
114 finally:
115 self.lock.release()

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\core.py in managed_open(self)
129 def managed_open(self):
130 if self.handle is None:
→ 131 self.handle = self.backend.open_device(self.dev)
132 return self.handle
133

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\backend\libusb1.py in open_device(self, dev)
802 @methodtrace(_logger)
803 def open_device(self, dev):
→ 804 return _DeviceHandle(dev)
805
806 @methodtrace(_logger)

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\backend\libusb1.py in init(self, dev)
650 self.handle = _libusb_device_handle()
651 self.devid = dev.devid
→ 652 _check(_lib.libusb_open(self.devid, byref(self.handle)))
653
654 class _IsoTransferHandler(_objfinalizer.AutoFinalizedObject):

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\usb\backend\libusb1.py in _check(ret)
598 if ret < 0:
599 if ret == LIBUSB_ERROR_NOT_SUPPORTED:
→ 600 raise NotImplementedError(_strerror(ret))
601 elif ret == LIBUSB_ERROR_TIMEOUT:
602 raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])

NotImplementedError: Operation not supported or unimplemented on this platform


Do I need to reinstall driver(ex:cwlite_usbdriver and cw305_usbdriver) for my cwlite and cw305 board?

You shouldn’t use the ChipWhisperer firmware upgrade. You only want to reload the FPGA, which is done automatically when you connect.

If you installed old firmware, you need to download the original cwlite.py and repeat the original firmware upgrade again. Try disconnecting and reconnecting the power supply on your CW305, then connecting again.

Alex

How about reinstall driver(ex:cwlite_usbdriver and cw305_usbdriver) for my cwlite and cw305 board through device manager?

If they appear as universal serial bus devices, there’s no need to reinstall the driver.

After I tried it, it works.Thank you for your help,Alex.

Oscar

Thank’s for checking and letting me know. We’ve found another issue with that FPGA release recently, so it’s good to know there’s additional problems besides just the one we found.

Alex

1 Like