Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max measurement time restricted to 60s. #31

Open
Siddarth-Manja opened this issue Apr 27, 2023 · 2 comments
Open

Max measurement time restricted to 60s. #31

Siddarth-Manja opened this issue Apr 27, 2023 · 2 comments

Comments

@Siddarth-Manja
Copy link

I have used this script and automated my tests and I have been measuring current for 60s. When I tried to change the duration to anything above 60s it fails. I tried to make this change by increasing the buffer_len_s and buffer_max_size_seconds. Please let me know if there is any other way to do it.

The exact issue I observed while increasing it past 60s was the PPK2 would start measuring and then it just gets stuck there and does not terminate at all. I then have to force close the terminal and re run the test.

@NejcKle
Copy link
Collaborator

NejcKle commented Jun 2, 2023

@Siddarth-Manja could you please provide a code snippet demonstrating your use case?

I have tried it with buffer_max_size_seconds=70 and buffer_chink_seconds=61. Using the snippet below

import time
from ppk2_api.ppk2_api import PPK2_MP as PPK2_API

ppk2s_connected = PPK2_API.list_devices()
if(len(ppk2s_connected) == 1):
    ppk2_port = ppk2s_connected[0]
    print(f'Found PPK2 at {ppk2_port}')
else:
    print(f'Too many connected PPK2\'s: {ppk2s_connected}')
    exit()

ppk2_test = PPK2_API(ppk2_port, buffer_max_size_seconds=70, buffer_chunk_seconds=61)
ppk2_test.get_modifiers()
ppk2_test.set_source_voltage(3300)

ppk2_test.use_source_meter()  # set source meter mode
ppk2_test.toggle_DUT_power("ON")  # enable DUT power

ppk2_test.start_measuring()  # start measuring
# measurements are a constant stream of bytes
# the number of measurements in one sampling period depends on the wait between serial reads
# it appears the maximum number of bytes received is 1024
# the sampling rate of the PPK2 is 100 samples per millisecond
while True:
    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.001)

I get the expected measurement buffer, 6100000 samples in size. The PPK2 samples at 100k samples per second, so 100000 samples x 61 seconds = 6100000 samples.

The output:

Average of 6100000 samples is: 8750.508140761196uA
Average of 6100000 samples is: 8751.338056338174uA
Average of 6100000 samples is: 8747.964081453956uA
Average of 6100000 samples is: 8752.112144369981uA
Average of 6100000 samples is: 8754.33733431175uA

@Siddarth-Manja
Copy link
Author

I will try modifying the buffer_chunk_seconds and run the script.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants