USB is not easy and isochronous transfer is the most difficult transfer type. I've done a bare minimim example with PICkit 2 (18F2550). However, it still needs quite some improvement both on the firmware side and the host side. Unfortunately I am quite weak especially on the host side.
http://forum.microchip.com/tm.aspx?m=270049
Tuesday, August 14, 2007
Wednesday, July 11, 2007
PICkit 2 as a USB Learning Tool
1. Brad Minch's Lab 2 HID example using gputils
http://www.curdes.com/gnupic/GnuPic.html
2. PICKit 2 CDC emulation ported from Microchip's PICDEM FS USB
http://forum.microchip.com/tm.aspx?m=267849
3. Mark Rages' PICKit 2 as a SPI Protocol Analyser Hack
http://vivara.net/blog/?p=55
The code is written in SDCC.
http://vivara.net/software/pickit_spi/pickit-spi.tar.gz
http://www.curdes.com/gnupic/GnuPic.html
2. PICKit 2 CDC emulation ported from Microchip's PICDEM FS USB
http://forum.microchip.com/tm.aspx?m=267849
3. Mark Rages' PICKit 2 as a SPI Protocol Analyser Hack
http://vivara.net/blog/?p=55
The code is written in SDCC.
http://vivara.net/software/pickit_spi/pickit-spi.tar.gz
Sunday, July 8, 2007
PIC MCU USB Links
I have started a thread in Microchip Forum to collect the links
related to PIC MCU and USB. Many others have also contributed
to the link collections. It is here:
http://forum.microchip.com/tm.aspx?m=123533
related to PIC MCU and USB. Many others have also contributed
to the link collections. It is here:
http://forum.microchip.com/tm.aspx?m=123533
Sunday, June 10, 2007
PICkit 2 under Linux Mini-Howto
Edit: please take note this Mini-How to is obsolete now. Please go to Microchip's PICkit 2 website to download pk2cmd codes. It now supports Linux and Mac OS X along with Windows.
PICkit 2 (http://www.microchip.com/pickit2) is a nice little USB programmer from Microchip. It now supports many Flash MCUs from Microchip. As of now, most of the PIC12F/16F/18F 8-bit PIC MCUs and PIC24/dsPIC30/dsPIC33 16bit MCUs are supported (http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit%202%20Readme%20v2-30.txt).
Microchip has kindly published the source codes for PICkit 2 firmware and the standardalone PC application (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1960).
PICkit 2 works under Linux thanks to the efforts from several developers. The easiest to start with is pk2 from Jeff Post (http://home.pacbell.net/theposts/picmicro/). pk2-2.04 only supports version 1.x (up to V1.21) firmware. The upcoming pk2-3.x will support version 2.x firmware.
The following is the simple procedure to get pk2-2.04 built under Linux.
1) Make sure you have the necessary compiler (gcc/make) and libusb development package. Normally they are already included in the distribution.
2) Download pk2-2.04. Apply the follow patch for the file pk2usb.c.
//#if HAVE_LIBUSB_INTERRUPT_MODE
// latest libusb: interrupt mode, works with all kernels
# define PICKIT_USB(direction) usb_interrupt_##direction //only keep this line
//#else
// older libusb: bulk mode, will only work with older kernels
//# define PICKIT_USB(direction) usb_bulk_##direction
//#endif
3) Modify the default Makefile. Normally you should be using kernel version Linux 2.6.x and you should use the following option.
# ----- Use the following for Linux kernel 2.6.x: -----
CFLAGS=$(OPTS) -I$(LIBUSB)/include -DLINUX -DUSE_DETACH -DCLAIM_USB
4) Built pk2 with the command "make"
5) Test out pk2. Normally you need to run as root if you have not setup the proper hotplug/udev rules.
6) If it is okay, set up the hotplug/udev rules. This will depend on your distribution. The following is a quick start for you.
http://piklab.sourceforge.net/wiki/index.php/Port_connection_problems
You can read the bundled usbhotplug.txt by Linus Walleij for more information about udev/hotplug.
7) If you encounter problems with pk2, try to ask question in pickit-devel mailing list (http://groups.google.com/group/pickit-devel). Take note that you should ask general questions about PICkit 2 in Microchip Forum (http://forum.microchip.com/tt.aspx?forumid=15). There are some good information about PICkit 2 in the Microchip Forum. In paticular, if you encounter USB emuneration problem under Linux, try the hardware changes detailed in the post (http://forum.microchip.com/tm.aspx?m=245280). Only Step 2 is necessary.
8) How to help out?
From Jeff Post: http://home.pacbell.net/theposts/picmicro/helping.html
Note on 10-April-2009: it is now better to use pk2cmd at Microchip PICkit 2 websites.
http://www.microchip.com/pickit2
PICkit 2 (http://www.microchip.com/pickit2) is a nice little USB programmer from Microchip. It now supports many Flash MCUs from Microchip. As of now, most of the PIC12F/16F/18F 8-bit PIC MCUs and PIC24/dsPIC30/dsPIC33 16bit MCUs are supported (http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit%202%20Readme%20v2-30.txt).
Microchip has kindly published the source codes for PICkit 2 firmware and the standardalone PC application (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1960).
PICkit 2 works under Linux thanks to the efforts from several developers. The easiest to start with is pk2 from Jeff Post (http://home.pacbell.net/theposts/picmicro/). pk2-2.04 only supports version 1.x (up to V1.21) firmware. The upcoming pk2-3.x will support version 2.x firmware.
The following is the simple procedure to get pk2-2.04 built under Linux.
1) Make sure you have the necessary compiler (gcc/make) and libusb development package. Normally they are already included in the distribution.
2) Download pk2-2.04. Apply the follow patch for the file pk2usb.c.
//#if HAVE_LIBUSB_INTERRUPT_MODE
// latest libusb: interrupt mode, works with all kernels
# define PICKIT_USB(direction) usb_interrupt_##direction //only keep this line
//#else
// older libusb: bulk mode, will only work with older kernels
//# define PICKIT_USB(direction) usb_bulk_##direction
//#endif
3) Modify the default Makefile. Normally you should be using kernel version Linux 2.6.x and you should use the following option.
# ----- Use the following for Linux kernel 2.6.x: -----
CFLAGS=$(OPTS) -I$(LIBUSB)/include -DLINUX -DUSE_DETACH -DCLAIM_USB
4) Built pk2 with the command "make"
5) Test out pk2. Normally you need to run as root if you have not setup the proper hotplug/udev rules.
6) If it is okay, set up the hotplug/udev rules. This will depend on your distribution. The following is a quick start for you.
http://piklab.sourceforge.net/wiki/index.php/Port_connection_problems
You can read the bundled usbhotplug.txt by Linus Walleij for more information about udev/hotplug.
7) If you encounter problems with pk2, try to ask question in pickit-devel mailing list (http://groups.google.com/group/pickit-devel). Take note that you should ask general questions about PICkit 2 in Microchip Forum (http://forum.microchip.com/tt.aspx?forumid=15). There are some good information about PICkit 2 in the Microchip Forum. In paticular, if you encounter USB emuneration problem under Linux, try the hardware changes detailed in the post (http://forum.microchip.com/tm.aspx?m=245280). Only Step 2 is necessary.
8) How to help out?
From Jeff Post: http://home.pacbell.net/theposts/picmicro/helping.html
Note on 10-April-2009: it is now better to use pk2cmd at Microchip PICkit 2 websites.
http://www.microchip.com/pickit2
Subscribe to:
Posts (Atom)