IRNAS / ppk2-api-python

Power Profiling Kit 2 unofficial python api.

Home Page:http://irnas.eu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to change the sample rate?

luizmanke opened this issue · comments

Hi! Nice module!

I've been using the PPK2 and your python module to read the current from nRF52840.
Now I want to change the sample rate of PPK2.
How can I do it with your python module?

Here's an image of how it's done using the Power Profiler from nRF Connect v3.6.1 :

image

Hi @luizmanke!

I'm glad to hear you've been using this module!
As far as we've discovered the sample rate cannot be changed and is set at 100k samples per second.
The setting in the nRF Connect App appears to be averaging in a window for prettier data display.

We've implemented something similar here:

def _average_samples(self, list, window_size):
"""Average samples based on window size"""
chunks = [list[val:val + window_size] for val in range(0, len(list), window_size)]
avgs = []
for chunk in chunks:
avgs.append(sum(chunk) / len(chunk))
return avgs

As @NejcKle said, you cannot change the actual sample rate from the hardware, just do software averaging.

Closing this issue as there is nothing to fix.