Pic 16f877a

Thread Starter

Kanniyappan

Joined Oct 1, 2010
8
Hi i am having problem in programming my PIC16F877A
here is the error message...
I copied the data from my device and saved it as hex file that file burned successfully hence there is no problm in m yprogrammer hope so the message is ....
"Checking connection of JDM Programmer ...
Error opening LPT driver!
JDM Programmer connected and initialized!
Autodetecting PIC ...
No PIC detected!
JDM Programmer connected and initialized!
Calibrating delay: 50us delay took 81us (loop counter=1362)
PIC unknown! Programming may fail!!
Configuration bits found in HEX file (config memory length = 16 bytes)!
JDM Programmer connected and initialized!
Calibrating delay: 50us delay took 81us (loop counter=1362)
PIC unknown! Programming may fail!!
Configuration bits found in HEX file (config memory length = 16 bytes)!
Erasing Device ...
Erasing finished!
Programming started ...
Programming finished successfully!
Operation took 38.0 seconds!
"

But whn I use anyother hex file....it says there is error in verify
"Configuration bits found in HEX file (config memory length = 16 bytes)!
Verifing started ...
Verify Error: Code Mem 0x000000: PIC=0x3FFF Buf=0x2804
Verify Error: Code Mem 0x000008: PIC=0x3FFF Buf=0x1303
Verify Error: Code Mem 0x00000A: PIC=0x3FFF Buf=0x1683
Verify Error: Code Mem 0x00000C: PIC=0x3FFF Buf=0x0186
Verify Error: Code Mem 0x00000E: PIC=0x3FFF Buf=0x30FF
Verify Error: Code Mem 0x000010: PIC=0x3FFF Buf=0x1283
Verify Error: Code Mem 0x000012: PIC=0x3FFF Buf=0x0086
Verify Error: Code Mem 0x000014: PIC=0x3FFF Buf=0x3006
Verify Error: Code Mem 0x000016: PIC=0x3FFF Buf=0x00FC
Verify Error: Code Mem 0x000018: PIC=0x3FFF Buf=0x30FF
Verify Error: Too much errors in Code Mem, giving up!
Verify Error: Data Mem 0x000000: PIC=0x00FF Buf=0x00C0
Verify Error: Data Mem 0x000001: PIC=0x00FF Buf=0x00A8
Verify Error: Data Mem 0x000002: PIC=0x00FF Buf=0x0000
Verify Error: Data Mem 0x000003: PIC=0x00FF Buf=0x0064
Verify Error: Data Mem 0x000004: PIC=0x00FF Buf=0x0000
Verify Error: Data Mem 0x000005: PIC=0x00FF Buf=0x0000
Verify Error: Data Mem 0x000006: PIC=0x00FF Buf=0x0000
Verify Error: Data Mem 0x000007: PIC=0x00FF Buf=0x0000
Verify Error: Data Mem 0x000008: PIC=0x00FF Buf=0x0000
Verify Error: Data Mem 0x000009: PIC=0x00FF Buf=0x0000
Verify Error: Too much errors in Data Mem, giving up!
Verify Error: Cfg Mem 0x00000E: PIC=0x3FFF Buf=0x3F7A
Operation took 5.0 seconds!"
what can i do now...
can anyone help me...

here i attached both of my hex files...
16f877a.hex the hex file read from device
led.hex my hex file for blinking led...
 

Attachments

t06afre

Joined May 11, 2009
5,936
Are you sure your PIC is supported by your programing software? Have you tested your JDM programmer on other PICs.
 

Thread Starter

Kanniyappan

Joined Oct 1, 2010
8
no I didn't...I am newbie to microcontrollers and i have posted the message shown by the programmer... LED in my programmer blinks well nice...
 

BillO

Joined Nov 24, 2008
992
A JDM programmer is normally a serial device. Why is your software trying to open the printer port? Do you have the correct port defined for your programmer?

One more thing, what software are you using?
 

Art

Joined Sep 10, 2007
805
Nowadays most serial ports don't comply with RS232 and don't supply enough voltage for programming mode. If you can't afgord a pickit programmer, I would try getting hold of an old PC with proper serial port.
 

