View previous topic :: View next topic |
Author |
Message |
jbwiden
Joined: 26 Mar 2010 Posts: 5
|
odd behavior when reapplying power |
Posted: Fri Mar 26, 2010 3:21 pm |
|
|
If I program my MCU and unplug it from the ICD-U40 it runs as expected. If I then take away power from the MCU and reapply power it does not run as expected. I am using the internal RC oscillator.
Any ideas as to what could be the issue? Or things to test. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 26, 2010 3:38 pm |
|
|
Are you programming it in Debug mode or Standalone mode ?
ie., for use with the hardware debugger, or running without any
debugger attached. Which way are you programming it ?
And, which mode do you want it to be in for your test ?
What is your PIC ? What is your compiler version ?
Post a very small, but compilable, LED blinking program that shows
the problem. Don't include any unnecessary Wizard code in the
program (such as code that disables Timers that are already disabled
upon power-up anyway). The program should have the #include,
#fuses, #use delay(), and main(). |
|
|
jbwiden
Joined: 26 Mar 2010 Posts: 5
|
|
Posted: Fri Mar 26, 2010 3:59 pm |
|
|
I am simply using the "writing code to chip" option in the ccs device programmer program. No debugger.
I am programming via B6,B7 and the reset line
PIC16lf1936
4.103
LED test program coming up. |
|
|
jbwiden
Joined: 26 Mar 2010 Posts: 5
|
|
Posted: Fri Mar 26, 2010 4:29 pm |
|
|
well my very simple test program works after reapplying power...
I guess I should look at some of the code the Wizard puts in on the other program which is having the problems.
Code: |
#include <16LF1936.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES MCLR //Master Clear pin enabled
#FUSES NOCPD //No EE protection
#FUSES NOBROWNOUT //No brownout reset
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES WDT_SW
#FUSES NOCLKOUT
#FUSES NOWRT //Program memory not write protected
//#FUSES PLL
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES BORV19
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG //No Debug mode for ICD
#use delay(clock=32M, internal=8M)
void main()
{
//setup ports on MCU
output_high(PIN_C5);
//output_float(PIN_C1);
output_high(PIN_C1);
//output_float(PIN_C0);
output_low(PIN_C0);
while(1)
{
delay_ms(2);
output_high(PIN_B5);
delay_ms(1);
output_low(PIN_B5);
}
}
|
|
|
|
jbwiden
Joined: 26 Mar 2010 Posts: 5
|
|
Posted: Fri Mar 26, 2010 4:41 pm |
|
|
Running the basic test program on the other hardware setup I have has a different result... The period changes by a factor of 4 .... seems like the PLL may not be getting enabled after reapplying power?
I noticed that the PLL fuse was commented out in the last code posted. I have tried uncommenting that and it still has the behavior mentioned above. |
|
|
jbwiden
Joined: 26 Mar 2010 Posts: 5
|
|
Posted: Wed Apr 14, 2010 4:57 pm |
|
|
The issue was resolved by setting the brownout fuse.
Thanks,
Jbwiden |
|
|
|