Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

unable to program 18f452; pic-pg2c

Status
Not open for further replies.

glmclell

New Member
I just received my order from sparkfun yesterday, and already I think I broke it or don't have something hooked up right.

pic is a 18F452 (40 pins)

programmer is PIC-PG2C (olimex)

software is ic-prog 1.05C

hex file is blinkin.hex from sparkfun

programming tried on two computers. also tried two different serial cables.

home brewed athlon xp 3200, windows xp (yep, have the icprog.sys configured)

ancient toshiba "transportable computer", 486/dx2 66mHz, windows 98

under windowsxp icprog would throw a gear unless I selected windows api on the hardware config screen.

i tried both direct io and windows api under windows 98

i've tried every IO Delay between 1 and 10

I've tried with and without the "enable Vcc Control for JDM" option

I have 2x 452's, cannot program either.

i've observed careful ESD precautions, and its very humid here today, so I dont think anything got a zap

if I "write" without loading a hex file (everything is FF's), I dont get an error.

if I read, no error, but everything comes back as FF even after a (failed) hex programming (even if there was an error, shouldn't there be some data?)

I can use the erase command without an error.

every time I try to program the example hex file, the non-descript error "Verify failed at address 0000h!" comes up at the end.

I'm going to find another premade hex file and try it, but I'm sure the results will be the same

Any Thoughts?!
 
I was lookin at the schematic for my pg2c and noticed it's expecting the pic's PGM line on pin 36... but for whatever reason, the 18F452's pgm pin is 38!!

I've tried jumpering pin 36 to 38, but programming still fails

I wonder if I've damaged the chips with this improper hookup?

ugh

the support site for the programmer is down :(
 
First of all, you connect your programmer to COM port.

I take here the pinouts of 40 pin chip as an example *(16f877)

Measure the voltage between VSS and VDD. It should be 5V (pin 11 and 12).

You open your ICPROG and press PROGRAM without the PICs in PG2C

Measure the voltage between VSS and MCLR (pin 12 and 1). It should be 13V (12.5 - 13.5V). If it's lower than 12V, the PICs cannot come to PROGRAM MODE. And you cannot program for it.

If everything is oki, put your PICs in, and try tro program again.

You should not use PG2C with laptop, because the COM port of laptop would not generate +-13V.

As you press PROGRAM in ICPROG, you will see your LED blink. If not, that is you get low voltages.

If you got problems, email to Nathan (sparky - sparkfun) he will help you.

I don't buy from him but build my own PG2C, and I feel it good.
 
glmclell said:
I was lookin at the schematic for my pg2c and noticed it's expecting the pic's PGM line on pin 36... but for whatever reason, the 18F452's pgm pin is 38!!

I've tried jumpering pin 36 to 38, but programming still fails

I wonder if I've damaged the chips with this improper hookup?

ugh

the support site for the programmer is down :(

I don't use 18F452 so I don't know. But normally, PGM is pull LOW for low voltage programming, and you can omit LVP options in ICPROG, and try with it.

Normally, PGM is also pin RB3, it's at 36 YES.
 
falleafd said:
Measure the voltage between VSS and VDD. It should be 5V (pin 11 and 12).

I see 4.98 to 5.00V on pins 31 and 32 (Vss and Vdd) ... and 11 and 12 - I guess Vss and Vdd are mirrored on both sides of the chip?

Measure the voltage between VSS and MCLR (pin 12 and 1). It should be 13V (12.5 - 13.5V). If it's lower than 12V, the PICs cannot come to PROGRAM MODE. And you cannot program for it.

12.65 to 12.67 volts

If everything is oki, put your PICs in, and try tro program again.

You should not use PG2C with laptop, because the COM port of laptop would not generate +-13V.

As you press PROGRAM in ICPROG, you will see your LED blink. If not, that is you get low voltages.

yes, LED is on bright and blinks when ic-prog switches from writing program to writing data and again when it switches from writing to verifying.

"Verify failed at address 0000h !"
 
I can't really "try" other voltages ... there is no power supply connection.

the only connection is a DB9 serial port, which is plugged into my desktop computer.

one result I found on google was saying I could use a pair of 9v batteries to give MCLR 13-14 volts but they didn't go into detail ... that sounds a bit dangerous, what will the PC think about this external voltage on it's com port?

edit:

ok, I hooked left the multimeter connected between Vss and MCLR during a programming. I only meausred 10 volts!!!

so it looks like my desktop doesn't have a 'strong' serial port on it?

I'm going to try the same procedure on my old toshiba now and see what happens.

edit2:

the old toshiba has about 12.2 on MCLR during programming... still sounds low??

any ideas on how I wire in the 9 volt batteries?
 
do you have a scematic for your programmer? it would help in pointing out how to connect a external power supply...

an alternative is to build a P16PRO40 (scematics on Nigel's site).
works perfect ans uses external psu
 
Exo said:
do you have a scematic for your programmer? it would help in pointing out how to connect a external power supply

here:
https://www.olimex.com/dev/images/pic-pg2c-sch.gif

further reading indicates it's next to impossible to connect the programmer to external psu without damaging the computer, the pic or both

ugh - my project was coming along so nicely, now i'm stuck in mud!

know of a US distributor that sells premade versions of Nigel's programmer?

I haven't read up on his supported pics yet ... seems my choice of the 18F series is really shooting myself in the foot

thanks for the help!
 
You can use Nigel's programmer with ICPROG, and choose PROPIC2 programmer in hardware. It's the same. Nigel didn't continue his workart on WinPICPro, but ICPROG is quite good with Nigel's.


Don't worry, 12.7V is oki. I'm sure.

Test your PIC again, perhaps it's burned :))

Well, don't worry, I suggest you to use Win98 to test again.

Uninstall ICPROG, and reinstall it.

Choose HARDWARE >> JDM >> DirectIO >> No delay

Test the voltages first

Redo with your PICs.

Are you using C or ASM? Take care of compiling into 16bit HEX, choose 8bit HEX and try again.

If it does not work, try with another PICs :). I don't know :))
 
When I was using a 18F458, I had some of the same problems. I was using a LPT programmer.

I was thinking of building this programer to, but I heard of these types of problems.

I found the best way was to use a program called PP18http://perso.wanadoo.fr/softelec/Projects/PIC18/PP18/Projects_PIC18_PP18_us.htm The Schaer type programer is the same as the P16pro.

Also, I found that most cases that HVP works better. I'm able to use the 12v from my computer for VPP.

Go through all the pins in hardware test and make sure they all have 5v and 12v for Vpp. And make sure that they jump to the voltage, and not step up
(0v-8v-12v, etc) Personaly I use the 7407.

I have also found that a 33pf cap on the data line to the pic makes it more stable.

If you have anymore questions, please let us know

Kent
 
IT'S ALIVE! !

after a close examination of the board, I found a damaged transistor, which is right next to the sockets ... I probably busted it inserting/extracting the ic

replaced it with a new one and went to program... still didn't work

so I found somewhere a person recommended telling windows xp to use "compatibility mode" for ic-prog ... so I set that to emulate windows 2000 ... it programmed now, but still came back with a verify error, this time, at an address other than 00000! so at least the chip had received some data!

after this, I started increasing the IO delay ... at a delay of 15, it programs every time now, as long as I use the socket.

now I just need to figure out why ICSP isn't working to my Olimex PIC-P40C development board ... I think the problem might be the onboard power supply is sinking too much current? (no, I dont have the boards power plugged in)

When I have the pic on a bare breadboard, I'm able to program just fine

Connections from programmer to breadboard:

ICSP Vpp to PIC pin 1 MCLR
ICSP Vdd to PIC pin 32,11 Vdd
ICSP Vss to PIC pin 31,12 Vss
ICSP RB7 to PIC pin 40 PGD (rb7)
ICSP RB6 to PIC pin 39 PGC (rb6)

These connections seem to be mirrored on the olimex board, with the exception that PIC pin 36 (rb3, ccp2) is tied to Vss ... any ideas why that is, would it be affecting programming? additionally, olimex board has the oscilator circuit hard wired to the pic socket, so its always on ... maybe that's confusing the pic?
 
glmclell said:
These connections seem to be mirrored on the olimex board, with the exception that PIC pin 36 (rb3, ccp2) is tied to Vss ... any ideas why that is, would it be affecting programming? additionally, olimex board has the oscilator circuit hard wired to the pic socket, so its always on ... maybe that's confusing the pic?

If the oscillators running you can't program a PIC, you need to switch it to programming mode BEFORE ther oscillator can start up - when doing ICSP this can often be difficult, usually both your circuit and programmer need to be specially designed for the purpose.
 
I don't use olimex pcb, so I don't know, I build my own programmer. I now have 1 Nigel's programmer, pg-2c programmer and MCP_USB programmer. :) Of course, I also use Tiny bootloader, it's funny, it's really tiny from hardware to software.

my pg-2c programmer can be seen at:

https://www.electro-tech-online.com/threads/tachometer-driver.9811/

see on the 2nd page for the pcb and orcad source files.

Oh Nigel, I made your programmer work, sorry that didn't tell you about this. :) I used the pcb on nigel's tutorial. However, I intend to build 2 layer one, because I think it should be smaller.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top