MagicMatt

Joined Sep 30, 2013
117
Your hex files burnt to a PIC16F877A happily using a PICKit2 on my computer, so your hex file should be fine.

That means the problem is either your programmer, your PIC chip, or your driver/computer hardware.

Serial ports usually use COM drivers, not LPT drivers... so that's a strange message. Are you using something that gives you a serial port via your parallel port? If so, don't, because they generally don't work. In fact, I've only ever see them work with things like serial plotters/cutters that are designed to be able to connect this way.

If you are using a USB to Serial Port cable, this also probably wont work - the specification is different enough that some hardware that requires specific voltages wont work.

Most laptop serial ports also don't provide enough voltage on their own (they work with devices that have their own power supplies, but often not with devices that draw power from the serial port, regardless of the device). You might be able to modify the programmer to leech some extra voltage from a spare USB port, but you would do better to use a computer that has a full-strength serial port.
 

Zahir_s

Joined Dec 23, 2014
32
I have a proper desktop with a db-9 COM1, connected to the schematic using a male-female cable but there is one thing though, I'm prototyping the JDM on a breadboard using the attached scheme. I have connected the circuit and lead out the required wires to the MCU(16f877a) directly (w/o using a ZIF). on the PC I use the latest version of PICPgm software.

Now so far I have been able to make the PICPgm autodetect the JDM.

But when I try to detect the MCU it fails, says 'No PIC Detected' ,
then when I don't use autodetect, and select the PIC ie 16f877a , it shows '**PIC Unkown**'
then when I try to program it anyway it comes out with Verify Errors in the Code Memory and the Log is filled with this:

-LOG(PICPgm)-
JDM Programmer connected and initialized!
CalibrateDelay_us: 100000000 loops took 125ms
CalibrateDelay_us: loop counter for 1us = 1040
Testing delay: 100us delay took 142us (loop counter = 1040)
PIC unknown! Programming may fail!!
Configuration bits found in HEX file (config memory length = 16 bytes)!
Erasing Device ...
Erasing finished!
Programming started ...
Verify Error: Code Mem 0x000000: PIC=0x3FFF Buf=0x2820
Verify Error: Code Mem 0x000002: PIC=0x3FFF Buf=0x3400
Verify Error: Code Mem 0x000004: PIC=0x3FFF Buf=0x3400
Verify Error: Code Mem 0x000040: PIC=0x3FFF Buf=0x1683
Verify Error: Code Mem 0x000042: PIC=0x3FFF Buf=0x1303
Verify Error: Code Mem 0x000044: PIC=0x3FFF Buf=0x0188
Verify Error: Code Mem 0x000046: PIC=0x3FFF Buf=0x1283
Verify Error: Code Mem 0x000048: PIC=0x3FFF Buf=0x0188
Verify Error: Code Mem 0x00004A: PIC=0x3FFF Buf=0x30FF
Verify Error: Code Mem 0x00004C: PIC=0x3FFF Buf=0x0088
Verify Error: Too much errors in Code Mem, giving up!
Programming finished with verify errors!
Operation took 30.0 seconds!
--
Now I'm inquisitive as to why is a 100us delay taking 27 to 42 us longer and what part of the circuit is it related to?
I'm pretty sure if the delay calibration comes out right everything else will fall into place.

Any other ideas? everyone is welcome
and thank you for listening me out
 

Attachments

JohnInTX

Joined Jun 26, 2012
3,771
If the adapter is something you are wiring up be sure that your male-female DB9 hookups haven't introduced a null-modem (or maybe it needs one and you don't have one). Is pin 5 really Vdd? Its normally GND. That would mean some fancy use of the RS232 levels on the other pins (which is possible) or its backwards. I'm guessing its OK based on the other pins but check it out. When idle, measure the voltage on the PIC pins (Vdd/Vss, logic levels on PGC,PGD etc.

Your first error PIC unknown! Programming may fail!! indicates that its not communicating with the PIC or that the PIC is not properly powered - that's why auto-detect fails, too.

