PICJUG is an open source replacement for the FT232 USB chip from FTDI. I designed it because I find that I often need a serial port, JTAG port and a couple of outputs when talking to an embedded system and didn’t like connecting multiple devices to achieve this result. Ultimately, I wanted to drop a single inexpensive part in to a design to achieve these goals. PICJUG is named after what it does. It’s a PIC J TAG, U ART and G PIO device.
The software running PICJUG is based on the open-source M-Stack PIC USB stack by Signal 11 Software. I’m expanding it to expose three endpoints: the standard CDC serial port already exposed by the existing software, another endpoint for a JTAG port (emulating the standard AVR JTAG ICE) and a third endpoint to control two “open collector” port pins.
The JTAG port is intended to be flexible. I made sure to use the standard SPI and I2C port pins so I could utilize the SPI and I2C peripherals on the PIC and thus use the header to interface to pretty much any SPI or I2C device. This means that on top of it’s stated design goals, the PICJUG should be able to be used as a little interface board to pretty much any SPI or I2C device. With additional software work it should also be possible to use the JTAG header to program and debug any microcontroller using existing protocols and tools (AVR uses JTAG, ISP and PDI, PIC has JTAG and ISP, STM32 has JTAG and ST-Link, MSP430 has JTAG and SPI-by-Wire, etc., etc.). Similarly, debugging should be possible through similar interfaces that already exist. The design goal of PICJUG is to be able to use one part and one USB connection to achieve an inexpensive, reasonably flexible and robust development environment.
The primary driver for this design is cost. The FT232 is reasonably inexpensive (around $5.50 in onesie-twosie quantities) but I cannot use it as both a UART and a JTAG port. Microchip already has their MCP2200 which is half the cost of the FT232 but is even more limited because it can’t be used as a JTAG/programming port at all. My microcontroller of choice is the AVR series from Atmel, but they do not have a product offering with a USB peripheral which is anywhere near the cost of Microchip’s PIC16LF1454. Their parts also require an external oscillator, which adds more cost and board space.
The PIC16LF1454 is a really inexpensive ($1.71 in onesie-twosie), easy to solder (14-pin SOIC) microcontroller which does not need an external oscillator and which also provides enough I/O for the task at hand. I can drop one of these and a USB connector on any design and achieve a USB serial port, programming interface and reset mechanism. The PIC works from 5V down to 1.8V which also means I can seamlessly integrate it with low-voltage technologies found on FPGAs or for hacking a serial port on to routers, set-top boxes or other consumer equipment. Also, since it is just a generic microcontroller I can also modify the software for unusual scenarios that I might find myself needing something like this.
Schematic and Source¶
PICJUG is an open-source hardware project. All the design files are available for free under a GPLv2 license. The eagle library and board files for the breakout board are all hosted on github at the mixdownengineering/picjug repo. The modified m-stack source is located at the mixdownengineering/m-stack repo.
PICJUG Breakout Board¶
I’ve also built a small (25 x 38mm) breakout board very similar to the FTDI FT232 breakout boards for those who just want to easily obtain a logic-level UART. The price is yet to be determined, but I’m aiming at matching or doing slightly better than the breakout boards you can currently get. I’ve included a small regulator on the board to allow easy interfacing to 5V, 3.3V, 2.5V and 1.8V logic families. Changing the voltage currently involves swapping out a SOT25 part, but maybe a future version will have a rotary switch or other option.
It’s got all the usual blinkenlights you’d expect from a serial port, and includes current limiting resistors on all pins to help prevent mistakes from damaging the unit (or your target device). The open collector outputs can be turned into real GPIOs (inputs and outputs) with some straightforward board modification.