PPK2 Interface
PPK2Interface
Provides an interface to Nordic's PPK2 current measurement device. The sampling rate is fixed at 100 KS/s, which means that data collection has to be done in a separate process. This interface manages that child process, as well as converting the raw samples from the PPK2 into actual current values.
Methods:
Name | Description |
---|---|
__init__ |
Create the PPK2 interface. |
close |
Close the interface, stop the child process and cleanup all resources. |
find_ppk2_port |
Search existing COM ports for the PPK2 device. |
get_samples |
Return list of current measurement values. Units are amperes. The list may be empty |
open |
Open PPK2 and launch a child process to collect data. This function |
set_ampere_meter_mode |
Set the PPK2 into ampere meter mode, where the PPK2 is in series with the current to be measured. |
set_device_power |
Toggle the PPK2's power supply output. |
set_source_meter_mode |
Set the PPK2 into source meter mode, where the PPK2 supplies power to the DUT. |
start_measuring |
Start collecting current measurement data. The device must be open and a mode |
stop_measuring |
Stop collecting current measurements and kill background thread. |
__init__(serial_port=None)
Create the PPK2 interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
serial_port
|
str
|
Name of PPK2 serial port (or None to auto-detect) |
None
|
close()
Close the interface, stop the child process and cleanup all resources.
Returns:
Type | Description |
---|---|
bool
|
True on success, False otherwise. |
find_ppk2_port()
staticmethod
Search existing COM ports for the PPK2 device.
get_samples()
Return list of current measurement values. Units are amperes. The list may be empty if an error occurred during collection.
Returns:
Type | Description |
---|---|
list
|
List of current measurement values. |
open()
Open PPK2 and launch a child process to collect data. This function also opens the serial port and resets the PPK2 prior to operation.
Returns:
Type | Description |
---|---|
bool
|
True on success, False otherwise. |
set_ampere_meter_mode()
Set the PPK2 into ampere meter mode, where the PPK2 is in series with the current to be measured.
Returns:
Type | Description |
---|---|
bool
|
True on success, False otherwise. |
set_device_power(power_on)
Toggle the PPK2's power supply output.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
power_on
|
bool
|
True if power supply should be enabled, False if it should be disabled. |
required |
Returns:
Type | Description |
---|---|
bool
|
True on success, False otherwise. |
set_source_meter_mode(vdd_mv)
Set the PPK2 into source meter mode, where the PPK2 supplies power to the DUT.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vdd_mv
|
int
|
VDD value, in millivolts. |
required |
Returns:
Type | Description |
---|---|
bool
|
True on success, False otherwise. |
start_measuring()
Start collecting current measurement data. The device must be open and a mode (either source or ampere meter) must be set prior to starting measuring. This function does not block, but instead starts collection on a background process.
NOTE: After measuring is started, samples are collected at a rate of 100 KS/s (each sample is four bytes). It is the user's responsibility to ensure there is enough system memory to store the collected data.
Returns:
Type | Description |
---|---|
bool
|
True on success, False otherwise. |
stop_measuring()
Stop collecting current measurements and kill background thread.
Returns:
Type | Description |
---|---|
bool
|
True on success, False otherwise. |