Dangerous Prototypes

Dangerous Prototypes => Bus Pirate Support => Pirate PIC programmer => Topic started by: ian on June 17, 2010, 11:21:02 am

Title: New PIC programmer adapter
Post by: ian on June 17, 2010, 11:21:02 am
This is the latest version of the PIC programming adapter.

Here's the main changes since the previous attempts:
*Stackable
*Bus Pirate can power circuit at 3.3 or 5 volts
*Bus Pirate can switch circuit power through a FET for VPP before VDD programming
*Removed AVR ISP adapter that didn't work
*Board is for v3, but cuttable/solderable jumpers make it work for v2go as well

Pictures and board attached, but the latest version is in SVN:
http://code.google.com/p/dangerous-prot ... programmer (http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/#svn/trunk/buspirate_adapter_pic_programmer)
Title: Re: New PIC programmer adapter
Post by: liyin on June 17, 2010, 03:54:11 pm
Nice. This one, like the BP, will see a lot of use & handling, so it would be great if a case can be sourced.
Title: Re: New PIC programmer adapter
Post by: ian on June 17, 2010, 07:01:39 pm
This is actually stackable, it will sit on top of the Bus Pirate so you don't need an extra 2x5 to 2x5 cable. I also want to make sure that a 1x5 ICSP cable is included with the board, I can never find parts like that.
Title: Re: New PIC programmer adapter
Post by: Sjaak on June 17, 2010, 07:07:20 pm
This is what comes very near to the cable I like to have along it:

http://www.seeedstudio.com/depot/4-pin- ... l?cPath=34 (http://www.seeedstudio.com/depot/4-pin-to-4-separated-pins-female-jumper-wire300mm-5-pcs-pack-p-264.html?cPath=34)

Only if it would have 6 (the extra pgm pin some pics need) it would be perfect! (http://www.seeedstudio.com/depot/6-pin- ... l?cPath=34 (http://www.seeedstudio.com/depot/6-pin-dualfemale-jumper-wire-300mm-5-pcs-pack-p-128.html?cPath=34) comes very close ;) )
Title: Re: New PIC programmer adapter
Post by: liyin on June 17, 2010, 08:21:52 pm
:(    But I just got the BP case! I'm gonna need a new case, anyway.
Title: Re: New PIC programmer adapter
Post by: ian on June 17, 2010, 08:33:26 pm
It should stack on top of your case too :)
Title: Re: New PIC programmer adapter
Post by: rsdio on June 18, 2010, 04:56:20 am
This looks awesome!

I do wonder about the expense of a specialized adapter, especially when compared to the low cost of a PIC programmer, but I suppose even $5 saved is worth it to some.  I don't mean this as a criticism - just an observation.
Title: Re: New PIC programmer adapter
Post by: Sjaak on June 18, 2010, 08:45:18 am
I think it fits the spirit of the buspirate perfectly. It is ment as a Swiss army knife and easily accessable. It brings PIC programming to people who otherwise wouldn't buy a PICprogrammer.

I like the idea that the functionality can be extended by either software or hardware. I hope a lot of extension are coming ;)
Title: Re: New PIC programmer adapter
Post by: liyin on June 18, 2010, 03:43:51 pm
So why not call it the BP PIC Programmer Shield?
Title: Re: New PIC programmer adapter
Post by: znanev on June 18, 2010, 04:43:55 pm
Will the HVP adapter be available through Seed Studio and at what price? Also any plans for options like the PCB only, kit or fully assembled?

For occasional PIC programming in my opinion this would be the best option for those of us already having BP :)
Title: Re: New PIC programmer adapter
Post by: ian on June 18, 2010, 05:20:03 pm
It will be available eventually. I don't know the price, it's still in development, but under $20 or it's not worth it.  This PCB went out this week, it'll be back in a month to stuff and test. Then we have to write some software to support it :) It will be available fully assembled, and we can probably have boards made up if you like too.
Title: Re: New PIC programmer adapter
Post by: znanev on June 18, 2010, 05:26:22 pm
[quote author="ian"]
It will be available eventually. I don't know the price, it's still in development, but under $20 or it's not worth it.  This PCB went out this week, it'll be back in a month to stuff and test. Then we have to write some software to support it :) It will be available fully assembled, and we can probably have boards made up if you like too.
[/quote]

Thanks for the explanation, Ian!

