Skip to content

mvandenabeele/YKUSH-CDC

 
 

Repository files navigation

PIC 16F1454 USB to Serial Adapter Firmware

This firmware turns a PIC 16F1454 into a USB to Serial adapter like e.g. the famous FTDI FT232RL.

Advantages

  • The PIC is less than half the price and available in a 14 pin DIL package.
  • Like the FTDI it runs without an external oscillator.
  • Unlike the FTDI the source code is available and you can know exactly how everything is working, or even change things like e.g. the blinking pattern.
  • Unlike some atmega8 solutions, it runs in full speed (USB 2.0) and is thus fully compliant with the USB standard.

Origin

The code is mainly a copy of the this project (google english), which is basically a stand-alone copy of Microchip's CDC - Serial Emulator Demo code.

The following changes were made:

  • The project was changed to compile for the 16F1454 instead of the 16F1455.
  • The code was changed to break out the DTR signal (on pin RC3) which is needed for fully automatic flashing of Arduino-like atmegas.
  • The status LEDs were relocated to pins RC0 and RC1

Obtaining the firmware

For your convenience, the pre-compiled .hex-file is can be downloaded here (right click "Save as...").

Getting it to run

If you come from the Arduino/AVR world and don't have a programmer for PICs, you can try out my fork of ardpicprog that enables you to program some PICs and especially the 16F1454 using a special sketch for your Arduino. Read this documentation and further detail for the 16F1454 here to learn how to use the programmer.

For a basic wiring instructions, please refer to the schematic on the original project page. Generally, the following connections need to be made:

  • USB D+ (green wire) to pin RA0
  • USB D- (white wire) to pin RA1
  • USB GND (black wire) to pin Vss (14) and to GND of the serial destination device
  • RC5 (Rx) to Tx of serial destination device (optionally via a 220 Ohm resistor)
  • RC4 (Tx) to Rx of serial destination device (optionally via a 220 Ohm resistor)
  • A 0.1µF cap between Vdd (pin 1) and GND
  • A 0.1 to 0.47µF cap between Vusb (pin 11) and GND

For a USB powered circuit (5V serial signals!)

  • USB Vdd (red wire) to Vdd (and possibly to serial destination device). Optionally via a PTC self resetting fuse).

If your serial destination device runs on 3.3V, you either have to

  • power the PIC from the 3.3V supply of the destination device,
  • or you have to power the PIC (and possibly the destination device) with a separate voltage regulator (you should use an LDO, i.e. a low drop-out type if you want to power the regulator form USB Vdd),
  • or you have to use level-shifters or voltage dividers on the Rx and TX lines.

Optionally:

  • Status LEDs on RC0 and RC1 via current limiting resistors to ground
  • DTR signal on RC3 to reset circuit of atmega with Arduino-bootloader (via level-shifter, if PIC and atmega don't run both on the same voltage)

Making changes

If you are running Linux and have the xc8 compiler installed, you should ba able to build the project yourself using make. Otherwise you will have to install the MPLAB.X IDE (the MPLAB.X directory is the IDE's project definition).

About

PIC 16F1454 USB to Serial Adapter Firmware

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 81.2%
  • Objective-C 12.7%
  • Makefile 3.6%
  • C++ 1.7%
  • Other 0.8%