CWLite can't be detected in bootloader mode and can't finish firmware update

Environment:

  • I’m using MacOS 12.5.1 with chipwhisperer running on Virtualbox.
  • Current chipwhisperer version: 5.5.0

I’m trying to update it to 5.6.1 or later version and at first, I followed the instruction in Scope API — ChipWhisperer 5.7.0 documentation.
Following code is run:

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

The response:

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/sam3ufw/SAMBUVendorExample/Debug/SAM3U CW1173.bin
Detected com port /dev/ttyACM1
Loading cwlite firmware...
Opened!
Connecting...
---------------------------------------------------------------------------------------------
PermissionError          Traceback (most recent call last)
...

SerialException: [Errno 13] could not open port /dev/ttyACMl: (Errno 13] Permission denied: '/dev/ttyACM1'

Then, I change the permission of the corresponding port by

%%bash
sudo chmod 666 /dev/ttyACM1

And do the auto_program again

programmer = cw.SAMFWLoader(scope=scope)
programmer.auto_program()

And I received “USBError: [Errno 19] No such device (it may have been disconnected)”. I think the reason was that CWLite has already entered bootloader mode. But I didn’t realize then and I try unplug and plug in again. After that, I can’t find the port address (/dev/ttyxxx) anymore and gets stuck in bootloader mode with CWLite having dim red and blue light now…

So far, I have tried:
1.

import chipwhisperer as cw
programmer = cw.SAMFWLoader (scope=None)
programmer.program("/dev/ttyACM1', hardware_type='cwlite')

And the response is as following:

Loading cwlite firmware...
Opened!
Connecting...
---------------------------------------------------------------------------------------------
FileNotFoundError                                Traceback (most recent call last)
...
SerialException: [Errno 2] could not open port /dev/ttyACM1: [Errno 2] No such file or directory: '/dev/ttyACM1 '
  1. I have also checked CW1173 ChipWhisperer-Lite - NewAE Hardware Product Documentation, but the command “sudo modprobe usbserial vendor=0x3eb product=0x6124” is not available on MacOS terminal.

  2. Try to restart the laptop, and see if the result of “ls /dev/tty*” is different before and after plug in CWLite. But the result is the same. (Seems like the CWLite wasn’t detected?) There also wasn’t “Atmel Corp. at91sam SAMBA bootloader [0110]” shown in VirtualBox > Devices > USB anymore (I’ve seen it in the beginning when dealing with Permission denied issue)

  3. I have also tried the following code from https://newae.discoursehosting.net/t/after-reseting-the-firmware-the-usb-device-is-not-found-anymore/2599/6:

def get_at91_ports():
    from serial.tools import list_ports

    at91_ports = [port.device for port in list_ports.comports() if (port.vid, port.pid) == (0x03EB, 0x6124)]
    return at91_ports

import chipwhisperer as cw
def program_sam_firmware(hardware_type=None):
    at91_ports = get_at91_ports()
    if len(at91_ports) == 0:
        raise OSError("Could not find bootloader serial port, please see https://chipwhisperer.readthedocs.io/en/latest/firmware.html")
    if len(at91_ports) > 1:
        raise OSError("Found multiple bootloaders, please specify com port. See https://chipwhisperer.readthedocs.io/en/latest/firmware.html")

    serial_port = at91_ports[0]
    print("Found {}".format(serial_port))
    prog = cw.SAMFWLoader(None)
    prog.program(serial_port, hardware_type=hardware_type)

program_sam_firmware("cwlite")

And I got “OSError: Could not find bootloader serial port, please see Updating Firmware — ChipWhisperer 5.7.0 documentation

Could anyone help or have any suggestion? I have no idea how to deal with this…

Hi,

There’s two different version in play here. The first is the CW software version (5.5.0 in your case, with the newest being 5.7.0), which what runs on your PC, and the firmware version, which is what runs on the ChipWhisperer itself. It sounds like you’re trying to update the software version, but you’re following the instructions to update the firmware. If you run the following notebook from the jupyter folder, it should update the software: chipwhisperer-jupyter/ChipWhisperer Updating.ipynb at master · newaetech/chipwhisperer-jupyter · GitHub.

Also, to confirm, are you running MacOS natively, with our VM image running in VirtualBox? I’d try restarting your computer if you haven’t yet. I’d guess the issue is somewhere with your native OS, but I’m not very familiar with MacOS, so I’m not too sure of debugging steps to take.

Alex

Thanks for pointing out the two different versions, I confused the software version with the firmware one indeed. Also, I do run the MacOS natively with using VM image in VirtualBox and I agree that the problem might occur from my native MacOS since the problem was completely solved on another laptop running Windows.

Here’s how I solved the issue by using Windows laptop which hadn’t dealt with any CW related work before.

  1. Plug CWLite to the Windows laptop and check if CWLite is detected. (Thankfully, the laptop did detect CWLite in COM3!)
  2. Easily follow this well-written tutorial to install the environment chipwhisperer need (jupyter directory of cw, cw library, …) on this webpage: Windows Installation — ChipWhisperer 5.7.0 documentation
  3. In any python notebook, type the following code and execute:
def get_at91_ports():
    from serial.tools import list_ports

    at91_ports = [port.device for port in list_ports.comports() if (port.vid, port.pid) == (0x03EB, 0x6124)]
    return at91_ports

import chipwhisperer as cw
def program_sam_firmware(hardware_type=None):
    at91_ports = get_at91_ports()
    if len(at91_ports) == 0:
        raise OSError("Could not find bootloader serial port, please see https://chipwhisperer.readthedocs.io/en/latest/firmware.html")
    if len(at91_ports) > 1:
        raise OSError("Found multiple bootloaders, please specify com port. See https://chipwhisperer.readthedocs.io/en/latest/firmware.html")

    serial_port = at91_ports[0]
    print("Found {}".format(serial_port))
    prog = cw.SAMFWLoader(None)
    prog.program(serial_port, hardware_type=hardware_type)

program_sam_firmware("cwlite")


4. Finally successfully escape the bootloader mode!! The dim single red and blue LED on CWLite is replaced by multiple brighter red and blue LEDs.

Thanks again for your reply!! It really helps a lot :smiley: