Welcome! Log In Create A New Profile

Advanced

PIC Programmer for Linux

Posted by rmadams 
PIC Programmer for Linux
September 04, 2007 10:28PM
Has anyone had any success with a particular PIC programmer and software under linux? I have seen that folks use the PIC-PG3, but I have not been able to locate any software for running it under Linux. Any suggestions would be welcome!
Anonymous User
Re: PIC Programmer for Linux
September 07, 2007 09:31PM
[www.ic-prog.com] ICProg

[www.winpicprog.co.uk] Winpicprog

If you are only wanting to program a few PICs, I'd say have someone else do it for you, or get one of the above programs (IC Prog really, the other only handles a PIC or two it didn't) and a simple Tait style programmer running in Linux under an emulator.

[www.etc.ugal.ro]

If you're really wanting to do Linux PIC development, I'd write a Linux based uploader for this if you can't find something else already. The PIC part is only 100 words, so not that much to follow, just write a simple basic or other language you know uploader that reads a PIC file and sends what the bootloader wants. I have a more heavily commented version of the PIC file I can give to you, I traced through it once to fix a bug that stopped it from working with a larger PIC, with the extra comments it won't take long to figure it out. It uses the serial port, but if that's needed for your program it'd also be easy to put in a small 2 pin serial routine, to use other pins.. Get it running on a Windows box first, so you see what it does.

Tiny PIC Bootloader is extremely effective. It's small, quick, in circuit without the extra crap of ICSP, etc. So good I stopped using anything else except to get TPB into a new chip, or when sending something out, to set the code fuses or similar. Until I built an ICD2 that was my main tool.

If you do much at all, hunt Ebay and Craigslist for about a year or two old Windows box, search on your area and get one that's local so there's no shipping. Single core has gone through the floor, should be able to get something at $50-100 for everything but monitor/mouse etc, maybe even with. Then build an ICD2, I will post my picture breadboarding guide, it cuts the time to build drastically. I don't really use the step function that often, but having breakpoints so you can check your variables after a routine really speeds development if you're doing much.

I've thought about seriously upgrading TPB with a few things that would be handy. A routine to kick out variable data, and then rewrite a goto at a routine's exit and hit that routine, and you could fake a breakpoint. Also needs a block of code in a larger PIC, with the bootloaders for most PICs and a way to select which and program it. That would let you get TPB into another PIC without ever going back to a regular programmer.

You know, my eventual intent was simply write a bootloader somewhat inspired by TPB since it follows most of my own general design philosophies and clean it up a lot and make those additions. Moved so haven't worked on that, and a few other things ahead of it for now, but is time to start looking at it again. In some ways TPB is even easier to actually use than the ICD2, with the simulated breakpoint and variable readout it'd be a strong contender to move back to.

[www.google.com]
Actually duh though searched, plenty of programs out there. Most any will probably work fine with a simple Tait style programmer. But again, if you do any development at all, the little bit to make a Linux front end for using TPB would be well worth it if you really want to use it under Linux.

Heck though typing this has got me back to wanting to do my own TPB and make it work the way I want. All I'd need is someone on the Linux side to translate the Liberty Basic program over, they might even have a Linux version. Not likely a weeks worth of work to get it running either, I want to simplify the protocol a bit so it'll be even easier to do and more standardized.

Later,
Alan
Re: PIC Programmer for Linux
September 08, 2007 04:25PM
Wow! Thanks! Great suggestions! I took a look at your links, and they look great for the people using Windows. My goal, though, is to come up with a way to program the PICs completely under Linux. I have had mixed success with programmer software under emulators, and I would like others to be able to do the same without undue fiddling.

Ultimately, a complete Linux toolchain would allow development and implementation on a platform that should stay pretty stable over time, especially if the source code for all the underlying software is itself open source. It would be great if someone picking up the system many years in the future would be able (with very little work) to get everything running on whatever hardware they have without depending on a "porting" effort, or having to locate antique or closed software tools.
Anonymous User
Re: PIC Programmer for Linux
September 08, 2007 06:42PM
I've tried to follow wiki guides, has someone got any success with PikLab + Olimex PG3B?

