Device did not ack/ No trigger seen error in SCA101 Lab 4_3

Hi,
In the course Lab 4-3 ChipWhisperer Analyzer CPA Attack(MAIN) I have an issue where when trying to collect traces i get these errors.

“(ChipWhisperer Target WARNING|File SimpleSerial2.py:508) Unexpected frame byte in CWbytearray(b’00 00 00’)
(ChipWhisperer Target ERROR|File SimpleSerial2.py:285) Device did not ack
(ChipWhisperer Scope WARNING|File _OpenADCInterface.py:621) Timeout in OpenADC capture(), no trigger seen! Trigger forced, data is invalid. Status: 0b
(ChipWhisperer Scope WARNING|File _OpenADCInterface.py:621) Timeout in OpenADC capture(), no trigger seen! Trigger forced, data is invalid. Status: 0a
(ChipWhisperer Scope WARNING|File init.py:503) Timeout happened during capture”

And this is the code i am running to get it:
"from tqdm import tnrange
import numpy as np
import time

ktp = cw.ktp.Basic()
trace_array = []
textin_array = []

N = 50
for i in tnrange(N, desc=‘Capturing traces’):
key, text = ktp.next()
trace = cw.capture_trace(scope, target, text, key)
if not trace:
continue

proj.traces.append(trace)"

I do not understand why this is happening since ive done the same before on all the other courses with no issue.

Try resetting the target with reset_target(scope); check cables; try re-programming the target.

Tried to reset target, turn off UFO and then turn on again, to then program target with no luck.

Strange - as far as trace acquisition goes, this lab is the same as lab 4-2, which I assume you were able to run successfully? Double-check that everything is connected properly, and confirm that you’re still able to run the previous labs successfully?

Yep, just tried to run through 4_2 and it worked fine. Got correct results all the way down. Tried to do 4_3 again but got the same error.

In fact, 4_1 does not work. At the stage where i am supposed to display power using BokehJS i get an error.
This is the code i ran:
"
from bokeh.plotting import figure, show
from bokeh.io import output_notebook
from bokeh.palettes import brewer

output_notebook()
p = figure()

plot_start = 0
plot_end = 2000
xrange = range(len(trace_array[0]))[plot_start:plot_end]
bnum = 0
color_mapper = brewer[‘PRGn’][9]

for tnum in range(len(trace_array)):
hw_of_byte = HW[aes_internal(textin_array[tnum][bnum], key[bnum])]
p.line(xrange, trace_array[tnum][plot_start:plot_end], line_color=color_mapper[hw_of_byte])

show(p)
"

and this is the error i got:

"
File ~/.pyenv/versions/cw/lib/python3.9/site-packages/bokeh/core/serialization.py:466, in Serializer._encode_other(self, obj)
463 elif obj is pd.NA:
464 return None
→ 466 self.error(f"can’t serialize {type(obj)}")

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/bokeh/core/serialization.py:469, in Serializer.error(self, message)
468 def error(self, message: str) → NoReturn:
→ 469 raise SerializationError(message)

SerializationError: can’t serialize <class ‘range’>
"

For the Bokeh error, it’s likely some version issue; try what’s suggested here: Demos>PA_HW_CW305_1-Attacking_AES_on_an_FPGA - #5 by Alex_Dewar

As for 4_3, I see the issue: I’ll guess that you’re calling this in your notebook:
%run "Lab 4_3 - ChipWhisperer Analyzer CPA Attack (HARDWARE).ipynb"

You may have noticed we have two versions of our SimpleSerial protocol, which is what’s used to communicate with the target. The HARDWARE notebook defines SS_VER='SS_VER_2_1' and compiles and programs the firmware for that version. Then the MAIN notebook recompiles and reprograms without defining SS_VER, so it defaults to 1_1, yet on the Python side the target is still assumed to be using the 2_1 version. This is why you run into the SimpleSerial errors when you try to capture traces.

The fix is simple: after calling the HARDWARE notebook, simply skip over the next few cells that are repeating what the HARDWARE noteobook already did, until you get to the cell that says “We can access Analyzer via chipwhisperer.analyzer:”

I did try to use the hardware version, but i got into another issue there. In one of the lines it calls “proj = cw.open_project(“Lab 4_3”)” Which results in an error “File /home/user/chipwhisperer/jupyter/courses/sca101/Lab 4_3.cwp does not exist or is not a file”. Thererfore i had to copy all functions to the main version of the program.

Replace cw.open_project("Lab 4_3" with cw.create_project("Lab 4_3").

1 Like

This actually fixed everything. Wierd, wellwell thanks for the help anyways