strict warning: Only variables should be passed by reference in /sites/linuxpc.info/httpdocs/modules/book/book.module on line 559.

Microchip PIC

This is work in progress (14-2-2010).

The PIC is a family of microcontrollers developed by Microchip. On this page we will focus on the PIC18F4550 which is a microcontroller with USB support. Back in 2007 I did a lot of work on this, but due to lack of time I was forced to put it aside for a while, until now. In the meantime the development software has changed a bit, as well as the Linux distributions, so we will be going back to square one, which is a good opportunity for newcomers to join in.

First you need the microcontroller itself of course, and you need a programmer in order to program the microcontroller. You can build a programmer for yourself, as I did back then. However nowadays it is not really worth the effort as you can buy the Pickit 2 programmer for under 50 euro's, and it is often more reliable than a low cost self made programmer.

Installing the software for the Pickit 2 programmer

We will install and use pk2cmd which allows you to control your Pickit 2 programmer:

  • install the package libusb-dev:
    aptitude install libusb-dev
  • download the source of pk2cmd from http://www.microchip.com/pickit2. The software is nearly at the bottom of the page, section "Linux & Mac OS X software (Unsupported)".
  • extract it, cd to it, and build it:
    tar zxvf pk2cmdv1.20LinuxMacSource.tar.gz
    cd pk2cmdv1.20LinuxMacSource
    make linux
  • copy 2 files to the bin directory:
    cp pk2cmd PK2DeviceFile.dat /usr/local/bin
    chmod 644 /usr/local/bin/PK2DeviceFile.dat
    According to the readme file, the dat file should be copied to /usr/share/pk2 instead, and that directory should be added to your PATH, but the solution above also works, and it is less dirty IMHO.

Now connect your Pickit 2 and verify it is working by using this command:

pk2cmd '-S#'

The required firmware version on the Pickit 2 is v2.32.00 or later, so if an earlier version is reported, it is time to upgrade the firmware:

  • download the firmware v2.32 from the website
  • unzip it:
    unzip PK2V023200.zip
  • flash the hex file:
    pk2cmd -DPK2V023200.hex
  • check if it worked:
    pk2cmd '-S#'
    
    If the firmware version reported is 2.32.00 or higher then you are okay.

Here is a list of commands commonly used:

pk2cmd '-S#' list all connected Pickit 2 devices and their firmware version
pk2cmd -Dfile replace the firmware by the contents of the specified file
pk2cmd -Ppart -R -T power on the target, part is for example PIC18F4550. The -R option is needed to release the Vpp line, which is also the MCLR (reset) on many PIC's.
pk2cmd -Ppart -W power off the target
pk2cmd -Ppart -Ffile -M program the target using specified file

Connecting the programmer to the microcontroller

The pinout of the Pickit 2 is:

1 Vpp (programming voltage)
2 Vdd (target power, often 5V)
3 Vss (Gnd)
4 PGD (program data)
5 PGC (program clock)
6 Aux (not used)

To connect the Pickit 2 to the PIC18F4550:

Pickit 2 PIC18F4550 Optional, if PIC is programmed in application circuit
1 1 pullup 10k to +5V
2 11+32 do not make this connection if using external power
3 12+31  
4 40 10k series resistor to application circuit
5 39 10k series resistor to application circuit
6 n.c.  

It is possible to use the Pickit 2 programmer as (limited) power supply for your application circuit.

Getting and building PUF

The latest release of PUF is at the time of writing from 2007, so you are probably better of using the nightly CVS snapshot which you can find here: http://gforge.enseeiht.fr/snapshots.php?group_id=10. To build, first install flex and bison, extract PUF, cd to it, then do the following:

cd device/puf
aclocal
automake
autoconf
./configure
make

The pinout of the USB connectors:

1 Vcc
2 D-
3 D+
4 Gnd

 

host, A: +-----------+
         | --------- |
         |  - - - -  |
         +-----------+
            1 2 3 4

slave, B:  ---------
         /  -     -  \
        |   2     1   |
        |   3     4   |
        |   -     -   |
        +-------------+ (chassis part)

(This document is not finished. To be continued...)

