CW310: Trouble Getting AES Demo to Work on CW310 – Registers Always Zero,

I’m trying to verify the built‑in AES demo on my ChipWhisperer CW310 board from Python, but no matter what I do all the register reads return 0x00 and the script always times out with RuntimeError: AES never finished!. Here’s a minimal reproduction of the code I’m using:

import chipwhisperer as cw
import time

AES_CONTROL_ADDR = 0x05 # write=GO, read=BUSY
AES_KEY_ADDR = 0x06 # 16 bytes @ 0x06–0x15
AES_PLAINTEXT_ADDR = 0x0A # 16 bytes @ 0x0A–0x19
AES_CIPHERTEXT_ADDR = 0x16 # 16 bytes @ 0x16–0x25

test_key = list(bytes.fromhex(“000102030405060708090A0B0C0D0E0F”))
test_pt = list(bytes.fromhex(“00112233445566778899AABBCCDDEEFF”))
expected = list(bytes.fromhex(“69C4E0D86A7B0430D8CDB78070B4C55A”))

print(“Programming AES bitstream…”)
target = cw.target(None, cw.targets.CW310, bsfile=“cw310_aes.bit”, force=True)

target.fpga_write(AES_KEY_ADDR, test_key)
time.sleep(0.1)
print(“Key readback:”, target.fpga_read(AES_KEY_ADDR, 16))

target.fpga_write(AES_PLAINTEXT_ADDR, test_pt)
time.sleep(0.1)
print(“PT readback:”, target.fpga_read(AES_PLAINTEXT_ADDR, 16))

target.fpga_write(AES_CONTROL_ADDR, [1])

start = time.time()
while time.time() - start < 5:
busy = target.fpga_read(AES_CONTROL_ADDR, 1)[0]
print(“Busy =”, busy)
if busy == 0:
break
time.sleep(0.01)
else:
raise RuntimeError(“AES never finished!”)

ct = target.fpga_read(AES_CIPHERTEXT_ADDR, 16)
print(“Ciphertext:”, ct)
assert ct == expected, “Output mismatch!”
print(“:white_check_mark: Success”)

Most likely, some of the switches on the CW310 board aren’t set correctly. Can you show or tell me the status of all the switches, LEDs, how you are connecting the board to your PC, and how you are powering it?

I connected to the PC using the USB-C port, and powered through the DC barrel jack, also is there a demo notebook for the CW310?

You didn’t answer all my questions.
You can use the CW305 demo notebook, replacing “305” by “310”, and setting:

USRDIP0 = 1
USRDIP1 = 0


Hey I have switched on DIP0,Now all my registers are 0xFF

The blue “STATUS” LED close to the Ethernet jacks should be flashing, but your picture can’t show that; let me know if it isn’t.

The USRDIP settings are not clear in the picture; they appear to be between 0 and 1. Set them all firmly to the left (0), except for USRDIP2 which needs to be to the right (1 / “on”).

Otherwise your board looks properly set up but the FPGA is in an unprogrammed state.

What happens when you run this:

import chipwhisperer as cw
scope = None
# point to the correct bitfile here; make sure you choose impl_160 or impl_410 according to the FPGA that you have on your board
# e.g. https://github.com/newaetech/cw310-bergen-board/tree/main/fpga/board_test/board_test.runs/impl_410/cw310_top.bit
bsfile = # /path/to/cw310_top.bit
target = cw.target(scope, cw.capture.targets.CW310, bsfile=bsfile, force=True)

target.pll.pll_outenable_set(False, 0)
target.pll.pll_outenable_set(False, 1)
target.pll.pll_outenable_set(True, 2)
target.pll.pll_outfreq_set(10e6, 2)

print(target.fpga_buildtime)

target.fpga_write(target.REG_CRYPT_CIPHERIN, range(16))
print(list(target.fpga_read(target.REG_CRYPT_CIPHERIN, 16)))

The STATUS LED is blinking, and moreover I am able to read registers which I write to,However I am not sure how to get the output or initiate the AES ,Also for the DIP switches, the first one os to the right ‘ON’ and the rest are to the left as mentioned below

I answered that 2 posts up.