Instruction-level Power Measurement


I am trying to measure the power consumption of assembly instructions such as LDI. I am putting the instructions between high_trigger() and low_trigger() in simpleserial-base.c. I have tried LDI with different immediate values. Here are some snippets of the codes and their corresponding plots starting from sample 0:

1-Ascending_code.fig and Ascending.fig
2-Descending_code.fig and Descending.fig
3- Constant_code.fig and Constant.fig

Question1: Why is the trace pattern the same between samples 0 to 14 for all the 3 codes? Isn’t the Scope supposed to capture the trace starting from sample 0 or there are other events happening before it really starts capturing the first assembly instruction? Where is the starting point of the first instruction?

Question 2: The Ascending and Descending actually refer to the number of 1’s I am using in the immediate value since I guess the more 1’s you have, the more consumption there will be. But I don’t quite see the pattern. How should these traces be interpreted?

  1. Before the microcontroller is executing your instructions, it needs to return from the trigger_high() function, which involves popping a bunch of stuff off the stack. I’d recommend taking a look at the .lss file produced by the build, as this combines C code and assembly.
  2. Just loading things into registers takes very little power. You’re probably just seeing noise affecting the traces. Try moving the data you want to load to SRAM and taking a bunch of traces for each scenario and average them.