How does get_pt called in tutorial 1 for power measurement

Hi I was trying to look at the sample-serial-base.c code to figure out how the trigger system works. In the tutorial we have to modify the get_pt() function to see different power traces. However, I did not see how the get_pt() call in the main function. I am referring to the tutorial in lab 2_1A MAIN notebook file. I wonder if anyone can help me answering this.

Also I wonder how does the trigger system works. If I put the trigger high does the CW start measuring the power somehow and then when I put it low it finishes and return it to the host machine? Can I sample for a longer period of time, the only timeframe here is 5000 I wonder what it means. What happens if I want to sample for more than 1 second.

Hi,

get_pt() gets called by simpleserial_get() when receiving a simpleserial command with a 'p' character. You may want to take a look at firmware/simpleserial/simpleserial.c to see how this all works.

After calling scope.arm(), the chipwhisperer will begin looking for a trigger signal, by default a rising edge on tio4. Once it receives this signal, it captures scope.adc.samples samples. Calling scope.capture() reads the trace back from the ChipWhisperer, which is then accessible via scope.get_last_trace(). By default, scope.adc.samples is 5000, which is why all your traces are 5000 datapoints long.

ChipWhisperer devices have a limited amount of samples that they can store, which you can see on the device’s https://rtfm.newae.com/ page. The ChipWhisperer Husky and Pro also have a stream mode, which limits the sample rate, but allows captures in excess of 10M samples.

Alex

Thanks for your reply that really help a lot!

“Calling scope.capture() reads the trace back from the ChipWhisperer, which is then accessible via scope.get_last_trace() . By default, scope.adc.samples is 5000, which is why all your traces are 5000 datapoints long.”

So I have two follow ups:

  1. I guess that I can pass in some parameters for the sample size so I can get a larger sample each time?

  2. I also see a trigger down function call. I wonder how this works. When the pin goes high the CW start sampling until this trigger_down() is called? Or it just sample for a while and automatically stop, this trigger_down is just a reset thing for the target device.

Yeah, just set scope.adc.samples to however many you want to record.

trigger_low() is just called so that you set the trigger high again later, it has no bearing on how long your trace is.

Alex