PDA

View Full Version : 16F819 ICSP programming



Ioannis
- 27th October 2004, 21:21
Hi people.

I had a design with ICSP that used 16f628 and all work good.

After uograding to F819 I am facing a strange problem. The new chip cannot be programmed with ICSP. I contacted my programmer manufacturer but could not find any solution. They suggested to connect PGM pin even if it is not used. Microchip does not mention any differencies in ICSP between the two chips.

Any ideas welcome.

Ioannis

Dwayne
- 27th October 2004, 22:13
Hello Ioannis,

I>>After uograding to F819 I am facing a strange problem. The new chip cannot be programmed with ICSP. I contacted my programmer manufacturer but could not find any solution. They suggested to connect PGM pin even if it is not used. Microchip does not mention any differencies in ICSP between the two chips.

Any ideas welcome.<<


Chances are, what is happening, is the 819 has programmable clock speeds.. the default clock speed is (I think) 32K.... And your chip is running just perfect.... Only it is running so slow, you are not giving it enough time to let it do its job. <chuckle> Look under the FAQ, there is a thread on this very thing... You will have to set the internat OSC to 4Mhz to be equivalent to your chip that has a internal OSC of 4MHZ.

Have fun!

Dwayne

mister_e
- 27th October 2004, 22:53
Dwayne point this thread

http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=706

i found this on Melabs web site some hints for some MCU
http://www.melabs.com/support/mcu_hints.htm

Since i've never use this PIC, the clock speed might be the cause but see this.
http://www.melabs.com/support/icsp.htm

the problem will happen also with PIC16F877. You have to connect PGM (in your case pin 9) to gnd when programming. There's some interference to low voltage PGM pin when programming in ICSP. When you program this device, is there any error reported by your programmer software???

regards

mister_e
- 28th October 2004, 01:43
Dwayne,

you was right. i just buy a load of these F819 to test your solution and the problem is really caused by OSCCON value unset at the program begining. PBP will assume OSCCON as 0 wich is mean 31.25Khz in datasheet.

Ioannis see datasheet p 40 OSCCON Register settings for proper clock setting.


Few settings:

OSCCON = $70 ;8 MHZ
OSCCON = $60 ;4 Mhz

etc...

Ioannis
- 28th October 2004, 12:42
Many thanks for the answers. But I cannot see the relations between ICSP (which involves RB6, RB7, MCLR\, Vcc and Gnd) and the clock of the OSCON. Though I will try to see what happens. With the F877 I never had any problem with the same configuration. It programs OK.

Ioannis

Dwayne
- 28th October 2004, 14:37
Hello Steve,


Steve>>you was right. i just buy a load of these F819 to test your solution and the problem is really caused by OSCCON value unset at the program begining. PBP will assume OSCCON as 0 wich is mean 31.25Khz in datasheet.<<

I have a couple of these chips....I remembered programming one of them with a working "Blinky" binary count... And I waited...And I waited... And I almost gave up... I turned around, and out of the corner of my eye I saw a "Blink". I then started playing with my program and found the speed to be crawling. Scoped it, and my scope went to sleep waiting <g>

Then I went to the Data sheet and played with the OSC to fix it all up <g>.

Yeah, the chip was running... but I was turning gray waiting for it to do my job. <chuckle>

Dwayne

mister_e
- 28th October 2004, 15:51
Dwayne: but I was turning gray waiting for it to do my job

:) well, it's like trying do anything in Assembly language Thanks to any compilers like PICBasic.


Ioannis :Many thanks for the answers. But I cannot see the relations between ICSP (which involves RB6, RB7, MCLR\, Vcc and Gnd) and the clock of the OSCON. Though I will try to see what happens. With the F877 I never had any problem with the same configuration. It programs OK.

Well in this specific F819 that mean absolutely nothing. Everything is in the program device setting. What i was thinking is the programming method before i test the F819.

In many case, depending of your hardware or circuit design, you'll not be able to program this F877 PIC if PGM pin is not at least loaded with something. I've some pre-made F877 platform with an LCD on PORTB. In this case nothing happen 'cause PGM is on PORTB.3 wich is attach to LCD. This is what i was expecting for F819. But when i remove LCD from proto-board, PICstart,MPLAB return me errors. ALL are caused by interference with floating PGM pin.