Incredible site you have

Incredible site you have here, so much cool data!.. More Information and facts

Your content is shows

Your content is shows potential, m gona add this to my bookmarks. brian holm lawyer san diego

Very interesting and

Very interesting and different! Keep it coming! I love the way you write and share your niche! trust flow majestic

I truly welcome this superb

I truly welcome this superb post that you have accommodated us. I guarantee this would be valuable for the vast majority of the general population. buy lol smurfs

You are very brave focuses in

You are very brave focuses in this article. I would have never thought to be any of these in the event that I didn"t run over this. Much appreciated!. post Foundation jobs

Pleasant Informative Blog

Pleasant Informative Blog having decent sharing.. get more Info

Wow, cool post. I’d like to

Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though. Foods That Cause Inflammation

Coinsq.com provides all the

Coinsq.com provides all the information about realtime prices & market cap of cryptocurrencies and more. Bitcoin price

A debt of gratitude is in

A debt of gratitude is in order for another superb post. Where else might anybody be able to get that sort of information in such a perfect method for composing kaip numesti svorio

The Grand Chute-based school

The Grand Chute-based school that educates about 52,000 students each year enrolls many workers who have been displaced because of the recession. best photography studio in Katy

Decent to be going to your

Decent to be going to your web journal once more, it has been months for me. Well this article i've been sat tight for so long. I require this article to finish my task in the school, and it has same theme with your article. Much obliged, awesome offer. autoradio gps update website

I imagine that much obliged

I imagine that much obliged for the valuabe data and bits of knowledge you have so given here. http://www.casino-cash-bonus.com/

This is an extraordinary

This is an extraordinary article a debt of gratitude is in order for sharing this enlightening data. I will visit your online journal consistently for some most recent post. I will visit your web journal frequently for Some most recent post. visit this link

I am glad to discover this

I am glad to discover this post Very valuable for me, as it contains parcel of data. I Always like to peruse The Quality and happy I discovered this thing in you post. Much appreciated software development costa rica

I truly like your thoughts on

I truly like your thoughts on the issue. I now have an unmistakable thought on what this matter is about.. Health Benefits of Garlic

Good composed article. It

Good composed article. It will be strong to any individual who uses it, including me. Continue doing what you are doing – can'r hold up to peruse more posts. Friv2017

I needed to thank you for

I needed to thank you for this extraordinary read!! I unquestionably appreciating each and every piece of it I have you bookmarked to look at new stuff you post. io games

Fantastic article.

Fantastic article. Exceptionally fascinating to peruse. I truly love to peruse such a decent article. Much obliged! continue shaking. Thomas Frank Paquin

This is the kind of data I"ve

This is the kind of data I"ve long been attempting to discover. Much obliged to you for composing this data. cheapest color copies printing

They did good work and aimed

They did good work and aimed to provide me with the highest level of customer service to make sure I was a satisfied customer. Glass repair

The Grand Chute-based school

The Grand Chute-based school that educates about 52,000 students each year enrolls many workers who have been displaced because of the recession. Getting a Car Loan With No Credit

Pleasant learning picking up

Pleasant learning picking up article. This post is truly the best on this significant theme. ronaldo wages

I am upbeat to discover this

I am upbeat to discover this post exceptionally helpful for me, as it contains part of data. I generally want to peruse the quality substance and this thing I found in you post. A debt of gratitude is in order for sharing. invokana amputations

That is the amazing attitude,

That is the amazing attitude, in any case is simply not make each sence at all proclaiming about that mather. Practically any system an abundance of thanks notwithstanding i had attempt to advance your own particular article into delicius in any case it is obviously a predicament utilizing your data destinations would you be able to please recheck the thought. much appreciated yet again. Best Mouthwash for Smokers

Simply respecting your work

Simply respecting your work and thinking about how you dealt with this website so well. It's remarkable to the point that I can't stand to not experience this important data at whatever point I surf the web! Fifty Motion

Thank you for another great

Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information. Language of Desire

A debt of gratitude is in

A debt of gratitude is in order for setting aside an ideal opportunity to examine this, I feel emphatically about it and affection adapting more on this theme. On the off chance that conceivable, as you pick up skill, would you psyche overhauling your online journal with more data? It is to a great degree supportive for me. Jimmy Hogg

