IRNAS / ppk2-api-python

Power Profiling Kit 2 unofficial python api.
http://irnas.eu
GNU General Public License v2.0
145 stars 37 forks source link

ppk2 appears to output unexpected data after some period of time (without any DUT connected) #8

Closed StanKatsyukCT closed 3 years ago

StanKatsyukCT commented 3 years ago

Hi Team, filing another, separate issue I have encountered and verified with a colleague's PPK2.

Steps:

  1. Remove the ribbon cable from the PPK2 (so its not connected to anything)
  2. Execute the following code:
    
    """
    Basic usage of PPK2 Python API.
    The basic ampere mode sequence is:
  3. read modifiers
  4. set ampere mode
  5. read stream of data """ import time from ppk2_api import PPK2_API

ppk2_port = "/dev/tty.usbmodemD325C91691932" ppk2_test = PPK2_API(ppk2_port) ppk2_test.get_modifiers() ppk2_test.use_source_meter() # set source meter mode ppk2_test.toggle_DUT_power("OFF") # disable DUT power ppk2_test.toggle_DUT_power("ON") # disable DUT power ppk2_test.set_source_voltage(3300) # set source voltage to 3.3V ppk2_test.start_measuring() # start measuring

for i in range(0, 100000): read_data = ppk2_test.get_data() if read_data != b'': samples = ppk2_test.get_samples(read_data) print(f"Average of {len(samples)} samples is: {sum(samples)/len(samples)}uA") time.sleep(0.01)

ppk2_test.stop_measuring()

4. Keep test running for 10+ seconds
5. Observe the output will eventually start reading:
`Average of 255 samples is: 10391629.518528605uA` 

Average of 255 samples is: -0.010946676450025153uA Average of 255 samples is: -0.004954470508868714uA Average of 255 samples is: -0.023102294216371104uA Average of 255 samples is: -0.0155692353189173uA Average of 255 samples is: 10036523.282951381uA Average of 255 samples is: 10391629.518528605uA Average of 255 samples is: 10391629.518528605uA Average of 255 samples is: 10391629.518528605uA Average of 255 samples is: 10391629.518528605uA Average of 255 samples is: 10391629.518528605uA Average of 255 samples is: 10391629.518528605uA



If I run the same test but using the Power Profiler from NRF, I see it show a steady 23-28nA
![image](https://user-images.githubusercontent.com/55717075/121445657-c1b9b900-c946-11eb-822e-a3e00f5d01f2.png)

**Expected**: 
The data I get from the code snippet above matches that of the power profiler

**Actual**:
I get data from the PPK2 that appears to look like its non-responsive. This is the same behavior if I have PPK2 connected to my device under test as well. 

I have asked a colleague of mine to run the same snippet above using his PPK2 and he observed the same behavior. 

If I change the time.sleep value to something like `0.001` or lower, I do not see this issue. However, I understand that with shorter sleep times, my sample pool is also smaller and thus less precise? (?)  

Thanks in advance for your insight. 
StanKatsyukCT commented 3 years ago

Got it working, thanks everyone!

wlgrd commented 3 years ago

@StanKatsyukCT what was the solution? EDIT: Solution found from #7