Cwnano firmware upgrade issue in CW 5.6.1

I have run into an issue with the ChipWhisperer Firmware Upgrade notebook in CW 5.6.1 running on an Ubuntu 64-bit 20.04 VMware virtual machine.

My cwnano ran OK in a Windows10 ChipWhisperer (version 5.5.0 using the installer from the GitHub release page). When I run the upgrade notebook on Windows I and print the scope I see:

import chipwhisperer as cw

scope = cw.scope()

prog = cw.SAMFWLoader(scope)

prog.auto_program()

Entering bootloader mode…
Please wait until the ChipWhisperer shows up as a serial port. Once it has, call
the program(COMPORT, FWPATH) to program the ChipWhisperer

        Default firmware can be found at chipwhisperer/hardware/capture/chipwhisperer-lite/sam3u_fw/SAM3U_VendorExample/Debug/SAM3U_CW1173.bin

Detected com port COM7
Loading cwnano firmware…
Opened!
Connecting…
b’\n\r’
Connected!
Erasing…
Erased!
Programming file SAM3U_CWNANO.bin…
Programmed!
Verifying…
Verify OK!
Bootloader disabled. Please power cycle device.

=================================================
Connecting to ChipWhisperer

Now that your hardware is all setup, we can now learn how to connect to it. We can connect to the ChipWhisperer with:

import chipwhisperer as cw

scope = cw.scope()

By default, ChipWhisperer will try to autodetect the type of device your’re running (CWLite/CW1200 or CWNano), see API documentation for manually specifying the scope type. If you have multiple ChipWhisperer devices connected, you’ll need to specify the serial number of the device you want to connect to:

scope = cw.scope(sn=‘’)

For more information, see the API section on readthedocs.

Connecting to the target device is simple as well:

print(scope)

ChipWhisperer Nano Device
fw_version =
major = 0
minor = 30
debug = 0
io =
tio1 = None
tio2 = None
tio3 = None
tio4 = None
pdid = True
pdic = False
nrst = True
clkout = 7500000.0
cdc_settings = array(‘B’, [1, 1])
adc =
clk_src = int
clk_freq = 7500000.0
samples = 5000
glitch =
repeat = 0
ext_offset = 0

However, when I try connecting using version 5.6.1 in the VM, I see the warning :

WARNING:ChipWhisperer NAEUSB:Your firmware is outdated - latest is 0.52. Suggested to update firmware, as you may experience errors
See Deprecated API — ChipWhisperer 5.7.0 documentation

This does not appear to prevent the examples from running, but I thought it would be good to get the latest version of the firmware.

Running the upgrage notebook with 5.6.1 initially looked to have worked, until I tried running an example:

import chipwhisperer as cw
scope = cw.scope()
prog = cw.SAMFWLoader(scope)
prog.auto_program()

WARNING:ChipWhisperer NAEUSB:Your firmware is outdated - latest is 0.52. Suggested to update firmware, as you may experience errors
See Deprecated API — ChipWhisperer 5.7.0 documentation

Entering bootloader mode…
Detected com port /dev/ttyACM0
Loading cwnano firmware…
Opened!
Connecting…
Connected!
Erasing…
Erased!
Programming file SAM3U_CWNANO.bin…
Programmed!
Verifying…
Verify OK!
Resetting…
Upgrade successful

but …

import chipwhisperer as cw
scope = cw.scope()


AttributeError Traceback (most recent call last)
/tmp/ipykernel_3271/1654912759.py in
1 import chipwhisperer as cw
----> 2 scope = cw.scope()

~/Desktop/chipwhisperer/software/chipwhisperer/init.py in scope(scope_type, name, sn, idProduct, bitstream, force, prog_speed, **kwargs)
326 if scope_type is None:
327 scope_type = get_cw_type(**kwargs)
→ 328 rtn : scopes.ScopeTypes = scope_type()
329 try:
330 rtn.con(**kwargs)

~/Desktop/chipwhisperer/software/chipwhisperer/capture/scopes/cwnano.py in init(self)
567 self._cwusb = NAEUSB()
568 self.ser = self._cwusb
→ 569 self.scopetype = self
570 self.dev = self
571

~/Desktop/chipwhisperer/software/chipwhisperer/common/utils/util.py in setattr(self, name, value)
364 raise AttributeError(“Attempt to set unknown attribute in %s”%self.class, name)
365 if name in self._read_only_attrs:
→ 366 raise AttributeError(“Attribute {} is read-only!”.format(name))
367 super(DisableNewAttr, self).setattr(name, value)
368

AttributeError: Attribute scopetype is read-only!

At this point, I noticed that the red and green LEDs on the cwnano were both dimly lit rather than the usual green flashing and the device was being identified as “Atmel” rather than “ChipWhisperer Nano”.

I was able to recover by running the new program_sam_firmware command:

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

Found /dev/ttyACM0
Loading cwnano firmware…
Opened!
Connecting…
Connected!
Erasing…
Erased!
Programming file SAM3U_CWNANO.bin…
Programmed!
Verifying…
Verify OK!
Resetting…
Upgrade successful

import chipwhisperer as cw
scope = cw.scope()
print(scope)

ChipWhisperer Nano Device
fw_version =
major = 0
minor = 52
debug = 0
io =
tio1 = None
tio2 = None
tio3 = None
tio4 = high_z
pdid = True
pdic = False
nrst = True
clkout = 0
cdc_settings = bytearray(b’\x01\x00\x00\x00’)
adc = <class ‘dict’>
glitch = <class ‘dict’>

As you can see, the firmware version is now updated to 0.52.0 and I no longer get the warning message when grabbing the scope. :smiley:

Hope this might help anyone else who encounters this issue.

Hi,

Thanks for the report on this! I’ve opened an issue on the github to track this - basically, for now, you just need to run del scope before trying to reconnect.

EDIT: here’s the issue: https://github.com/newaetech/chipwhisperer/issues/376

Alex

Hi Alex,

Thanks for your quick response and the link to fix it.

Regards,
Dave

1 Like