Using the PICKIT 1 USB programmer under Linux

The Pickit 1 USB programmer is nice and simple. It ships with a Windows based program to operate it. Under linux, you have to use something else.

On recent versions of Ubuntu, the program needs to be tweaked to work properly. I followed the instructions outlined by Chen Xiao Fan:
You can try to patch usb_pickit.c under Linux.

if (d){
/* add the following to detach the kernel HID driver under Linux */
    int retval;
    char dname[32] = {0};
    retval = usb_get_driver_np(d, 0, dname, 31);
    if (!retval)
    usb_detach_kernel_driver_np(d, 0);
/* End of added code */

    /* This is our device-- claim it */
    byte retData[reqLen];
    if (usb_set_configuration(d,pickit_configuration)) {
        bad("Error setting USB configuration.\n");
    } 

This worked perfectly for me. It’s function is to basically disconnect the pickit from the USB HID driver so that the programming software can control it.

Comments
2 Responses to “Using the PICKIT 1 USB programmer under Linux”
  1. Cole says:

    Thanks a bunch for this! I’m so glad I can play with my new toy without having to suffer through windows. Especially now that hitech has a new ide that plays nice with ubuntu (via eclipse)

    woohoo!

  2. james says:

    I created a DS2490 driver in user space by using lusb, but it can only run from “root”. The function usb_set_configuration() always fails from non-root user. Can anyone please help?
    Thanks, James

Leave A Comment