I've got currently all running, but when trying to connect the programmer board to Piklab, I've got a "Device not found (0x3FFF)" error...

I'll continue to dig as it's the only part missing to connect all electronic and just-received extruder kit smiling smiley
Anonymous User
Re: PIC Programmer for Linux
September 08, 2007 11:55PM
Ah well looking up IDE then is more what you want, not just a programmer. Really it's probably the fastest way to find a decent programmer, something someone's using with an IDE.

[www.google.com]

[piklab.sourceforge.net]

The above is already running the Tiny PIC Bootloader and ICD2 even. Still would need a Windows box with parallel port programmer to get the original code into an ICD2, or have someone send you chips, but once you have an ICD2 you can program most anything. Well, could be different since they may not support everything yet. Do not buy an ICD2 unless you really want it fast, I'll get my ICD2 building guide back up shortly, it's easy to build.

[ktechlab.org]

Has some simulation items in it.

Likely a few others in the first few pages of the search..


Alan
Re: PIC Programmer for Linux
September 25, 2007 03:20PM
I wanted to follow up on some of the things already mentioned here with the following:

For a decent little programmer that's "easily available" at most electronic-hobby-stores (definately here in the EU where Velleman is a wellknown brand and ubiquitous brand, much like Heathkit is/was in the US) try and get your hands on the K8076 from Velleman:

[www.velleman.be]
for example, or
[www.apogeekits.com]

The programmer is pretty much that; a programmer, not a debugger , emulator or 'prototyping board'. It's got a nice fancy 40pin ZIF socket that you hook up an ICSP-style set of signals to the appropriate pins of the ZIF-socket (use datasheet or check this general guide: [www.desert.cx] ) It's driven via Serial, but mind you, very few USB->serial dongles will work with it (typical problem)

The K8076 comes with some windows-software that'll work fine AND tell you which wires to jumper for your particular device. But, if you're like all the cool kids, you'll probably want to use something like this:

[dev.kewl.org]