Hehe, it seems I'm too impatient ;)
Title: Re: New PIC programmer adapter
Post by: rsdio on June 18, 2010, 07:28:45 pm
[quote author="liyin"]So why not call it the BP PIC Programmer Shield?[/quote]Isn't the term "Shield" kinda reserved for the Arduino folks?  They might be a little miffed to see other products carry that name if they're not Arduino compatible.  Personally, I never liked the term, but it goes nicely with Arduino.  It might cause confusion if Bus Pirate extensions carried that name.
Title: Re: New PIC programmer adapter
Post by: liyin on June 18, 2010, 10:14:51 pm
:) )     Maybe BP PIC Programmer Wing! Module! Block!   Let's do a poll!
Title: Re: New PIC programmer adapter
Post by: Sjaak on June 19, 2010, 08:42:46 am
[quote author="rsdio"]
[quote author="liyin"]So why not call it the BP PIC Programmer Shield?[/quote]Isn't the term "Shield" kinda reserved for the Arduino folks?  They might be a little miffed to see other products carry that name if they're not Arduino compatible.  Personally, I never liked the term, but it goes nicely with Arduino.  It might cause confusion if Bus Pirate extensions carried that name.
[/quote]

I get a sorta itch from everything arduino. I prefer to call it just adapter :D
Title: Re: New PIC programmer adapter
Post by: rhyde on July 11, 2010, 09:11:02 pm
Lol I actually think shield is the right name, and that is the concept here.  So we can use it if we want.  I hate it when someone decides so redefine a perfectly good word, and try to claim it as their own.
Title: Re: New PIC programmer adapter
Post by: ian on July 30, 2010, 03:39:10 pm
Here's the assembled adapter. It's working. Now to test by programming an actual PIC. The first will be the USB IR Toy, which shouldn't be that much different than the OLS.
Title: Re: New PIC programmer adapter
Post by: znanev on July 30, 2010, 04:19:38 pm
Nice looking! I'm following this thread with great interest, waiting from the time when I'll be able to buy this adapter from Seeed.

Ian, you'll drop a post here once the adapter exits the factory, won't you? :)
Title: Re: New PIC programmer adapter
Post by: Sjaak on July 30, 2010, 04:36:06 pm
I guess he will even post on the blogs ;)
Title: Re: New PIC programmer adapter
Post by: ian on July 30, 2010, 05:32:06 pm
Sure, I'll give you a heads up here and on the blog. It should only be a week or two now :)

I'll also send a free adapter to anyone who submits a significant number of (working) PIC settings, as used in pic.c to define the memory, programming method, etc. of the PIC to be programmed:
http://code.google.com/p/dangerous-prot ... prog/pic.c (http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/trunk/PiratePICprog/pic.c)

I'll be honest and say I get really confused about how some PICs define words and program space, and how to add them to the program. I can't write much of a tutorial on this (yet), but if you write one we can add to the wiki I'll send you an adapter ;)

Code: [Select]
E:Workdp-svntrunkPiratePICprog>picprog -E -u COM12 -p buspirate -s 115200 -c
 18F2550
Pirate PIC Programer

Initializing interface
Entering binary mode
BP: Setup mode...
Setup peripherals...
(OK)
Found '18F2550' in programming database :) index = 0
Checking for 18F2550 attached to programmer...
Found 18F2550 (0X1247, ID: 0X92 REV: 0X7)
Erasing chip... OK :)

E:Workdp-svntrunkPiratePICprog>pause
Press any key to continue . . .

It works to ID and erase a 18F2550 (USB IR Toy, Flash Destroyer) with the latest SVN version of the piratePICprog app. Yeah!

Also interesting to note that there's no problem interfacing a 5.0volt target with the Bus Pirate at 3.3volts. That means programming 5volt targets without awkward hiz modes and pullup resistors.

