View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
My PIC goes crazy aka It's alive! |
Posted: Fri Mar 02, 2012 8:41 am |
|
|
Hi, I'm working on a PIC18F67J50 QFP-44 and the program was working Ok until yesterday when I connect the IC3 to the PC, then recompile and load the program into the PIC Flash memory in order to debug the program; when hit the run button on MPLAB-IDE disaster!, the PIC start to do things that I program but not in the right order.
So I open the disassembling list windows and start to run the code step by step in asm, surprisingly, the PIC, start to do strange things like load data from RAM in a wrong way.
I.E. if the instruction is MOVFW X1 and X1=5 W loads a 4 instead of 5. I check the BSR and its ok, so is no way that can be reading another RAM register.
Also jumps when is no jump instruction at all.
The last thing I do before the PIC goes crazy is test part of the code which put the PIC in low power mode, Can this corrupt in any way the chip die?
I'm not using the self write property to load data into flash memory from code, so I think can't be corrupted by the code. _________________ Electric Blue |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9171 Location: Greensville,Ontario
|
|
Posted: Fri Mar 02, 2012 8:58 am |
|
|
I'll assume you've tried a couple different PICs as well as gone back to a known working version of your code.....
low humidity in the room ?
bad ground connections ?
flakey PC ?
Have you powered down everything(PC,pgmer,etc) and started 'fresh' ?
tried running a 'blinking LED' program ? |
|
![](templates/subSilver/images/spacer.gif) |
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Fri Mar 02, 2012 9:15 am |
|
|
You don't say just what the board configuration is (where power comes from etc), but I would start by disconnecting from the PC and see if it acts "normal" I have seen loops where the ground of a PC and the ground of a supply for the board were not the same with some "interesting" results. Another thing to check would be for floating control pins (mclr etc). Floating pins can cause some of the strangest things to happen.
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
![](templates/subSilver/images/spacer.gif) |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Mar 02, 2012 9:15 am |
|
|
temtronic wrote: | I'll assume you've tried a couple different PICs as well as gone back to a known working version of your code..... |
Yes, I did that.
temtronic wrote: |
low humidity in the room ?
|
Yes, the air conditioner was in dehumidifier mode.
temtronic wrote: | bad ground connections ? |
The PCB have 4 layers and all with ground plane.
temtronic wrote: | flakey PC ? |
i don't know what "flakey" means.
temtronic wrote: | Have you powered down everything(PC,pgmer,etc) and started 'fresh' ? |
I close MLAB IDE, physically disconnect ICD3 from USB and take the power off the PCB.
temtronic wrote: | tried running a 'blinking LED' program ? |
Not yet, now I'm testing a similar board with the same code, but I dont' reach the part of the code which put the PIC in low power mode.
I don't know if is important but the PIC have two clocks, a low power 32768Khz on TMR1 OSC and 8MHz on the main OSC running with PLL at 48MHz. _________________ Electric Blue |
|
![](templates/subSilver/images/spacer.gif) |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Mar 02, 2012 9:22 am |
|
|
gpsmikey wrote: | You don't say just what the board configuration is (where power comes from etc) |
It's running with 3.3V LPO regulator and the integrated VREG is enabled.
Figure 25-2 from 39775c PDF
Regulator Enabled (ENVREG tied to VDD)
gpsmikey wrote: |
but I would start by disconnecting from the PC and see if it acts "normal" I have seen loops where the ground of a PC and the ground of a supply for the board were not the same with some "interesting" results. |
I will try a LED program and then the normal code working alone.
gpsmikey wrote: |
Another thing to check would be for floating control pins (mclr etc). Floating pins can cause some of the strangest things to happen.
mikey |
Mmmm...I will check, maybe I forgot something but the unused pins are output, as I remember. _________________ Electric Blue |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9171 Location: Greensville,Ontario
|
|
Posted: Fri Mar 02, 2012 9:28 am |
|
|
flakey PC....'something' gone wrong that you don't notice....maybe a new application's running,virus,bad memory........
I'll power down a PC just to 'clear out ' and start 'fresh'. A reload of application or 'restart' is NOT the same as a cold boot( power off..wait 3 steamboats...power up.....
yes, it takes a few minutes( excuse to get another coffee..) but if a program is running in the same memory location ( warm boot)...NOTHING has really changed..and one bad bit is all it takes.
if it's dry...static electricity will cause all sorts of 'weird' random problems that you cannot figure out,one reason to have good grounds from PC to project...
and you must get moisture back into the air! |
|
![](templates/subSilver/images/spacer.gif) |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Fri Mar 02, 2012 10:06 am |
|
|
I turn off the PC and now seems to work ok.
I'll go back here after lunch. Thanks. _________________ Electric Blue |
|
![](templates/subSilver/images/spacer.gif) |
|