This software works with the K8076 and the K8048, which is an older (and slightly more expensive) design which also includes a bit of prototype/experimentation-stuff on it; the benefit with the K8048 and this software is that it allows you to verify easily if programming works (it comes with some demo-files that it'll flash into the PIC and then make it blink a led to show things worked)

So far, i's been working like a charm; no problems whatsoever.

On the application-development side, there's the GPUTILS set of tools, a set of 'must have' and essential tools to do PIC development in assembler.

[gputils.sourceforge.net]

At least Debian and Ubuntu have it available within the distribution; it's required for compilng the above-mentioned k8076 software (see instructions on website).

'gpasm' is the primary tool you're wanting to play with; it's the assembler (duh).

On the gputils-site you'll find a few links to 'IDE'-based things like Pikdev, and some pic-emulators to test code with. Rickard Gunee ( [www.rickard.gunee.com] ) also lists a nice set of Linux-based PIC-development tools. (see stuff at the end)

Ofcourse, there's 'PonyProg' too, which is also available for Windows; it'll work with a large number of 'next-to-zero-parts' programmers; but for what it's worth: i've messed with those types of designs a few times and it's pretty "tricky" to get those to work at times; especially when you're beginning with PIC's, it's highly unlikely that you'll be able to debug it when it won't work at the first try. Either your software-settings (programmer type, signal-levels , pins on the port, etc) are wrong or wether your pic is dead (happened once) or your solderjoints just suck.. etc. Getting a 'nice and complete' (but cheap) programmer that is proven to work really makes your life a lot less complicated in the long run. Just don't spend too much on them; most more expensive programmers for 'starting' offer stuff you'll rarely use (onboard prototype/demo-objects), or simply won't be available on your platform (undocumented interface to in circuit emulation/debugging, etc)

just my two cents
Re: PIC Programmer for Linux
September 25, 2007 04:11PM
Wow! Thanks, Justa! Your advice is great- I have ordered a PIC-PG3 programmer from MicroControllerShop, which seems to be exactly what you described - minimal, David Tait type design, very simple. Also along the lines of your suggestion, I bought a ZIF socket along with it. Once I get it, I will try out the toolchain and downloading tools you suggested.
Re: PIC Programmer for Linux
September 25, 2007 04:22PM
i use the PIC-PG3 and it works great, although i've only used it with windows and ICprog. i havent bothered messing with it and linux though.

although now i'm in love with the arduino and its toolchain. single click compile/programming/firmware uploading, code directly to board is so much nicer than the dinosaur setup we are currently using.

i really cant wait for v2.0 of our boards. getting the electronics dead simple is going to remove a big stumbling block (and boy are there alot of stumbling blocks, heh.)
Re: PIC Programmer for Linux
April 29, 2009 03:48PM
Hi, Did you tried your PG3 on a linux machine? Regards


rmadams Wrote:
-------------------------------------------------------
> Wow! Thanks, Justa! Your advice is great- I have
> ordered a PIC-PG3 programmer from
> MicroControllerShop, which seems to be exactly
> what you described - minimal, David Tait type
> design, very simple. Also along the lines of your
> suggestion, I bought a ZIF socket along with it.
> Once I get it, I will try out the toolchain and
> downloading tools you suggested.
Re: PIC Programmer for Linux
April 29, 2009 10:28PM
PeterUK-

I did order/build/try the PG3 on linux, and after several (many) frustrating days trying to make it work on a range of linux platforms, finally gave up and took it over to a friends house and used an XP box, which worked first time out. This demonstrated three important things: (1) the PG3 worked great, (2) the RepRap firmware package was fine and (3) I will have to endure my friend's taunting for ever more... :-)

I would still be totally grateful if someone could help me make this work sometime, but as of now, at least I got my PICs programmed...
Re: PIC Programmer for Linux
May 06, 2009 09:10AM
Way back when I first started using PICs, I wrote my own programmers. they didn't have very many devices at first (16F84), and then they started expanding their offerings rapidly. At first, I did a program for each chip, and compiled it to an .EXE, but then I gave up, and bought a PICSTART+.

Here's one of the old programs I used, as a guide for you. If you want, PM me, and I can send you some EXEs, which might work under wine ?

QBASIC:

DECLARE SUB pwrcalc ()

DECLARE SUB HexSort (H$)

DECLARE SUB ProgPgmMem (wyrd&)

DECLARE SUB ResetPic ()

DECLARE SUB Vrfy (wyrd&)

DECLARE SUB Send (wyrd&)

DECLARE SUB ProgConfig ()

DECLARE SUB dally (delp!)

DECLARE SUB main ()

DECLARE SUB Cmnd (tdta&)

DEFINT A-Z

DIM SHARED LptxNo AS LONG

DIM SHARED powerof(0 TO 15) AS LONG

LptxNo = &H278

ON KEY(1) GOSUB CHIPSAFE

KEY(1) ON

pwrcalc

SCREEN 12: WIDTH 80, 60

FILES "c:\pic\*.hex": COLOR 3

INPUT "please type in first part only of required hex file to dump>"; HNDL$

OPEN "i", #1, "c:\pic\" + HNDL$ + ".hex"

ResetPic

OUT LptxNo, 36: ResetPic: coa = 6: cob = 9

q! = TIMER

WHILE NOT EOF(1): INPUT #1, H$:

SWAP coa, cob: COLOR coa: PRINT H$:

HexSort (H$): WEND: CLOSE #1



COLOR 2: ProgConfig

PRINT "time taken="; TIMER - q!: SLEEP 5: BEEP: SYSTEM

88 DATA 1,7,8,1,7



CHIPSAFE:

OUT LptxNo, 36: END



DEFSNG A-Z

SUB Cmnd (tdta&)

TDTASTRD = tdta&

OUT LptxNo, 8

FOR BIT% = 1 TO 6

OUT LptxNo, 10

OUT LptxNo, (tdta& AND 1) + 10

OUT LptxNo, (tdta& AND 1) + 8

OUT LptxNo, 8

tdta& = tdta& \ 2: NEXT: ' IF TDTASTRD = 8 THEN dally .01

END SUB



SUB dally (delp)

t! = TIMER: WHILE (TIMER - t!) < delp: WEND

END SUB



DEFINT A-Z

SUB HexSort (H$)

SHARED wyrd&

BB = VAL("&H" + MID$(H$, 2, 2))

AAAA = VAL("&H" + MID$(H$, 4, 4))

TT = VAL("&H" + MID$(H$, 8, 2))

FOR n = 2 TO BB * 2 STEP 4

LB$ = MID$(H$, 8 + n, 2)

HB$ = MID$(H$, 10 + n, 2): wyrd& = VAL("&h" + HB$) * 256 + VAL("&h" + LB$)

ProgPgmMem wyrd&

NEXT n

END SUB



DEFSNG A-Z

SUB ProgConfig

Cmnd 0: Send &H3FFF

FOR x = 1 TO 4: Cmnd 2: wyrd& = &H3FFF - x: Send wyrd&

Cmnd 8: Cmnd 14: Cmnd 4

Vrfy wyrd&: Cmnd 6

NEXT x

FOR x = 5 TO 7: Cmnd 6: NEXT

PRINT "PLEASE TYPE HEX No. for config fuses"

INPUT conf$: wyrd& = VAL("&h" + conf$+)



Cmnd 2: Send wyrd&

Cmnd 8: Cmnd 14: Cmnd 4: Vrfy wyrd&: OUT LptxNo, 36

PRINT "end of program.": BEEP: BEEP

PRINT "CONFIG ECHO=(" + HEX$(RdTa&) + ")"

END SUB



SUB ProgPgmMem (wyrd&)

Cmnd 2 ' load data

Send wyrd&

Cmnd 8 ' begin programming

Cmnd 14 ' end programming ************** pic16c6x/7x (not 16c84)

Cmnd 4 ' read data

Vrfy wyrd&

Cmnd 6 ' inc address

END SUB



SUB pwrcalc

FOR a% = 0 TO 15: powerof(a%) = 2 ^ a%: NEXT

END SUB



SUB ResetPic

OUT LptxNo, 52

dally .01

OUT LptxNo, 8

dally .2

END SUB



SUB Send (wyrd&)

tdta& = wyrd& * 2

OUT LptxNo, 8

FOR BIT% = 1 TO 16

OUT LptxNo, 10

OUT LptxNo, (tdta& AND 1) + 10

OUT LptxNo, (tdta& AND 1) + 8

OUT LptxNo, 8

tdta& = tdta& \ 2: NEXT

END SUB



SUB Vrfy (wyrd&)

RdTa& = 0

FOR z% = 0 TO 15

OUT LptxNo, 12: OUT LptxNo, 14: FOR n = 1 TO 1: NEXT'wait for pic to respond

IF (INP(&H279) AND 64) = 64 THEN RdTa& = RdTa& + powerof(z%)

OUT LptxNo, 12: NEXT

RdTa& = (RdTa& AND &H7FFE) \ 2

IF RdTa& <> wyrd& THEN PRINT "verify error"; HEX$(RdTa&); "'"; HEX$(wyrd&): BEEP

END SUB
Re: PIC Programmer for Linux
May 06, 2009 12:25PM
Wow! That is great thanks! I think I will try to translate that into C and give it a shot on my linux box. Do you know if there is a workable BASIC interpreter on that platform, especially one that can run QBASIC programs?
emt
Re: PIC Programmer for Linux
May 07, 2009 03:52AM
Hi

BCX [bcx-basic.sourceforge.net]

Does a reasonable job of translating Basic to C.


Regards

Ian
Re: PIC Programmer for Linux
May 07, 2009 07:43AM
Thanks, Ian- I will give it a shot. It would be nice to start with something, even if I need to hack with it a bit to make it work. Next stop, working PIC-PG3 under linux!
Sorry, only registered users may post in this forum.

Click here to login