Closed jeremyherbert closed 1 year ago
The first set of measurements shows the current draw if no power is applied to DUT. The second set of measurement shows the current draw if power is applied to DUT.
The first set of measurements shows the current draw if no power is applied to DUT. The second set of measurement shows the current draw if power is applied to DUT.
I have the same issue. I run example.py on a PPK2 which is not actually wired to any device. Only mine prints
Average of 255 samples is: 8795772.699475234uA
every time instead of Average of 255 samples is: 9892526.66977888uA
Also I'd like to point out that the values printed are all exactly the same, which is 9.89A which is 9.89 times the maximum current output of the PPK. Real readings would have more variance than being exactly the same down to the femto-amp.
Running the nRF Connect Desktop App on my device with a test device, it outputs the following power signature:
But running example.py with this board always prints the exact same current measurements, 8795772.699475234uA which is obviously very far off the mark. Especially since the Nordic PPK app shows the max current is ~3050uA.
Additionally, when I modify the example.py to print out the set of samples before averaging I see that the set of samples is the same each time. example.py
ppk2_test.start_measuring()
for i in range(0, 1000):
read_data = ppk2_test.get_data()
if read_data != b'':
samples = ppk2_test.get_samples(read_data)
print(f"len {len(samples)}") # Added to debug
print(f"sum {sum(samples)}") # Added to debug
print(samples) # Added to debug
print(f"Average of {len(samples)} samples is: {sum(samples)/len(samples)}uA")
time.sleep(0.001) # lower time between sampling -> less samples read in one sampling period
CLI output
len 255
sum 2242922038.3661847
[14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667]
Average of 255 samples is: 8795772.699475234uA
len 255
sum 2242922038.3661847
[14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667]
Average of 255 samples is: 8795772.699475234uA
len 255
sum 2242922038.3661847
[14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667, 14799080.29953849, 16536447.828934833, 18351225.951359697, 20243414.66681308, -11303.79699310018, 797136.6160610073, 1682987.6221436344, 2646249.2212547814, 3686921.4133944483, 4805004.198562634, 6000497.576759341, 7273401.547984567, 8623716.112238308, 10051441.269520577, 11556577.019831363, 13139123.363170667]
Average of 255 samples is: 8795772.699475234uA
I am experiencing something very similar with my attempts yesterday.
also i tried to run the Multithreading example and it simply does not run
@geniusled example_mp.py doesn't run for me either.
@geniusled example_mp.py doesn't run for me either.
You should open a different issue for this. Maybe related to https://github.com/IRNAS/ppk2-api-python/issues/18 ?
@jeremyherbert @MarcianoPreciado @geniusled I have tested the example.py
and it does indeed not work properly.
Please try the following and report:
import time
from ppk2_api.ppk2_api import 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)
ppk2_test.get_modifiers()
ppk2_test.use_source_meter() # set source meter mode
ppk2_test.set_source_voltage(3300)
ppk2_test.toggle_DUT_power("ON") # disable 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
for i in range(0, 1000):
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()
Using this and nothing connected on the PPK, I get measurements around 0uA:
Average of 1024 samples is: 0.028505992364478597uA
Average of 1024 samples is: 0.019894968889890303uA
Average of 1024 samples is: 0.008455203404326157uA
Average of 1023 samples is: 0.005618572601013333uA
Average of 1024 samples is: 0.017066226878914445uA
Average of 1024 samples is: 0.016359041376170506uA
Average of 1024 samples is: 0.0004681671380414181uA
Average of 1023 samples is: 3.8837913846648616e-05uA
Average of 1024 samples is: 0.017690214087217934uA
Average of 1024 samples is: 0.019478977417687938uA
Average of 1024 samples is: 0.0028393185295946814uA
Average of 1023 samples is: -0.0031257877296210048uA
Average of 1024 samples is: 0.01585985160952768uA
Average of 1024 samples is: 0.025011663997978967uA
Average of 1024 samples is: -0.0023189757257142357uA
Average of 1023 samples is: 0.011406506343671335uA
Average of 1024 samples is: 0.027590811125633437uA
@NejcKle I'm unable to test this out until next week, but my hunch is that it will work. My guess is that there is some sort of serial de-sync happening when switching from DUT OFF to DUT ON after calling ppk2_test.start_measuring()
@MarcianoPreciado any new findings regarding this issue?
Closing this issue as it has been inactive.
Hi,
I have the latest version installed from pip. Currently the
example.py
file is broken as it doesn't set the source voltage.Also, in the example, it disables the DUT power but then starts measuring - why is this? Ampere mode appears to not work if this is disabled.
Assuming you set the source voltage, the output loses sync or something and prints bogus values after the
toggle_DUT_power("ON")
:(after first
start_measuring
call andtoggle_DUT_power("OFF")
)(after second
start_measuring
call andtoggle_DUT_power("ON")
)If I change the initial
toggle_DUT_power("OFF")
to"ON"
I get the same reading as the nordic ppk2 software.(I'm also not sure why the start measuring function is called twice, but stop measuring only once?)