Installing and running PICPgm on Linux

Installation Steps


The following commands download and install PICPgm on your Linux machine:

cd ~
mkdir picpgm_install
cd picpgm_install
wget http://picpgm.picprojects.net/download/picpgm_v2810.tar.gz
tar xzvf picpgm_v2810.tar.gz
sudo ./install.sh

If you are running a 64 bit Linux distribution, also install ia32 libs:

sudo apt-get install ia32-libs

Hint:
Starting from PICPgm v2.9.0.0, PICPgm will be installed in the directory /opt/picpgm.
Earlier version of PICPgm where installed in the directory /usr/bin.

 

Running PICPgm with a serial port programmer (e.g. JDM)


If your programmer is connected to /dev/ttyS0, you can use the following command to program "yourhexfile.hex":

picpgm -port /dev/ttyS0 -p yourhexfile.hex

If you aren't sure at which serial port your programmer is connected, let PICPgm do the job. PICPgm will try to identify which serial port the programmer is connected to and program "yourhexfile.hex":

picpgm -p yourhexfile.hex

 

Running PICPgm with a parallel port programmer (e.g. Tait)


PICPgm uses the parport driver to access the parallel port. Hence you need to have access to the parport device if you are using a parallel port programmer. If you do not have access use the following command to grant access:

sudo chmod a+rw /dev/parport0

Hint: parport0 needs to be replaces with the desired port number if it is different than parport0.

Now you can program "yourhexfile.hex" with the following command where we assume that the programmer is connected to "/dev/parport0":

picpgm -port /dev/parport0 -p yourhexfile.hex

As already said, PICPgm also provides an auto-detection feature, i.e. it is able to find the port where the programmer is connected. So if you aren't sure at which port your programmer is connected, let PICPgm do the job:

picpgm -p yourhexfile.hex

Another way to access the parallel port is to directly use the parallel port I/O address (-paddr option). In this case you need to start picpgm as root (picpgm uses ioperm system call to write to I/O address). This way is not recommanded since you could damage your system if you use an I/O address which points to a non-parallel port address! The -paddr option specifies the base address of the parallel port to be used, e.g. if the parallel port base address is 0x378:

picpgm -paddr 0x378 -p yourhexfile.hex

 

Running PICPgm with the PICPgm USB programmer


PICPgm USB programmer is only supported starting from PICPgm V2.7.1.0 on Linux. To use the PICPgm USB programmer on Linux, ftdi_sio kernel module must be unloaded, i.e. run the following command before using PICPgm:

rmmod ftd_sio

Further, you have to install the FTDI device driver. For installation of the FTDI driver, follow the instructions here.

To see whether the driver installion was successfull and PICPgm can access the driver, run the following commend which will list all FTDI devices connected:

picpgm -listusb

If this is working, you can program you PIC with the following command:

picpgm -port USB -p yourhexfile.hex