Skip to content

PickKit 5 device is not found #168

@wholder

Description

@wholder

Describe the problem

Ive been successfully using hid4java for several years to enumerate and talk to USB-based debuggers such as the PicKit 4. I recently I tried to use the newer PicKit 5 device, but it is not detected by hid4java (even with the latest 0.8.0 release.) The PicKit 5 seems to be visible in the Mac's USB menu, but this may be a false indication as the device also contains a serial port.

Platform

Mac Pro 5,1 using Mojave 10.14.6 (18G9323)

To Reproduce

Try to enumerate with code like:

for (HidDevice hidDevice : hidServices.getAttachedHidDevices()) {
   ...

and the PicKit 5 is not found...

Expected behavior

Expected to find the device

Additional information

This test code should illustrate the problem:

package org.hid4java;
import org.hid4java.*;

public class ListHIDDevices {
public static void main(String[] args) throws HidException {
ListHIDDevices example = new ListHIDDevices();
example.listDevices();
}

public void listDevices () throws HidException {
// Configure to use custom specification
HidServicesSpecification hidServicesSpecification = new HidServicesSpecification();
hidServicesSpecification.setAutoShutdown(true);
hidServicesSpecification.setScanInterval(500);
hidServicesSpecification.setPauseInterval(5000);
hidServicesSpecification.setScanMode(ScanMode.SCAN_AT_FIXED_INTERVAL_WITH_PAUSE_AFTER_WRITE);
// Get HID services using custom specification
HidServices hidServices = HidManager.getHidServices(hidServicesSpecification);
// Start the services
hidServices.start();
// Provide a list of attached devices
for (HidDevice hidDevice : hidServices.getAttachedHidDevices()) {
int iNum = hidDevice.getInterfaceNumber();
String manf = hidDevice.getManufacturer().trim();
String prod = hidDevice.getProduct();
int vendor = hidDevice.getVendorId();
int product = hidDevice.getProductId();
String serialNum = hidDevice.getSerialNumber();
int usage = hidDevice.getUsage();
String id = hidDevice.getId();
int releaseNum = hidDevice.getReleaseNumber();
int usePage = hidDevice.getUsagePage();
System.out.printf("%04X:%04X:%04X - prod: %-30s, manf: %s", vendor, product, usage, prod.trim(), manf.trim());
System.out.print((manf.length() > 1 ? " (" + manf + ")" : "") +
(serialNum != null && serialNum.length() > 0 ? " (serial number: " + serialNum + ")" : ""));
if (hidDevice.isOpen()) {
hidDevice.close();
}
if (hidDevice.open() && hidDevice.isOpen()) {
hidDevice.setNonBlocking(true);
hidDevice.close();
}
System.out.println();
}
// Shut down and rely on auto-shutdown hook to clear HidApi resources
hidServices.shutdown();
}
}

With the PickKit 4 I see this line included in the printout with the other HID devices:

03EB:2177:0001 - prod: MPLAB PICkit 4 CMSIS-DAP , manf: Microchip Technology Incorporated (Microchip Technology Incorporated) (serial number: BUR202273231)

However, when I switch to the PicKit 5 only the other HID devices are listed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions