I am using the CW lite with the UFO board with STM32F3 target.
I am running a long calculation, so that it doesn’t fit into the traces.
With a regular oscilloscope I would reduce the resolution or lower the sample frequency or I would raise the clock frequency of the device.
I don’t really understand how the CW scope settings exactly work and which commands in python would allow me to do the above.
For the typical ChipWhisperer capture setup, the target clock also clocks the ADC, so it is a little different than your typical oscilloscope setup. This means it isn’t quite as simple as just changing the sample frequency or the target’s clock frequency.
If you haven’t already, a first step you can take is to change
clkgen_x1 (documented here: https://chipwhisperer.readthedocs.io/en/latest/api.html#chipwhisperer.capture.scopes._OpenADCInterface.ClockSettings.OpenADC.adc_src), which will reduce the sample frequency from being 4x larger than the target frequency to being the same. If you need to capture even longer traces, you have a few options:
- The CWLite supports downsampling (documented here: https://chipwhisperer.readthedocs.io/en/latest/api.html#chipwhisperer.capture.scopes._OpenADCInterface.TriggerSettings.OpenADC.decimate). For values >1 (with
clkgen_x1 adc src), this will make your clock frequency lower than the target’s, which has various downsides, such as adding jitter and missing instructions.
- Capturing multiple traces with the same input, but with different offsets and stitching them together.
- Feeding a clock signal from the target into the ChipWhisperer. You should be to use the clock module in the ChipWhisperer to get whatever sampling frequency you want (within reason), though I haven’t done this myself, so I can’t vouch for how well it works.
- Running the target off a different clock than the ChipWhisperer and using a lower clock frequency for the ChipWhisperer. This is your typical oscilloscope setup and comes with most of the advantages (being able to set the clocks independently) and disadvantages (lots of jitter) that an oscilloscope has for side channel attacks.
Ok Thanks, I’ll try this stuff.
Thank you for your suggestions. I actually tried solution number 2 and it partially worked but with 2 errors:
1- sometimes I get the timeout error in the middle of the consecutive captures( expected 24000 but received 0 or a less number) and it proceeds correctly. I do not understand what could be causing this and how can I understand the meaning of the status 0b/0e…etc errors please.
2- I use the trig_count to get the number of cycles required and then I do captures till I cover the trig_count. The trig count sometimes keeps changing between the runs, why could that be happening please ( I do not have interrupts or any external factor affecting my algorithm)