I’m encountering a confusing behavior when using scope.adc.offset together with scope.adc.trig_count for long trace acquisition in ChipWhisperer, and I’d like to ask for clarification.
Background
Initially, with:
scope.adc.offset = 0
I ran my code, observe:
scope.adc.trig_count ≈ 15,000,000
I interpret this as the trigger staying high for about 15 million samples.
My goal is to capture only the last 1 million samples, so I set:
scope.adc.offset = 14,000,000
Observation
After doing this, when I read:
scope.adc.trig_count
I get approximately:
29,000,000
That is:
≈ 15,000,000 + 14,000,000
My confusion
According to the documentation:
offset is the number of samples to wait after the trigger before starting capture
I cannt sir, are there any other ways to deal with it?I found this problem only on the large program. When I am dealing with program that only has 10k cycles, these things never happen
Again, I expect that your program is not asserting the trigger in the way that you think it is; the easiest way for you to check that is with an oscilloscope or logic analyzer. Otherwise you could use a debugger to learn when trigger_high() and trigger_low() are being called.
You can also do a simple experiment with our simpleserial-aes firmware: in the get_pt() function, wrap the aes_indep_enc(pt) call with a for loop, so that the AES encryption takes a lot longer. Make it take as long as you wish.
Then, capture traces with different values of scope.adc.offset and see whether scope.adc.trig_count remains constant. I did this experiment, and scope.adc.trig_count does remain constant.