K82F: built a SimpleSerial AES firmware successfully, but flashing via CW-Lite/OpenOCD on Windows fails with libusb / FTDI errors

Hi,

I am trying to run a SimpleSerial AES firmware on a CW308 K82F target and measure EM traces with a ChipWhisperer-Lite + CW308 UFO setup on Windows.

I was able to build the firmware successfully, but I am stuck when trying to flash it to the K82F using OpenOCD through the ChipWhisperer-Lite.

My goal is to do something similar to the usual simpleserial-aes workflow used on XMEGA / STM32F3, but on the K82F.

What I did

I created a new firmware folder based on simpleserial-trace, replaced the source with a simpleserial-aes-style implementation, and built it with:

make PLATFORM=CW308_K82F CRYPTO_TARGET=TINYAES128C

The build succeeds and produces:

  • simpleserial-trace-CW308_K82F.hex

  • simpleserial-trace-CW308_K82F.elf

  • simpleserial-trace-CW308_K82F.map

The build log clearly shows that it is building for CW308_K82F with CRYPTO_TARGET=TINYAES128C, and it compiles .././crypto/tiny-AES128-C/aes.c and .././crypto/aes-independant.c successfully.

Flashing attempt

I am using xPack OpenOCD 0.12.0-7 on Windows and trying to flash with the following Python code:

from pathlib import Path
import subprocess

ROOT = Path(r"C:\Users\yagi\Downloads\xpack-openocd-0.12.0-7-win32-x64")

openocd_hits = [p for p in ROOT.rglob("openocd.exe")]
kx_hits = [p for p in ROOT.rglob("kx.cfg")]

OPENOCD = str(openocd_hits[0])
KX_CFG = kx_hits[0]
SCRIPTS = str(KX_CFG.parent.parent)

CW_CFG = r"C:\Users\yagi\ChipWhisperer5_64\cw\home\portable\chipwhisperer\openocd\cw_openocd.cfg"
FW     = r"C:\Users\yagi\ChipWhisperer5_64\cw\home\portable\chipwhisperer\hardware\victims\firmware\simpleserial-aes-k82f\simpleserial-trace-CW308_K82F.hex"

fw_posix = FW.replace("\\", "/")

cmd = [
    OPENOCD,
    "-s", SCRIPTS,
    "-f", CW_CFG,
    "-c", "transport select jtag",
    "-c", "ftdi vid_pid 0x2b3e 0xace2",
    "-c", "adapter speed 100",
    "-f", "target/kx.cfg",
    "-c", "init",
    "-c", "targets",
    "-c", "halt",
    "-c", f"flash write_image erase {fw_posix}",
    "-c", f"flash verify_image {fw_posix}",
    "-c", "reset run",
    "-c", "shutdown",
]

res = subprocess.run(cmd, capture_output=True, text=True)
print("returncode =", res.returncode)
print("----- STDOUT -----")
print(res.stdout)
print("----- STDERR -----")
print(res.stderr)

Current error

Right now I get:

xPack Open On-Chip Debugger 0.12.0+dev-02228-ge5888bda3-dirty
adapter speed: 100 kHz
Info : add flash_bank kinetis kx.pflash
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: unable to open ftdi device with description '*', serial '*' at bus location '*'

Earlier, depending on the driver configuration, I also saw:

Error: libusb_claim_interface() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: unable to open ftdi device with description '*', serial '*' at bus location '*'

and at one point:

Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: kx.cpu: IR capture error; saw 0x00 not 0x01
Error: Invalid ACK (0) in DAP response

Driver / setup things I already tried

  • Windows + ChipWhisperer-Lite + CW308 UFO + K82F target

  • Confirmed that normal ChipWhisperer Python connection works

  • Used scope.enable_MPSSE(1) before running OpenOCD

  • Tried Zadig and changed drivers multiple times

  • Tried WinUSB on ChipWhisperer Lite (Interface 0)

  • Also experimented with Interface 1 and even the composite parent, but that caused more confusion

  • Restored things and got normal ChipWhisperer operation back

  • Rebooted Windows after some driver changes

  • Used target/kx.cfg instead of kinetis.cfg

  • Reduced JTAG speed to adapter speed 100

Additional observation

Before replacing the firmware, the K82F did respond over UART at 38400 baud and I could see triggers, but the returned data was always all zeros, so I suspect the old firmware is still on the target and my newly built AES firmware has not actually been flashed yet.

Questions

  1. What is the correct driver configuration on Windows for using CW-Lite as the OpenOCD/JTAG interface to flash a CW308 K82F?

  2. Is cw_openocd.cfg + target/kx.cfg the correct approach for this board?

  3. Is there a known-good flashing procedure for CW308_K82F on Windows using ChipWhisperer-Lite + OpenOCD?

  4. If using CW-Lite as the JTAG interface on Windows is unreliable, what is the recommended alternative?

Any advice would be greatly appreciated.

Thanks.