I made several projects using MSP430 chips in the past and had never a startup problem.
Today with a new design of LED light product I struggle to get a normal startup from the CPU. When connected to my IAR development platform no problem, but once the software loaded and under power problems appear. Even the hardware reset button does only work after several minutes of power-up?
My code:
#include "io430.h"
#include "stdint.h"
unsigned long ic=0,stat=0,day_light=0,ic2=0,ic3=0, night_time=43200,t1=0,t2=0,tne=43200;
unsigned int om=0,ii=0,oms=0,imc=5400,tc=0,td=0,om2=0;
//MLX75303 light sense is low output at sensor
int main( void )
{
WDTCTL = WDTPW + WDTHOLD;
IFG1 &= ~OFIFG;
while (BCSCTL3 & LFXT1OF)
BCSCTL3 = LFXT1S_2;
P1REN=0x1B;
P1DIR |= 0x80; // Set output direction
BCSCTL3|=LFXT1S_2;
TACTL=MC_2|ID_1|TASSEL_0;
P1OUT=0x00;
t1=night_time;
TACCR0=47300; // MEASURED FOR 333 msec.
TACCTL0=CCIE;
TACTL=MC_1|ID_3|TASSEL_2|TACLR;
ii=P1IN;
om=(((ii&0x04)>>2)|((ii&0x20)>>4)); // read operation mode
// om: operating mode
// 0: always ON when voltage applied
// 1: ON when darkness is sensed
// 2: ON 4 hours after sunset and 4 hours before sunrise
// 3: always ON when voltage applied
CACTL1=CAREF0|CAREF1|CAON;
CACTL2=P2CA3|P2CA2;
ii=(CAOUT&CACTL2);
if(om==3 || om==0)
{
P1OUT=0x80;
}
else
{
__enable_interrupt();
}
for (;;)
{
__low_power_mode_0();
}