LPC1754 crash

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC1754 crash

2,081 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Peter on Wed Nov 28 06:52:49 MST 2012
Hello,

I have some problem with my LPC1754 on my board proto (only one available).
I had a firmware working fine for few weeks, but the microcontroler begins to have crashes.
The board started again after a power OFF/ON. Then I swith on the watchdog, but same again.
And finally the LPC1754 failed in the first second of the power on. Then I was not
able to connect the LPClink probe, I had this message :

15: Target error from Commit Flash write: Et: Flash driver not ready.


I did what is recommended in this case with the ISP bootloader (P2.10) and the "vector catch", and I was able again to connect my probe. The debugger crashed after few lines of code executed.
I have supposed that my function "InitSysTick" was the guilty. When I don't use it, it seems to work.
Then in my InitSysTick I set the main clock from 72MHz to 52MHz (with a 12MHz external crystal), and it seemed to work, but I have sometimes  "HardFault_Handler" and the ADC don't work anymore...
I can't understand why my board worked fine during few weeks, and now has such problems...
I thought for a hardware problem but I have replaced the crystal, the LPC1754 with new ones, and the behaviour is still the same...

If anyone can help me,
thanks.

Here my code for "InitSystick", "InitADC", and my measurement function :

//---------------------------------------------------------------------------
void InitSysTick(void)
//---------------------------------------------------------------------------
{
//-- Reglage PLL0 ---
PLL0CON &= ~BIT1;//--- 1 Disconnect
FEED_SEQUENCE;

PLL0CON &= ~BIT0;//--- 2 Disable
FEED_SEQUENCE;

SCS |= BIT5;//-- Enable quartz oscillator
while (!(SCS&BIT6)) ;//-- Wait Quartz stable

CLKSRCSEL = 1;//--- 4 quartz
FEED_SEQUENCE;

PLL0CFG = 12;//-- 2x(12+1)x12MHz = 312MHz
  //PLL0CFG = 11; //--- Previous Setting for 72MHz
FEED_SEQUENCE;

PLL0CON |= BIT0; //--- 6 Enable
FEED_SEQUENCE;

//-- CPU Divider setting
CCLKCFG  = 5;//-- CPU Clock divider (/(1+div)) : 312/6 = 52MHz
  //CCLKCFG  = 3;//-- Previous Setting for 72MHz

while (!(PLL0STAT&BIT26)) ; //-- Wait for lock PLL0

PLL0CON |= BIT1;//-- Connect
FEED_SEQUENCE;

while ( ((PLL0STAT & (1 << 25)) == 0) );/* Check connect bit status */

//---- reglage Systick ----
STCTRL  = 7;//--- source CCLK, interruption...
STRELOAD = 519999;//--- 10ms si clk=52MHz

}





//---------------------------------------------------------------------------
void InitADC(void)
//---------------------------------------------------------------------------
{
PCONP |= PCADC; //--- ADC power On
AD0CR |= PDN;//--- ADC operational
PCLKSEL0 |= PCLK_ADC_DIV_8;//--- CCLK/8 = 9MHz

//--- Mesure Valim : P1.31, AD0[5] ----
PINSEL3 |= BIT31+BIT30;
PINMODE3 |= BIT31; PINMODE3 &= ~BIT30;//-- no pull-up

//--- Mesure Vpower : P1.30, AD0[4] ----
PINSEL3 |= BIT29+BIT28;
PINMODE3 |= BIT29; PINMODE3 &= ~BIT28;//-- no pull-up
}


//---------------------------------------------------------------------------
unsigned short Mesure (unsigned char voieAnalogique)
//---------------------------------------------------------------------------
{unsigned short result;

#defineV_BATT1
#defineV_POWER2

switch (voieAnalogique){
case V_BATT :
AD0CR |= BIT4;
AD0CR &= ~(BIT7+BIT6+BIT5 + BIT3+BIT2+BIT1+BIT0);
break;
case V_POWER :
AD0CR |= BIT5;
AD0CR &= ~(BIT7+BIT6 + BIT4+BIT3+BIT2+BIT1+BIT0);
break;
}

AD0CR |= START_ADC_NOW;

compteur10ms.timeOutMesure =_130ms; //-- decremented in systick interrupt 

while  ( (compteur10ms.timeOutMesure!=0) && ((AD0GDR & ADC_DONE)==0) ) ;

result = (AD0GDR & MASK_RESULT) >> 4;
return result;
}

0 项奖励
回复
6 回复数

2,058 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Peter on Sat Dec 01 13:07:48 MST 2012
Hi,

It works again !

Although I had already replaced my LPC1754, the behaviour was still the same. I couldn't understand why. So I had still in my stock a LPC1752 and decided to replace again the MCU. And now it works...

I have had 2 failed MCU, strange... I don't think that my Vbat and Vpower are agressives, these are from a 12V battery, and the resistors of the voltage dividors seems, for me, good enough protection.

I hope now that it is going to work without failure.

Thank you to those who tried to help me.

Peter
0 项奖励
回复

2,058 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by frame on Fri Nov 30 03:47:22 MST 2012
It might be possible that a MCU is dying a slow death, with gradual breakdown
of functionality. But this is rather unlikely IMHO.


Quote:
Are there any spikes on Vpower or Valim?

That sounds more plausible.
Not sure where this voltages originate from.
But my company had some trouble a few month ago, because transient surges
from the mains supply destroyed devices in a random manner.
This transients most often come from switching large inductive loads, i.e. motors.

When interfacing to higher voltage, I usually add a zener diode and a small cap
to the R divider network.
0 项奖励
回复

2,058 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Thu Nov 29 04:27:51 MST 2012
Are there any spikes on Vpower or Valim?
It look like the MCU is, like Frame said, in gracefull-degradation.
0 项奖励
回复

2,058 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Peter on Thu Nov 29 01:27:19 MST 2012
Thank you for your replies.

The crystal has already been replaced for the same result.
At the oscilloscope the power supply is very clean and stable.

Here attached is a partial view of my hardware.
My Vpower and Valim are around 12V.
0 项奖励
回复

2,058 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by frame on Thu Nov 29 00:39:07 MST 2012
If your design includes a quartz oscillator, this one might be the source of the trouble.
Possibly he had to take a hard hit, and is now in graceful-degradation mode.
If everything works with LS[B]I[/B], I would try to replace it.

A next candidate would be an overloaded electrolytic cap. Especially cheap ones with high ESR
getting really hot with repeated pulsing. I would at least watch the power sypply (3.3V) at the uC during operation.
0 项奖励
回复

2,058 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Wed Nov 28 17:06:56 MST 2012
I think showing us your hardware design and especialy what's connected (and how) to the ADC could help us solve your mistery
0 项奖励
回复