I don't know where the reported discrepancy in the 100us timer comes from but it sounds like it may be related to attempts to calibrate and do software delays by counting on a PC - problematic at best. Make sure no other programs are running then go to ControlPanel-Power Settings and set it to full power-full speed all the time (no backing off on CPU freq when there's nothing to do) to keep the system speed constant.

Good luck!
 

MagicMatt

Joined Sep 30, 2013
117
At the risk of over-simplifying, that sounds more like the serial cable itself is faulty. Any chance you can put the thing direct on the port and eliminate that possibility?
 

Zahir_s

Joined Dec 23, 2014
32
@MagicMatt No, can't do that, I'm using a breadboard, but I think the cable is fine the issue is with something else.
I'm getting a 4.9V reading between the Vdd and Vss pins of the PIC, is that appropriate or is there a voltage drop that we don't need down the line?
Better still, I'll give you guys a list of voltage levels I'm getting at the PIC pins.
All measured with reference to the Vss pin's voltage, which is grounded
Vpp - 16.54
Vdd - 4.97
PGC(Clock) - 3.35
PGD(Data) - 5.61
 

JohnInTX

Joined Jun 26, 2012
3,771
All measured with reference to the Vss pin's voltage, which is grounded
Vpp - 16.54
Vdd - 4.97
PGC(Clock) - 3.35
PGD(Data) - 5.61
According to the 16F877A Programming Spec Vpp should be 13.5V max. Yours is high. Also, the program mode is entered by raising MCLR to VPP while holding PGC/PGD at logic lows and a low is the quiescent state - at least for PGC. Yours are both at logic high levels. You should also check that no input exceeds Vdd when MCLR is not at Vpp.

I would carefully check the circuit to get things back into spec. The PIC may be blown due to the excessive Vpp but maybe not - they are pretty tough. Get the levels right and see what it does.

Good Luck.
 

Zahir_s

Joined Dec 23, 2014
32
I have managed to get Vpp down to 13.6 is is alright or should I get it somewhere between 13.0 to 13.5? The Vdd, PGC and PGD levels are spot on according to specs.
 

Zahir_s

Joined Dec 23, 2014
32
Hi guys.
I've got the Vpp voltage down to the specs, now the led for PGC won't glow at all during operation, when testing it glows correct but during PIC detection, it doesn't.
 

MagicMatt

Joined Sep 30, 2013
117
If the spec says 13V +/- 0.5V, then you should stick to what the spec says, and be providing 13V within that tolerance. The spec is generally there for a reason- things don't work if you go outside them, or worse, things get damaged.

Bearing in mind you were putting 16.54V into a chip designed to take 13V, which is well outside the spec, I wouldn't like to say whether or not that chip is still ok or has been damaged. Personally I think you've probably fried it.
 

ErnieM

Joined Apr 24, 2011
7,991
...I wouldn't like to say whether or not that chip is still ok or has been damaged. Personally I think you've probably fried it.
I wouldn't be so fast to toss the PIC out. AFAIK the Vpp voltage is not actually used to drive anything as it was back in the days of EEPROM, instead it just flips a comparator output to enable the function.

It's worth a shot to retest the PIC.

The programmer is shot. If you have the funds do get a PICkit 3 from Microchip. Clones are just not worth the hassle.
 

Zahir_s

Joined Dec 23, 2014
32
Well I could just buy a programmer off the market but a friend of mine did this as a 3rd year project and I was hoping to replicate it.
Anyway I'm sure I'm not following the schematic properly enough. So I don't mind the hassle cause I want to do this.
Thanks for your inputs good people. And a Happy New Year!! (late, I know)
 

MagicMatt

Joined Sep 30, 2013
117
There are some things worth making, and some that are too much hassle. I didn't make my own programmer for the same reason I didn't make my own multimeter - I needed to know they worked properly from the start. Sure, I may make both myself for interest at some point, but they are tools, so well worth the spend.
 

Zahir_s

Joined Dec 23, 2014
32
@everyone
I got it working with no verify errors, I was absolutely foolish when I over looked the role played by the current limiting resistors attached to the LEDs, turns out un-limited LEDs were draining all the current to the ground and thus messing with the proper voltage levels in the circuit.

Thank you guys for your ears, advice and support.
 
Top