Open Siddarth-Manja opened 1 year ago
@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
I will try modifying the buffer_chunk_seconds and run the script. Thank you.
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.