I have a question about CWNANO


I have a question about CWNANO. I am attempting to conduct an electromagnetic attack using CWNANO. To do this, I split the CWNANO into two parts and connected them with jumper wires, as shown in the picture. However, when I try to execute it, I encounter the following error. Could you tell me what might be wrong?

OSError                                   Traceback (most recent call last)
Cell In[1], line 2
      1 import chipwhisperer as cw
----> 2 scope = cw.scope()

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\__init__.py:384, in scope(scope_type, name, sn, idProduct, bitstream, force, prog_speed, **kwargs)
    381         raise ValueError
    383 if scope_type is None:
--> 384     scope_type = get_cw_type(**kwargs)
    385 rtn : scopes.ScopeTypes = scope_type()
    386 try:

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\common\utils\util.py:522, in get_cw_type(sn, idProduct, hw_location, **kwargs)
    519     possible_ids = [0xace0, 0xace2, 0xace3, 0xace5]
    521 cwusb = NAEUSB_Backend()
--> 522 device = cwusb.find(serial_number=sn, idProduct=possible_ids, hw_location=hw_location)
    523 name = device.getProduct()
    524 cwusb.usb_ctx.close()

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:344, in NAEUSB_Backend.find(self, serial_number, idProduct, hw_location)
    342 dev_list = self.get_possible_devices(idProduct, attempt_access=(not hw_location))
    343 if len(dev_list) == 0:
--> 344     raise OSError("Could not find ChipWhisperer. Is it connected?")
    346 # if more than one CW, we require a serial number
    347 if hw_location:

OSError: Could not find ChipWhisperer. Is it connected?



Looks like the Nano FW has been erased.

To re-program it, follow the instructions from here:

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

When I executed it, I encountered the following error.

Found COM8
Loading cwnano firmware…
Opened!
Connecting…