This one is great. keep doing

This one is great. keep doing awesome!.. magnets

Much obliged to you so much

Much obliged to you so much Love your site.. Lean Belly Breakthrough

Wow i can say this is another

Wow i can say this is another extraordinary article not surprisingly of this blog.Bookmarked this website.. printing places near me

I adore this site!! The blaze

I adore this site!! The blaze up the top is great!! Mahesh babu photos

Really decent post. I just

Really decent post. I just unearthed your weblog and needed to say that I have truly delighted in searching your blog entries. After all I'll be subscribing to your food and I trust you compose again soon! north georgia cabins

sirking79

Great survey, I'm sure you're getting a great response. Questions to ask your girlfriend

I imagine that a debt of

I imagine that a debt of gratitude is in order for the valuabe data and bits of knowledge you have so given here. click for source

Much obliged for your

Much obliged for your understanding for your phenomenal posting. I'm happy I have set aside an ideal opportunity to see this. ac repair services richmond hill

Magnificent article, a debt

Magnificent article, a debt of gratitude is in order for assembling this! This is clearly one extraordinary post. A debt of gratitude is in order for the important data and experiences you have so given here. clicking here

Exceptionally valuable post.

Exceptionally valuable post. This is my first time i visit here. I discovered such a large number of fascinating stuff in your site particularly its exchange. Truly its awesome article. Keep it up. https://www.cheap55printing.com/blog/cheap-business-card-advertising-ideas/

Much obliged to you for

Much obliged to you for peopling get the data they require. Incredible stuff not surprisingly. Keep up the considerable work!!! Questions to ask your boyfriend

A debt of gratitude is in

A debt of gratitude is in order for the post and extraordinary tips..even I likewise believe that diligent work is the most essential part of getting achievement.. cheapest 55 printing

That is the amazing attitude,

That is the amazing attitude, in any case is simply not make each sence at all proclaiming about that mather. Practically any system an abundance of thanks notwithstanding i had attempt to advance your own particular article into delicius in any case it is obviously a predicament utilizing your data destinations would you be able to please recheck the thought. much appreciated yet again. warehousing in lagos

A debt of gratitude is in

A debt of gratitude is in order for imparting pleasant data to us. i like your post and all you impart to us is uptodate and very useful, i might want to bookmark the page so i can come here again to peruse you, as you have made a brilliant showing. More Bonuses

Its an extraordinary delight

Its an extraordinary delight perusing your post.Its brimming with data I am searching for and I want to post a remark that "The substance of your post is marvelous" Great work. gta5cash

I truly delighted in perusing

I truly delighted in perusing this post, huge fan. Keep doing awesome me when would you be able to distribute more articles or where would I be able to peruse more on the subject? The Magic of Making Up

Extremely intriguing online

Extremely intriguing online journal. Alot of web journals I see nowadays don't generally give anything that I'm keen on, however I'm most definately inspired by this one. Recently felt that I would post and let you know. visqueen

I have perused your online

I have perused your online journal it is exceptionally useful for me. I need to express profound gratitude to you. I have bookmark your site for future redesigns. best morocco tour companies

Brilliant .. Astounding ..

Brilliant .. Astounding .. I'll bookmark your online journal and take the nourishes likewise… I'm glad to discover such a large number of valuable information here in the post, we need work out more procedures in such manner, much obliged for sharing. corrugated plastic

I needed to thank you for

I needed to thank you for this phenomenal read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post. read this

This article is an engaging

This article is an engaging abundance of enlightening information that is intriguing and elegantly composed. I praise your diligent work on this and thank you for this data. You have what it takes to get consideration. Free printing near me

This is an awesome post. I

This is an awesome post. I like this topic.This site has heaps of advantage.I discovered numerous fascinating things from this site. It helps me in numerous ways.Thanks for posting this once more. Benefits of Cucumbers

I went over this site and I

I went over this site and I trust you have a ton of brilliant data, spared to my bookmarks www.cheap55printing.com/blog/cheap-color-copies-new-york-2/