SAM4S target weird behaviour with HUSKY

When using CW_HUSKY with SAM4S target on SCA101/Lab2_1B, during the trace capture on “Exploration” part, the captures got random power consumption offset (see image).

This is troublesome, because it doesn’t allow to make power analysis reliably and thus recover the password.

Note that I don’t have the same behavior with other targets, like STM32F4 for instance.

For me, it could be some software settings that may be messed up (target optimization, compilation, etc), or perhaps a faulty hardware.

What can you advice for a further debug?

Hi,

You should expect to see a divergence in that part of the lab - the point of that section is to show that you can see a difference between correct and incorrect characters.

If you’re seeing a divergence between incorrect characters, grabbing the latest commit (or at least up to this): disable code loop opt on sam4s · newaetech/chipwhisperer@8b46fbd · GitHub

Alex

well, the issue is that each time I do a capture the behaviour is different :

so, you’re saying that all this is because of the compiler optimization ? But Husky is capable to resync traces on its own, right ?

No, this might be because of hardware optimizations, not compiler ones. There’s a hardware loop optimizer on the SAM4S which might be causing this. Try the commit that I linked, as that one disables the loop optimization.

Alex

yes, you were right, it was due to the hardware optimizer, thank you

No problem. Thanks for confirming.

Alex