Nordic Power Profiler Kit 2 (nrf-PPK2) Enumerates 2 Ports For A Single Device On Raspberry Pi

Hello,

I am trying to control a PPK2 using my Raspberry Pi 3B+ running a 64-bit image of the Raspberry Pi OS (Debian Bookworm port) and I've been using python (v3.9) with the ppk2-api library (v0.9.2). Unfortunately, there are two serial ports that are enumerated but only one of them gives me full control over the device. I've queried all the serial port identifiers using pyserial, pyusb, and udev but every identifier is the same for the two ports besides the port location. I've also used a laptop running Windows 11 and verified that only a single port is enumerated which functions as expected.

from ppk2_api.ppk2_api import PPK2_API
ppk2s_connected = PPK2_API.list_devices()
print(ppk2s_connected)

The code block above returns ["COM4"] on the Windows laptop and ["/dev/ttyACM0", "/dev/ttyACM1"] on a Raspberry Pi 3B+ and Raspberry Pi 4 running the previously mentioned Debian Bookworm port OS. The user seems to be able to access all device functionalities on the first enumerated port (/dev/ttyACM0) but not on the second port (/dev/ttyACM1). For example:

import time

from ppk2_api.ppk2_api import PPK2_MP

def test_ppk_dut_power(port: str) -> None:
    device = PPK2_MP(port=port)
    device.toggle_DUT_power("ON")
    time.sleep(10)
    device.toggle_DUT_power("OFF")
    
def test_ppk_voltage_change(port: str, voltage: float) -> None:
    device = PPK2_MP(port=port)
    device.set_source_voltage(int(voltage*1000))
    device.toggle_DUT_power("ON")
    time.sleep(10)
    device.toggle_DUT_power("OFF")

If the user executes these two methods using "/dev/ttyACM0" as the port value then the expected events will occur (DUT will turn on/off, output voltage will change to desired value) but if using "dev/ttyACM1" as the port value then the user will not be able to change the output voltage value even though they will be able to toggle the DUT power. It is worth noting that no errors/exceptions are raised when the program attempts to change the voltage value with port value set to "dev/ttyACM1" so as far as the user knows, the operation executed successfully. I was able to catch this error by connecting a voltage meter to my DUT and monitoring the voltage when port value was set to "dev/ttyACM1" instead of "dev/ttyACM0".

Parents
  • Hello,

    I have discussed with developer.

    We have added this extra com port in the release notes of the latest ppk2 software, and the script should now be adapted to use the serial port at the first endpoint of the enumerated ports.

    Thanks.

    BR

    Kazi

  • Hi Kazi,

    Thank you for the quick response. Can you please clarify which release includes the release note about this updated serial port detection logic? I'm looking at releases on github and could not find it: https://github.com/IRNAS/ppk2-api-python/releases.

    Also, does the feedback from the developer mean that the logic for PPK2_API.list_devices() has been updated to only return the first endpoint of the enumerated ports for every Nordic PPK connected to the machine? For example, is the expected behavior now for PPK2_API.list_devices() to return ["/dev/ttyACM0"] instead of ["/dev/ttyACM0", "/dev/ttyACM1"] per the example I originally provided? Thanks in advance.

    Best,

    Farbod

  • Hello Farbod,

    The API you are using is not officially supported by Nordic.

    The firmware was updated in 4.2.0 of the ppk app, but if you haven't used that at all then you have the original firmware and probably it could be another issue.

  • Hi Farbod, 

    As Nordic is not maintaining this repository and being not offically supported by Nordic, when Kazi mentioned releases she was thinking about the official software in nRF Connect for Desktop which just released Power Profiler v4.2.0. When connecting to the software you will be prompted to update the PPK2 if the firmware is outdated and this version introduced a new COM port. Have you done this with the 4.2.0 version?

    I have opened a PR at https://github.com/IRNAS/ppk2-api-python/pull/47 to accommodate this change which I advice you to use. The released version is also pretty old and there are some fixes for the multi process version your are using, so I advice you to move your repo HEAD to that PR. 

    The reason why you're seeing that Windows only returns one port, and Linux reports two is because the two OS'es handles USB CDC ports slightly differently. In Linux the device is enumerated as `PPK2` and both ports will have this description, whilst in Windows you get `nRF Connect USB CDC ACM (<COM>)` for the useful port, and just `USB Serial Device (<COM>)` for the other one due to the drivers that nRF Connect for Desktop installs, and the IRNAS script is searching for `nRF Connect USB CDC ACM`. 

    I hope this helps :) 

    - Christian

  • Hi Christian,

    Thank you for the thorough feedback and clarification, it was very helpful!

    Best,

    Farbod

Reply Children
Related