Open Source PIC USB demoed

Honken dropped an open source USB firmware for PIC microcontrollers in the forum. This is a preliminary echo test that proves the concept, a layered stack will follow.

We ported the firmware to the IR Toy, you can load it up and test it yourself using the bootloader. That refreshing feeling is USB flowing from freely distributable source code.

This major milestone means open source PIC projects can soon do USB with completely open source code. Projects will be easier to compile because they won’t require a separate driver download from Microchip. This will be integrated into the USB IR Toy, Logic Sniffer, and Bus Pirate v4 prototype as soon as possible.

Thank you Honken for making this valuable contribution to open source!

Now about that VID/PID issue…

Image source (Simon Eugster CC-BY-SA)

Join the Conversation

2 Comments

  1. Sorry! Can’t wait any longer for my forum activation email so…

    Possible fix for the missing first character. See usb_stack.c line 406

    case USB_REQUEST_SET_CONFIGURATION:
    if (USB_NUM_CONFIGURATIONS >= packet[USB_wValue]) {

    /* Configure endpoints (UEPn – registers) */
    #define USB_EP(num, flow, typ, size, callback) \
    CAT(UEP,num) = flow;\
    usb_bdt[USB_CALC_BD(num, USB_DIR_OUT, USB_PP_EVEN)].BDCNT = size; \
    usb_bdt[USB_CALC_BD(num, USB_DIR_OUT, USB_PP_EVEN)].BDSTAT = UOWN; /* TODO: Should add DTSEN */ \
    //usb_bdt[USB_CALC_BD(num, USB_DIR_OUT, USB_PP_ODD)].BDCNT = size; \
    //usb_bdt[USB_CALC_BD(num, USB_DIR_OUT, USB_PP_ODD)].BDSTAT = UOWN; /* TODO: Should add DTSEN */ \
    usb_bdt[USB_CALC_BD(num, USB_DIR_IN, USB_PP_EVEN)].BDSTAT = 0; /* TODO: Should be DTSEN */ \
    //usb_bdt[USB_CALC_BD(num, USB_DIR_IN, USB_PP_ODD)].BDSTAT = 0; /* TODO: Should be DTSEN */ \
    USB_ENDPOINTS
    #undef USB_EP

    …………………….

    Note that the reference to the ODD BDs is commented out as ping-pong buffering is not used and as such, references to the ODD BDs are actually to the EVEN BDs of the next end-point. Thus the end points are not set-up correctly.

    Chances are that the first character problem will be fixed as the BDs are now set up correctly.

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.