Sorry for my bad assumption on this thread. One day i'll be better !!!

Bruce
- 28th October 2004, 16:53
Oscillator settings shouldn't have anything to do with in-circuit programming.

Can you program the 819 in your programmers socket, but it fails when attempting to program in-circuit?

A couple of things to check would be;

Make sure you have solid connections with short wires from your programmers clock, data, Vpp, and ground connections to the 819 being programmed in-circuit. I keep mine under 5 inches.

Power your circuit separately without attempting to supply power from your programmer to the board/circuit being programmed.

Make sure you isolate, I,E, you have no circuit connections to your 819 programming clock & data pins like LED's, sensors, etc, during ic-circuit programming. Loads on PGC & PGD will definitely cause problems during ICSP attempts.

I use a small switch to flip between ICSP & normal run modes on my 819 dev board, and I can program it all day long with the EPIC attached via a "short" 10-pin header/flat-ribbon cable.

If you still have problems, write a simple LED blink routine, and be sure to set LVP "off", drop the 819 into your programmer socket, and burn it.

@ DEVICE LVP_OFF, MCLR_OFF

Make sure the LED blink routine is running as expected first, then see if you can program it in-circuit.

You might want to also check your programmers software after loading your .HEX file before programming the 819 to make sure it's not over-ridding whatever embedded config fuse settings you have. Some programmer software uses the config fuse settings shown on-screen, and may ignore whatever you have embedded in your .hex file.

Also, you might want to check to see if your programmer does an erase before programming.

If I turn off the "Erase Before Programming" option in my EPIC software, then try ICSP on the 819, it fails every single time. I turn this option back on, and presto, works every time.

Dwayne
- 28th October 2004, 19:53
Hello Bruce,

Bruce>>Oscillator settings shouldn't have anything to do with in-circuit programming.<<


Yes Bruce, you are correct. Thanks for pointing this out.


The reason why *I* answered in the OSC response, and the reason why Mister_e responded also, is because the Gentleman already seemed to take precautions of programming problems. Then when I saw he went from a 4 MHZ OSC to a 32k OSC, I remmebered how I *thought* my chip was burnt up <g>. then I realized the 32K OSC was defaulted... thus 128 times slower than a regular 4MHZ chip <g>. That is the equivalent of running Windows XP on a 4 GHZ machine and comparing it to a 32 MHZ machine. Most people would say your machine is "locked" up. <g>.

Bruce
- 28th October 2004, 20:35
Yeah -- that internal osc defaulting to 32kHz can definitely be a gotcha...;o]

Ioannis
- 29th October 2004, 07:25
Bruce thanks for the tips.

I used the same configuration but with F628 chip (in smd case) with no ICSP problems.

Then I swiched to F819 and ... presto! No programming!

There is no other difference in the circuit. Also try it with seperate power. No luck.

The problem is that the chip (F819) is no recognised by the programmer. The Chip ID is read wrong. If I remember 0EEDh was expected and 04EDh was read or something.

Ioannis

Bruce
- 29th October 2004, 07:51
Have you tried programming an 819 in your programmer socket, or does it only fail when attempting ICSP with the 819?

Ioannis
- 29th October 2004, 08:55
Bruce, I have not been able to try programming on the programmer since they are SMD chips.

But have tried to program the PCB on a friend's Microchip ICSP programmer and it did it OK. Others do not. I don't know what more does the Microchip system do but will investigate to it.

Soon will have some DIP to try also.

The strange thing is that with exactly the same hardware config F628 works OK but F819 does not.

Ioannis

Bruce
- 29th October 2004, 15:16
I found the same thing when using a little 18-pin dev board I made. It worked fine with the 16F62x series, but didn't with the 819 until I turned ON "Erase Before Program" with the EPIC.

Other than that, all I can think of is a problem with LVP. You might try grounding LVP on the 819 to see if that helps.

Ioannis
- 29th October 2004, 20:24
The LVP is not directly grounded. I'll try to short it and see what happens.

Thanks again
Ioannis

mister_e
- 31st October 2004, 10:15
As i say couple reply above, for sure LVP pin may cause that(that's what i said F877 prob + link of melabs ICSP tips). Since i don't know wich programmer you using, also check for load on PGC & PGD pin. If there's anything on, remove it and post result.

regards