View previous topic :: View next topic |
Author |
Message |
armondo58
Joined: 15 Jun 2011 Posts: 16
|
Unable to Load Code, Help Please |
Posted: Fri Nov 04, 2011 10:34 am |
|
|
I had a working program, I made some changes to code, it compiled with no errors, but now I get a verification error when I try to download. It may be caused by a write protect fuse being set. I did not intentionally change any fuses. Compiler is 4.124 I am using ICD-U64. I have tried this with 2 programmers and 3 different PCB's. Any Suggestion?
Code: |
#include <16F886.h>
#device *=16
#device ICD=TRUE
#device adc=10
#FUSES NOWRT
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //Code protected from reads
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES BORV21 //Brownout reset at 2.1V
//#FUSES WRT_50% //Lower half of Program Memory is Write Protected
#FUSES NOIESO
#FUSES NOFCMEN
#use delay(int=500000,RESTART_WDT) // was 1 mhz
#use rs232(DEBUGGER, stream=DEBUG)
//#use STANDARD_IO( A )
//#use FIXED_IO( A_outputs=PIN_A5,PIN_A7 )
#use FIXED_IO( B_outputs=PIN_B4,PIN_B2 )
#use FIXED_IO( C_outputs=PIN_C7,PIN_C5,PIN_C3,PIN_C1,PIN_C0 )
|
From list
Configuration Fuses:
Word 1: 00F4 INTRC_IO NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT NOIESO NOFCMEN NOLVP DEBUG
Word 2: 3EFF BORV21
Some fuses have been forced to be compatible with the ICD debugger. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Fri Nov 04, 2011 11:29 am |
|
|
Go back to your last known good working program and try to download it. You do keep sequential backups, right ????
What changes in hardware or upgrades did you change ? You mention 3 different PCBs, are these homemade or commercial products ? Any chance the ICSP cable is defective ?
Power supply not correct ? |
|
|
armondo58
Joined: 15 Jun 2011 Posts: 16
|
|
Posted: Fri Nov 04, 2011 11:43 am |
|
|
Hi Tem,
I have many versions of code, none of them will download (all worked before). The boards are home made, and were working very well. They are in 2 different locations, both were working. When I compiled the latest release, I could not download and neither could my associate. I made changes only to code, not any fuses. We have tried downloading older working versions in both locations and still get verification error. This is very strange indeed. Its as if, the icd is not reading the configuration bits correctly.
Thanks for response. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
armondo58
Joined: 15 Jun 2011 Posts: 16
|
|
Posted: Fri Nov 04, 2011 2:08 pm |
|
|
Is it possible, if by accident, the protect bit was set, would that prevent the chip from being erased and not be programmable any more. Or should a chip erase wipe out that bit also...I wrote a quick program, just to flash a led on the board, and I still can't program the chip. This is on 2 different boards, with 2 different programmers and different ccsload versions. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Fri Nov 04, 2011 2:16 pm |
|
|
Is this comment..When I compiled the latest release... referring to the compiler or the ICD software and why did you 'update' ?
I've found it better to download 'updates' into a new folder(usually named the version, like PCM4124,ICD1234) and NOT install unless there is a specific reason to.If you 'self contain' it into a unique,identifiable folder you can do a 'test run' to be sure it works, if not, go back one version easily.
It sounds like you've trashed a good working 'environment' ( source,compiler,icd,etc.). Try to go back to when things worked. Uninstall whatever to get there.Don't know if you can 'set the clock back' by having Windows go back say 2 weeks to get things back in order.
It is very,very important to have updates in separate folders and at least 2 backups of everything. I've got 'version folders' going back to PCMv2.540 and each has copies of all sources in them.Folder 'BKPPCM2540' is a complete backup of all files ever used using PCM version 2.540. Yes, it can get the harddrive 'cluttered' but it's all there and I can 'set the clock back' whenever and wherever I need to. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 04, 2011 2:21 pm |
|
|
What is the Vdd voltage for the PICs on these boards ?
Do you have the correct board design with 100 nF (0.1 uF) caps all Vdd
pins for the PICs ?
Do you have a pullup resistor on the MCLR pin ?
Quote: | I wrote a quick program, just to flash a led on the board.
|
Post this program. |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Fri Nov 04, 2011 3:22 pm |
|
|
Well The ICD-U64 and CCSLOAD together will allow you to run diagnostics.
The first thing is to establish whether you are powering the target independently or via the ICD-U64. Then prove the ICD-U64 will program any other chip with the telco cable you are using. If not look at the usb setup in device manager ( assuming windows OS)
Then next you need to confirm that the ID for the chip is being read correct. If it isn't it is either you have code for a different chip or the wiring is wrong. Now for the wires the diagnostics will show you the voltage on the target and Vpp Vdd Vss PGC PGD. It's rare wiring that worked fails but nevertheless a cold solder joint can stop conducting. The diagnostic will allow you to toggle the PGC PGD and MCLR to see the swing with a volt meter. Check the oscillator with the diagnostic also. Yes, there is a limit to the length approx 10 in for the RJll telco cable ( just in case you made up a new longer cable). Make sure the telco snap in thingy's are on the same side of the cable. The ICD-U64 is robust and your targets worked before. Maybe it is a power to the target issue or a telco cable issue or a USB PC issue. |
|
|
armondo58
Joined: 15 Jun 2011 Posts: 16
|
|
Posted: Sat Nov 05, 2011 5:41 am |
|
|
I tried to download with 4.124 and 4.119 of compliers. The boards are all functioning correctly. I have downloaded firmware to them 100's of times. On the last download it failed.. I suspect the eeprom protect bit got set and now i cant clear it. I am running the pic at 3 volts. Will increasing to 5 allow bulk erase? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Nov 05, 2011 10:37 am |
|
|
There are several posts in the forum archives about getting Verification Errors while programming with CCS tools (ICD). There are also several
posts about being unable to re-program a PIC, if the protection bits were
set, and the PIC is running at 3.3v. Those threads offer some solutions.
I don't know if these are two separate problems or if they are inter-related.
But, you said you suspect a problem with the Config bits (fuses). Can
you use CCSload to read the PIC ? According to the 16F88x Programming
Guide, you should be able to read the Config bits (fuses) even if the PIC
is Code Protected. If you can read the Config word, do so, and post it.
Then we can look at the PIC data sheet and see what the settings are in
your PIC. |
|
|
armondo58
Joined: 15 Jun 2011 Posts: 16
|
Fixed? |
Posted: Sun Nov 06, 2011 3:39 pm |
|
|
I dont know what happened to fuses, But when I ran from 5 volts, I was able to erase and program chip, with original program that stopped it from working in first place...Just a quirk of chip I guess.. Solution, If having problems and running under 5 volts, APPLY 5 VOLTS and erase.
Thanks for all the interest and responses.. |
|
|
|