Friday, May 18, 2007

PIC Development Tools under FreeBSD

I am mainly a Linux user and Ubuntu is my preferred distribution. However from time to time I will also try other Linux distributions and FreeBSD.

Right now I have a small installation of FreeBSD 6 Stable. It is not as easy to use as Linux but it is definitely usable. The following is a list of links for PIC MCU development tools under FreeBSD.

FreeBSD has ports for gputils/sdcc/gpsim/picp/pikdev.
http://www.freebsd.org/ports/

It is also possible to build Piklab under FreeBSD.
http://piklab.sourceforge.net/wiki/index.php/Compilation_for_FreeBSD

PICStart+ works under FreeBSD with picp.

Wisp628 works under FreeBSD with xwisp2.
http://www.robh.nl/picsoft.php

JALv2 works under FreeBSD as well.
http://www.casadeyork.com/jalv2/
http://www.casadeyork.com/jalv2/jalv21src.zip

The main problem under FreeBSD is the lack of device drivers. But they are catching up. One of the things in development is the alternative USB stack by Hans Petter Selasky (http://www.turbocat.net/~hselasky/usb4bsd/). With his help I am now able to run pk2 and piklab to support PICKit 2 under FreeBSD.

For more detail, please refer to the following mailing list thread.

http://lists.freebsd.org/pipermail/freebsd-usb/2007-April/003182.html

You need to run the alternative USB stack (maybe you will need to use the stable or current branch) and apply the following patch to ugen.c in order to get pk2 to work. Maybe the patch is already in the latest version of the USB stack.

==== ugen.c#12 - ugen.c ====
@@ -637,9 +637,12 @@
{
return (EIO);
}
- /* setup clear stall */
- sce->xfer_out[0]->clearstall_xfer =
- sce->xfer_out[1];
+
+ if ((ed->bmAttributes & UE_XFERTYPE) == UE_BULK) {
+ /* setup clear stall */
+ sce->xfer_out[0]->clearstall_xfer =
+ sce->xfer_out[1];
+ }
break;

case UE_ISOCHRONOUS:
@@ -759,10 +762,6 @@
return (EIO);
}

- /* setup clear stall */
- sce->xfer_in[0]->clearstall_xfer =
- sce->xfer_in[1];
-
usbd_transfer_start(sce->xfer_in[0]);
PRINTFN(5, ("interrupt open done\n"));
break;
@@ -1322,6 +1321,17 @@

USBD_CHECK_STATUS(xfer);

+ tr_error:
+ if (xfer->error != USBD_CANCELLED) {
+ /* setup clear stall */
+ xfer->clearstall_xfer = sce->xfer_out[1];
+
+ /* start clear-stall */
+ usbd_start_hardware(xfer);
+ return;
+ }
+ return;
+
tr_transferred:

PRINTFN(5, ("xfer=%p actlen=%d\n",
@@ -1362,7 +1372,7 @@
return;

tr_setup:
- tr_error:
+ xfer->clearstall_xfer = NULL;
usbd_start_hardware(xfer);
return;
}

Wednesday, May 16, 2007

Microchip PIC MCU Development Tools under Linux

I've collected some links about PIC MCU Development Tools under Linux.

1. MPLAB under Linux with Wine (my mini-howto):
http://forum.microchip.com/tm.aspx?m=112347

2. PICkit 2 under Linux
pk2 by Jeff Post: http://home.pacbell.net/theposts/picmicro/
pyk by Mark Rages: search pyk http://groups.google.com/group/pickit-devel
piklab by Nicolas Hadacek: http://piklab.sourceforge.net/

3. MPLAB ICD 2 under Linux
http://piklab.sourceforge.net/

4. PICStart+ under Linux
PICP by Jeff Post: http://home.pacbell.net/theposts/picmicro/
Piklab: http://piklab.sourceforge.net/
Pista: http://gatling.ikk.sztaki.hu/~kissg/pd/pista/pista.html

5. PICDEM FS USB related project
1) PICDEM FS USB bootloader for Linux using libusb
http://www.internetking.org/fsusb/
http://forum.microchip.com/tm.aspx?m=106426
2)PICDEM FS USB demo appliation under Linux using libusb
http://www.varxec.net/picdem_fs_usb/

6. PICkit 1 under Linux
http://charm.cs.uiuc.edu/users/olawlor/projects/2003/microchip/
http://tfc.duke.free.fr/pickit.html

7. Basic tools: gputils assembler/linker, gpsim simulator and sdcc C compiler
GPutils: http://gputils.sourceforge.net/
GPSIM: http://www.dattalo.com/gnupic/gpsim.html
SDCC: http://sdcc.sourceforge.net/


SEEVAL32 EEPROM programmer

My blog is born today: 16-May-2007!

Today I borrowed a Microchip SEEVAL 32 Serial EEProm Designer Kit from local Microchip. The kit seems quite neat. The cost is US$99.

The URL for SEEVAL is at http://www.microchip.com/seeval32.

I am a big fan of Microchip PICKit 2 USB programmer and I am an active member of the pickit-devel Google group. Technically speaking, PICkit 2 (http://www.microchip.com/pickit2) should be able to support EEProm programming as well. Hopefully they can add the support soon.