I attached a version compiled with mingw. Note that it doesn't really validate the input, it just crashes on errors. The PIC name is case sensitive too, so be sure it's all caps. The version will erase/read/program the OLS and another Bus Pirate (18F24J50, 24FJ64GA002) without an adapter. It will erase/read a ir toy (18F2550) with the adapter, probably write but we need to get the memory ranges fixed first.
Title: Re: New PIC programmer adapter
Post by: rct on July 30, 2010, 06:51:59 pm
Does the 18F2550 (or 18F4550) require the high voltage adapter for programming?    The datasheet (http://http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf) says "Single-Supply 5V In-Circuit Serial Programming (ICSP) via Two Pins".    I'm new to this so apologies if it's a dumb question.

Thanks,
--Rob
Title: Re: New PIC programmer adapter
Post by: ian on July 30, 2010, 07:07:06 pm
Low voltage programming mode on 16/18F is ignored as far as I can tell, I have seen it as the butt of a joke on piclist several times. I think it's most common to use 13V VPP on all 16F and 18F pics, which requires the adapter. I'm not sure why though.
Title: Re: New PIC programmer adapter
Post by: Sjaak on July 30, 2010, 07:40:19 pm
With HVP programming you can totally program the PIC, with LVP you can almost totally program the PIC except some cornercases.

I.e.  the HVP can set/reset the LVP bit, and thus HVP programming will always work, but you need to design your circuit around it (13v tolerant /mclr). I also noticed that new pics have a max  Vpp of 7V instead of 13V.
Title: Re: New PIC programmer adapter
Post by: ian on October 27, 2010, 01:00:14 pm
The adapter is now available at seeed for $7. This is intended for developers only, there is NO software support:

http://www.seeedstudio.com/depot/bus-pi ... Path=61_68 (http://www.seeedstudio.com/depot/bus-pirate-pic-programming-adapter-for-developers-p-707.html?cPath=61_68)
Title: Re: New PIC programmer adapter
Post by: Sjaak on October 27, 2010, 01:34:47 pm
However there is some (limited) support in the commandline for pic10/12/16. see http://dangerousprototypes.com/forum/in ... opic=412.0 (http://dangerousprototypes.com/forum/index.php?topic=412.0)
Title: Re: New PIC programmer adapter
Post by: rct on November 11, 2010, 06:40:23 pm
When the Bus Pirate PIC programmer becomes generally available, any chance it will also have high voltage programming capability to rescue AVRs that have the fuses set incorrectly?

How different (aside from the connectors) is Bus Pirate High Voltage Programming adapter http://dangerousprototypes.com/2010/02/13/bus-pirate-high-voltage-programming-adapter/ (http://http://dangerousprototypes.com/2010/02/13/bus-pirate-high-voltage-programming-adapter/) which looks like it may have had AVR HVP capability from the Bus Pirate PIC Programmer adapter that is current in development?

MightyOhm has an Arduino AVR HVP rescue shield http://mightyohm.com/blog/products/avr-hv-rescue-shield/ (http://http://mightyohm.com/blog/products/avr-hv-rescue-shield/).     However of course it would be nice to get a single HVP adapter for the bus pirate.
Title: Re: New PIC programmer adapter
Post by: ian on November 11, 2010, 07:13:11 pm
There aren't enough pins to do the HVP rescue on AVRs, that's why it was scrapped from the v1 adapter.
Title: Re: New PIC programmer adapter
Post by: tayken on December 18, 2010, 06:40:29 pm
A few minutes ago, I wanted to test out the usage of my adapter. I opened up the schematics, found the ADC and 3V3 jumper configurations and soldered them (as it seems, these come preconfigured to v3, had to cut some tiny traces between pads before soldering for v2go). Then I tried running the high voltage test, just out of curiosity (plus it is the middle of the night, didn't want to start breadboarding with the 18F4550 board I have) but the test failed. I want to solve this before trying anything with 4550. The command line output is attached (of I hate cmd, you cannot copy anything!), BP has firmware v5.10

Any ideas?
Title: Re: New PIC programmer adapter
Post by: Sjaak on December 18, 2010, 06:55:29 pm
The jumpers are indeed configured for v3 (because there are more v3's sold then v2go)

It seems that something is broken in the binmode. Could you try v5.9?

Also you can try the normal buspirate interface:

Code: [Select]
WP <- power and pullup on
A <- should toggle +13V on mlcr
d <- read voltage

THere is a firmware of the buspirate to provide manual picprogramming, so also this topic: http://dangerousprototypes.com/forum/in ... pic=1190.0 (http://dangerousprototypes.com/forum/index.php?topic=1190.0)

BTW to copy from a cmd-box, rightclick, mark, select the output, rightclick :)

Code: [Select]
Microsoft Windows XP [versie 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:Documents and Settingschris>
Title: Re: New PIC programmer adapter
Post by: tayken on December 18, 2010, 07:07:20 pm
[quote author="Sjaak"]
BTW to copy from a cmd-box, rightclick, mark, select the output, rightclick :)

Code: [Select]
Microsoft Windows XP [versie 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:Documents and Settingschris>
[/quote]

I hate cmd! :) It is waaay easy to copy in PuTTY (i get logfiles for BP ;) ) or shell.

Below is the output form v5.10; first ADC value is jumper in 5v position, second in 3v3 position.

Code: [Select]
HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
9. DIO
x. exit(without change)

(1)>2
1WIRE routines (C) 2000 Michael Pearce GNU GPL
Ready
1-WIRE>WP
Power supplies ON
Pull-up resistors ON
1-WIRE>A
AUX HIGH
1-WIRE>d
VOLTAGE PROBE: 4.29V
1-WIRE>d
VOLTAGE PROBE: 4.25V
1-WIRE>

Will run a new test with v5.9 in a few minutes.
Title: Re: New PIC programmer adapter
Post by: Sjaak on December 18, 2010, 07:16:52 pm
4.25 is a good reading. It should be the Vpp/3.

That jumper only selects the Vcc for the pic target (and the Vpu)

Edit: the 5.9 is for testing with the HVP testapp. I think something was changed in teh binmode for avrdude in 5.9 -> 5.10
Title: Re: New PIC programmer adapter
Post by: tayken on December 18, 2010, 07:18:10 pm
Again the same problem with test program. This time I even got a couple of "cannot enter bitbang mode" problems.


Below is the output from v5.10; first ADC value is jumper in 5v position, second in 3v3 position.

Code: [Select]
HiZ> m2
1WIRE routines (C) 2000 Michael Pearce GNU GPL
Ready
1-WIRE> WP
Power supplies ON
Pull-up resistors ON
1-WIRE> A
AUX HIGH
1-WIRE> d
VOLTAGE PROBE: 4.26V
1-WIRE> d
VOLTAGE PROBE: 4.34V
1-WIRE>
Title: Re: New PIC programmer adapter
Post by: tayken on December 18, 2010, 07:26:18 pm
[quote author="Sjaak"]
4.25 is a good reading. It should be the Vpp/3.

That jumper only selects the Vcc for the pic target (and the Vpu)
[/quote]

Hmm, OK, good to know. I missed that point I guess. :) Consequences of a long day (past 3 am here)