AttributeError Traceback (most recent call last)
Cell In[1], line 2
1 import chipwhisperer as cw
----> 2 cw.program_sam_firmware(hardware_type=‘cwnano’)

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py:152, in program_sam_firmware(serial_port, hardware_type, fw_path)
150 print(“Found {}”.format(serial_port))
151 prog = SAMFWLoader(None)
→ 152 prog.program(serial_port, hardware_type=hardware_type, fw_path=fw_path)

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererSAM3Update.py:266, in SAMFWLoader.program(self, port, fw_path, hardware_type, bypass_warning)
263 sam = Samba()
265 self.logfunc(“Opened!\nConnecting…”)
→ 266 sam.con(port)
267 self.logfunc(“Connected!\nErasing…”)
268 sam.erase()

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:260, in Samba.con(self, port, usbmode)
252 target_logger.info(‘FWUP: CID = %04x’ % cid)
254 #Originally this was used to limit to SAM3U
255 #eproc = (cid >> 5) & 0x7
256 #arch = (cid >> 20) & 0xff
257 #if eproc == 3 and ((0x80 <= arch <= 0x8a) or (0x93 <= arch <= 0x9a)):
258 # target_logger.info(‘FWUP: Detected SAM3’)
→ 260 self.setup_device_specific(cid)
262 target_logger.info('FWUP: Detected ’ + self.flash.name)
263 return True

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:294, in Samba.setup_device_specific(self, chipid)
292 self.rstc_addr = 0x400E1400
293 else:
→ 294 raise AttributeError(“FWUP: Unsupported ChipID = %x” % chipid)
296 self.flash = flash

AttributeError: FWUP: Unsupported ChipID = 289c0ce0

You must be on a CW release; Nanos have had some hardware changes that aren’t covered in the latest release, you’ll have to use the CW develop branch.

Thank you, as always. You helped me before, too. In a previous session, when I posted a question about this topic, you mentioned that to conduct an electromagnetic attack with the ChipWhisperer Nano (CWNANO), I should split the board in two and connect the circuit with jumpers. I followed that advice, but now I am encountering a ‘USEerror,’ and I believe that the computer can no longer recognize the CWNANO. Based on the error I encountered earlier, is the CWNANO being detected at all?

Additionally, could you explain how to proceed with the information you just shared?

Your assistance would be greatly appreciated.

The reason the Nano isn’t being recognized is that its firmware has gotten erased (you may have inadvertently shorted SJ1, which does the FW erase). Since it’s no longer running our Nano FW, it’s not recognized as a nano, hence you need to re-program it before you can use it again.

You are likely on an older release of CW which predates your Nano HW; you need to update to a not-yet-released CW version.

You can do this from Jupyter; assuming you are at our root Jupyter folder, do:

%%bash
cd ..
git checkout develop
git pull

Then, restart your notebook, and program_sam_firmware() command above should now work.

Thank you. When I tried running it in Jupyter, the following error occurred. However, when I ran the same command in Command Prompt with administrator privileges, it worked. I then tried the previous code again in Jupyter, but it also resulted in an error.What do you think I should try next?

%%bash
cd …
git checkout develop
git pull

Updating aaac249c…a9527b5d
Aborting

CalledProcessError Traceback (most recent call last)
Cell In[2], line 1
----> 1 get_ipython().run_cell_magic(‘bash’, ‘’, ‘cd …\ngit checkout develop\ngit pull\n’)

File C:\Users\MURASE~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\IPython\core\interactiveshell.py:2422, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
2420 with self.builtin_trap:
2421 args = (magic_arg_s, cell)
→ 2422 result = fn(*args, **kwargs)
2423 return result

File C:\Users\MURASE~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\IPython\core\magics\script.py:153, in ScriptMagics._make_script_magic..named_script_magic(line, cell)
151 else:
152 line = script
→ 153 return self.shebang(line, cell)

File C:\Users\MURASE~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\IPython\core\magics\script.py:305, in ScriptMagics.shebang(self, line, cell)
300 if args.raise_error and p.returncode != 0:
301 # If we get here and p.returncode is still None, we must have
302 # killed it but not yet seen its return code. We don’t wait for it,
303 # in case it’s stuck in uninterruptible sleep. -9 = SIGKILL
304 rc = p.returncode or -9
→ 305 raise CalledProcessError(rc, cell)

CalledProcessError: Command ‘b’cd …\ngit checkout develop\ngit pull\n’’ returned non-zero exit status 1.

Found COM8
Loading cwnano firmware…
Opened!
Connecting…

AttributeError Traceback (most recent call last)
Cell In[1], line 2
1 import chipwhisperer as cw
----> 2 cw.program_sam_firmware(hardware_type=‘cwnano’)

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py:152, in program_sam_firmware(serial_port, hardware_type, fw_path)
150 print(“Found {}”.format(serial_port))
151 prog = SAMFWLoader(None)
→ 152 prog.program(serial_port, hardware_type=hardware_type, fw_path=fw_path)

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererSAM3Update.py:266, in SAMFWLoader.program(self, port, fw_path, hardware_type, bypass_warning)
263 sam = Samba()
265 self.logfunc(“Opened!\nConnecting…”)
→ 266 sam.con(port)
267 self.logfunc(“Connected!\nErasing…”)
268 sam.erase()

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:260, in Samba.con(self, port, usbmode)
252 target_logger.info(‘FWUP: CID = %04x’ % cid)
254 #Originally this was used to limit to SAM3U
255 #eproc = (cid >> 5) & 0x7
256 #arch = (cid >> 20) & 0xff
257 #if eproc == 3 and ((0x80 <= arch <= 0x8a) or (0x93 <= arch <= 0x9a)):
258 # target_logger.info(‘FWUP: Detected SAM3’)
→ 260 self.setup_device_specific(cid)
262 target_logger.info('FWUP: Detected ’ + self.flash.name)
263 return True

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:294, in Samba.setup_device_specific(self, chipid)
292 self.rstc_addr = 0x400E1400
293 else:
→ 294 raise AttributeError(“FWUP: Unsupported ChipID = %x” % chipid)
296 self.flash = flash

AttributeError: FWUP: Unsupported ChipID = ce02000

Hi,

Could you try rerunning the update code again after restarting Jupyter? If that doesn’t work, try changing elif chipid == 0x289c0ce0: to elif chipid == 0x289c0ce0 or chipid == 0xce02000: (should be line 287), restarting Jupyter, and running the update code again?

Thank you for your response. The commands I am using are the two below. How should I specify the chipID?

%%bash
cd …
git checkout develop
git pull**

import chipwhisperer as cw
cw.program_sam_firmware(hardware_type=‘cwnano’)

I researched similar topics and tried various things, but it resulted in this. What do you think I should do?

Found COM8
Loading cwnano firmware…
Opened!
Connecting…

SerialException Traceback (most recent call last)
Cell In[1], line 2
1 import chipwhisperer as cw
----> 2 cw.program_sam_firmware(hardware_type=‘cwnano’)

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py:152, in program_sam_firmware(serial_port, hardware_type, fw_path)
150 print(“Found {}”.format(serial_port))
151 prog = SAMFWLoader(None)
→ 152 prog.program(serial_port, hardware_type=hardware_type, fw_path=fw_path)

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\cwhardware\ChipWhispererSAM3Update.py:266, in SAMFWLoader.program(self, port, fw_path, hardware_type, bypass_warning)
263 sam = Samba()
265 self.logfunc(“Opened!\nConnecting…”)
→ 266 sam.con(port)
267 self.logfunc(“Connected!\nErasing…”)
268 sam.erase()

File c:\users\murase_ryou\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:222, in Samba.con(self, port, usbmode)
220 usbmode = False
221 else:
→ 222 ser = serial.Serial(
223 port=port,
224 baudrate=115200, #921600
225 parity=serial.PARITY_NONE,
226 stopbits=serial.STOPBITS_ONE,
227 bytesize=serial.EIGHTBITS,
228 timeout=1
229 )
231 self.usbmode = usbmode
233 self.ser = ser

File C:\Users\MURASE~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\serial\serialwin32.py:33, in Serial.init(self, *args, **kwargs)
31 self._overlapped_read = None
32 self._overlapped_write = None
—> 33 super(Serial, self).init(*args, **kwargs)

File C:\Users\MURASE~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\serial\serialutil.py:244, in SerialBase.init(self, port, baudrate, bytesize, parity, stopbits, timeout, xonxoff, rtscts, write_timeout, dsrdtr, inter_byte_timeout, exclusive, **kwargs)
241 raise ValueError(‘unexpected keyword arguments: {!r}’.format(kwargs))
243 if port is not None:
→ 244 self.open()

File C:\Users\MURASE~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\serial\serialwin32.py:64, in Serial.open(self)
62 if self._port_handle == win32.INVALID_HANDLE_VALUE:
63 self._port_handle = None # 'cause del is called anyway
—> 64 raise SerialException(“could not open port {!r}: {!r}”.format(self.portstr, ctypes.WinError()))
66 try:
67 self._overlapped_read = win32.OVERLAPPED()

SerialException: could not open port ‘COM8’: PermissionError(13, ‘アクセスが拒否されました。’, None, 5)