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

Problem during power-up

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



Joined: 14 Mar 2006
Posts: 45

View user's profile Send private message

Problem during power-up
PostPosted: Fri Jul 15, 2011 4:41 pm     Reply with quote

I have a project that is to be powered from 2) 1.5 cells in a battery holder which has clip-leads. The open and in-circuit output of the battery is >=3v

When using the ICD-U64 starting the project works fine.
When I attempt to disconnect the ICD and power the project only from the battery, the project may or may not start.

Can anyone provide helpful suggestions?

To simplify troubleshooting, I have replaced the project software with the "blink LED" example that is generated by the PIC Wizard.
I am using a x10 scope probe to monitor the toggling signal.

The inconsistent startup problem remains.

I do not have a strong knowledge of the internal oscillator, but I do know need it with a clock speed of 16 mhz. Perhaps I have selected or failed to select fuse options that I need.

I have been considering the idea of starting at a lower clock speed and switching to the 16mhz after proper start-up. But I don't know if this might help or is just a waste of time.

From a hardware standpoint, I have the Vpp, Rx and RB0 pulled to Vcc by 100k resistors; the ICD signals "clock" and "data" are unconnected when the U64 is not in place.

I have PCHW compiler / IDE at rev 4.099
I have a ICD-U64 Product ID 194 Firmware 2.87 PCB rev 2
I have CCSLOAD V 4.018

Code:

#include <18F24K20.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT

//#FUSES BORV22           //Brownout reset at 2.2V
#FUSES NOBROWNOUT               //No brownout reset


#FUSES PUT           //Power Up Timer
#FUSES NOSTVREN                 //Stack full/underflow will not cause reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOPBADEN                 //PORTB pins are configured as digital I/O on RESET
#FUSES NODEBUG          //No Debug mode for ICD
#FUSES NOIESO     //Internal External Switch Over mode disabled
#FUSES MCLR   // Master Clear pin enabled

//#FUSES BROWNOUT               //yes brownout reset

//#FUSES DELAYINTOSC

//#FUSES NODELAYINTOSC   

//#FUSES IESO       //Internal External Switch Over mode enabled

// default

//#FUSES NOFCMEN       //Fail-safe clock monitor disabled
//#FUSES FCMEN         //Fail-safe clock monitor enabled

//#FUSES CCP2B3        //CCP2 input/output multiplexed with RB3
//#FUSES CCP2C1        //CCP2 input/output multiplexed with RC1



//#FUSES NOMCLR   // Master Clear pin used for I/O



#use delay(int=16000000)
#define LED PIN_C6
#define DELAY 10


void main()
{

   setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard

   setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_PLL_OFF);


    //Example blinking LED program
    while(true){
      output_low(LED);
      delay_ms(DELAY);
      output_high(LED);
      delay_ms(DELAY);
    }
}


During my tests, I switch between using the U64 and disconnecting the RJ12 cable at the U64.

I notice that I sometimes have trouble re-establishing communications between the U64 and the target.
Can anyone suggest "proper procedures" for both disconnecting and re-connecting?

Thanks in advance Leef_me
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Sat Jul 16, 2011 2:26 am     Reply with quote

Start by enabling the brownout. Though this is designed to ensure a clean reset from a 'glitch', it'll also help to ensure a clean power up, if your supply line is slow in rising - if you have perhaps too much capacitance on the rail, and rather a lot of resistance in the line.
Then check how far above 3v the battery is?. 3.5v, is the maximum recommended for the chip, and it can go into a lockup state if you go above this.
Consider adding a reset circuit to the MCLR connection. A diode and resistor to hold this low for a moment when the supply is attached. Will have to be disconnected when using the ICD.
Enable STVREN. Though it should never happen, it is better to have the chip cleanly reset if a stack overflow takes place, than to go wandering through code, and generate garbage...

Best Wishes
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