I couldn't check out the source files with Tortoise as my proxy doesn't allow it. So I used the compiled version. Maybe something in there?

If I can pass this point, I am planning to run some tests with the 4550 I have.
Title: Re: New PIC programmer adapter
Post by: ian on December 19, 2010, 10:26:26 am
I,m not sure about the connection errors. My guess is the particular version of the app you're using doesn't,t match the current pic protocol. It should at least go I to binary mode though. You can capture the port activity with portmon and post the log here for further investigation.


At the moment the piratepicprog app only supports read And erase of the 18f2550. Youll need to add the 4550 signiture to the program and recompile. It's not to difficult, code blocks has a windows installer with everything you need. I can post the latest sour if you need it.
Title: Re: New PIC programmer adapter
Post by: tayken on December 19, 2010, 07:41:59 pm
If it is fine, I can try to connect to BP or some other board for testing out the program. I have a Pickit2 at hand, so if I ruin something, there is no problem. I just tried the HW test program to see if I soldered the jumpers correctly for my v2go.

I'm planning to add support for 4550 once I familiarize myself with the program. I can do the tests on my Linux machine, I carry it with me all the time, plus the proxy at my university allows svn, downloaded some files before. So no problem with that. We will have Linux support, right?
Title: Re: New PIC programmer adapter
Post by: ian on December 19, 2010, 07:55:42 pm
Robots wrote the framework for the piratepicprog, I think it will compile unde Linux and Mac because that. Was one of the original design goals.
Title: Re: New PIC programmer adapter
Post by: tayken on December 19, 2010, 08:12:26 pm
Cool! I'll probably do some work on Thursday. Will tell the results on the same day.
Title: Re: New PIC programmer adapter
Post by: ian on December 20, 2010, 10:05:59 am
Let me know if you need help, I'll probably have some time to debug too if things aren't working. The protocol/app are a work in progress, I'm not quite sure of the current state :)
Title: Re: New PIC programmer adapter
Post by: tayken on December 20, 2010, 01:30:55 pm
Thanks Ian! My guess is after adding 4550 support, we will be able to read and erase it just like 2550. After I confirm that, I'll work on writing to the IC.
Title: Re: New PIC programmer adapter
Post by: ian on December 20, 2010, 04:27:32 pm
Here's a hint: The write algo should work without any problems. I think the issue is the parsing of the .hex and placement of the configuration words (at a very high address in the 18F) is going to take some work in the app. Right now the app sees the empty space in the HEX between the program and the config words and tried to allocate that and crashes (problem1), the app needs to know that there is nothing between program memory and config words and disregard that space (problem 2).