Traces not complete

Hello all,
I want to trace a code that uses uint64_t variables and is a little bit complex (it is about integer sampling).
I was able to have traces but they are very long more than 24000 samples and still the trace is not complete. I mean here by complete, that I did not trace the whole execution of the code.
Anyone has an idea how to fix this. I tried to optimize my code in a way to use smaller variables when possible.
But this did not solve the issue.
I want the complete traces …
Please, help!
Best

Hi,

Some ideas for how to capture longer traces:

  1. If you haven’t already, make sure that you’re using “clkgen_x1” for your ADC clock instead of “clkgen_x4”
  2. If you’re able to control the input data, you can try capturing multiple traces with different ADC offsets and the same input, then combining the traces
  3. You can increase scope.adc.decimate, which will only record one sample in every scope.adc.decimate. If you set this to 10, you’ll only record one in every 10 samples. I’d recommend trying this step last.

Alex

Hi Alex,
Thank you for your answer.
I added these two code lines:

self._scope.clock.adc_src = ‘clkgen_x1’
self._scope.adc.decimate = 40

By varying the adc.decimate to 20 the first dense spikes get longer, which totally makes sense.
I assumed now that the trace is a complete one. Should I ignore the other spikes?
Is it normal to have these spikes , why they appear in my trace?
Best,
Sou

Hi Sou,

If I had to guess, I’d say those spikes are noise of some sort. That being said, your trace looks very weak. What’s your gain set at? If it’s currently low, I’d recommend increasing it a bit. Also, what value of shunt resistor are you using? Increasing that should also give you some better measurements.

Alex

Hi Alex,
Thank you for the reply.
I am currently using 34 for gain(no purpose for that), is it enough? How the gain affect the quality of the traces?
I am using the shunt resistors in the CWLITE. I did not add any. pin2&3 indicate SHUNTL and SHUNTH.

See below how my cw looks like.

Best,
Sou

Hi Sou,

I’d recommend increasing your gain (preferably via scope.adc.db, since that’s independent of the high/low gain setting). The Lite has a 10-bit ADC, meaning the minimum step on that graph is ~0.001, so you’re probably only getting ~10 different values for your measurement.

The noise you’re seeing in your trace is probably from the internal regulator in the F4. The ChipWhisperer attempts to overpower it, but the voltage might not be high enough. You can improve your measurement by feeding a slightly higher voltage in with the adjustable regulator, which is on the other side of the filt pin. Be a bit careful here, as you can damage the target if the voltage you feed in is too high.

See https://wiki.newae.com/Targets_with_Internal_Regulators for more information.

Alex

Did you short J16 on purpose? I never tried such setting.

Does you STM32 work? Because all LEDs are off, normally two are on.

No I did not that on purpose.
I had traces, but Not all LED are off? led 11,10 and 8, 5 are on

Am I missing something?!

Could you test without jumper on J16? Does it change anything?

STM32F3 target uses LED1,2,3 as simple status LEDs.
From my experience if all are off, something is wrong with power for CPU.

The traces without the jumper look like this:

However, after changing the value of he gain and by having the jumper on j16 I had the following traces:

The LEDs 1,2 and 3 are off for both cases.

Good catch, 3,

Yeah, having J16 shorted there would definitely ruin your measurements. We’re measuring current into the microcontroller via the voltage drop across a shunt resistor (across SHUNTH and SHUNTL), so shorting those two mostly removes your ability to calculate current.

As for why the LEDs are off, the STM32F4 HAL doesn’t actually configure the LED pins, so they’re still the default high impedance. If you want to use the LEDs, you should be able to include stm32f4xx_hal_gpio.h and use similar code to the trigger setup:

void trigger_setup(void)
{
	GPIO_InitTypeDef GpioInit;
	GpioInit.Pin       = GPIO_PIN_12;
	GpioInit.Mode      = GPIO_MODE_OUTPUT_PP;
	GpioInit.Pull      = GPIO_NOPULL;
	GpioInit.Speed     = GPIO_SPEED_FREQ_HIGH;
	HAL_GPIO_Init(GPIOA, &GpioInit);
}

void trigger_high(void)
{
	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, SET);
}

void trigger_low(void)
{
	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, RESET);
}

(LEDs are active low here though)

Alex

Hi Alex,
Thank you for your reply.
I do not need LEDs in my code.
After removing the jumper, I had these dense traces. Do they look correct?

Hi Sou,

Those definitely look a lot better. You’ll want to turn the gain down a bit, since you’re clipping on the top now.

Alex