CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC program code gets corrupted/changed

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 24, 2008 11:23 am     Reply with quote

I still have to look at it some more. But I have a basic philosophy
on fixing unknown problems. Everything that you are doing that is
different from the "baseline", should changed so it is same as the
baseline. Examples:

1. You're using a bootloader. Don't use it. Remove the code for it.
I assume you're using surface mount PICs. Can the PICs be
re-programmed with an ICD2 by the ICSP method ? Are the boards
setup for that ? If so, design a version of your code that does not use
the bootloader. Run several boards with it and see if the failure stops.
If so, you have found the basic problem and you can work on it.

2. You're running a resonator. Use a crystal (and capacitors) instead.

3. You're running at 3v. Try running it at 5v instead.

4. You're using a 16F877A. Use the "non-A" version instead.
The "A" version was always more sensitive to power supply noise than
the original non-A version.

5. You're using the "LF" version. When you run it at 5v, you could also
switch to the "non-LF" version.

6. Board layout can be important. If you're using a 2-layer board
without a gridded power and ground layout, then change it to a 4-layer
board, or grid the power and ground. Don't put the PIC's power and
ground pins at the end of a stub trace. Those pins must be right on top
of a main power or ground trace. A "stub" is like a cul-de-sac street.
Avoid stubs. They create a lot of noise on the power and ground pins.

7. You're using a unusual MCLR circuit. Change to a standard circuit.
Quote:
However the failing boards have the circuitry as shown in the link.

The 390K is a mistake. That's too high of an impedance. I would
reduce it to 10K. Get rid of all the other components in the MCLR circuit
and just use the 10K pullup. Do this on all the failing boards and see
if it fixes the problem.


You don't have to do all of these things at once. Maybe just do the last
one, with the MCLR circuit, because I think it might be the best bet.
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Fri Apr 25, 2008 4:03 am     Reply with quote

Hi, thanks for replying.

PCM programmer wrote:
I still have to look at it some more. But I have a basic philosophy on fixing unknown problems. Everything that you are doing that is different from the "baseline", should changed so it is same as the baseline. Examples:


I know, some things are different. The problem is I can't change that much. The board is allready in production.

Quote:

1. You're using a bootloader. Don't use it. Remove the code for it.
I assume you're using surface mount PICs. Can the PICs be
re-programmed with an ICD2 by the ICSP method ? Are the boards
setup for that ? If so, design a version of your code that does not use
the bootloader. Run several boards with it and see if the failure stops.
If so, you have found the basic problem and you can work on it.

I could do that, but the bootloader gives me the advantage to program the PIC processor with having to open the device and plugin the programmer which is very extensive.
It's a good idea to find out whether the bootloader is the cause.

Quote:

2. You're running a resonator. Use a crystal (and capacitors) instead.

I saw you write this alot; why is a X-tal better?

Quote:

3. You're running at 3v. Try running it at 5v instead.

That's impossible with the current design. 3V3 however would be possible. Would that be better?

Quote:

4. You're using a 16F877A. Use the "non-A" version instead.
The "A" version was always more sensitive to power supply noise than
the original non-A version.
5. You're using the "LF" version. When you run it at 5v, you could also
switch to the "non-LF" version.

I'm planning to change the MCU after reading this: http://www.ccsinfo.com/newsdesk_info.php?newsPath=ALL&newsdesk_id=91

Quote:

6. Board layout can be important. If you're using a 2-layer board
without a gridded power and ground layout, then change it to a 4-layer
board, or grid the power and ground. Don't put the PIC's power and
ground pins at the end of a stub trace. Those pins must be right on top
of a main power or ground trace. A "stub" is like a cul-de-sac street.
Avoid stubs. They create a lot of noise on the power and ground pins.

See this topic for more info about board layout. I have 3 boards stacked. http://www.ccsinfo.com/forum/viewtopic.php?t=33300&highlight=
As you can read, I also have random reset problems.

Quote:

7. You're using a unusual MCLR circuit. Change to a standard circuit.
However the failing boards have the circuitry as shown in the link. The 390K is a mistake. That's too high of an impedance. I would
reduce it to 10K. Get rid of all the other components in the MCLR circuit
and just use the 10K pullup. Do this on all the failing boards and see
if it fixes the problem.


I've changed this in the newest revision of the boards:
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group