This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

lpc2368 not starting up after reset + UART problem

Hi
I have 2 problems
1.
Hi
I have written a blink LED code using Keil and programmed my core using secondary boot loader
The problem is that my circuit works when I connect it to power, but when I reset the core using reset pin (apply a low), it stops working and does not restart until I disconnect and connect the power again
I have used the start up code that keil adds to the project (lpc2300.s) and a simple code
in (rowley.zendesk.com/.../61610-application-not-starting-up-from-reset-lpc2000) I read it may be caused by "start up after reset" not enabled, but I don't know how to fix that in keil?

2. I use the following code to for transmitting data using TXD2 (P0.10 in lpc2368)
As you see the LED should blink in each executation. But the LED is turned on and never turns off. I think the code is stopped in
while (!(U2LSR & 0x20));
Is my code correct?
I use 12MHz crystal with PLL multiplier of 12, so my Fclk is 36MHz? and I set U2DLL=324
This is the code:

#include <LPC23xx.h>
#define null_ch 0x0D

void init_serial2 (void)
{
  //Enable RxD2 and TxD2  P0.10=tx2, 11=rx2
  PINSEL0 = 0x00500000;
  //8 bits, no Parity, 1 Stop bit ; Enable baud rate change
  U2LCR = 0x83;
  //9600 Baud Rate @ 36MHz VPB Clock
  U2DLL = 0xEA;
  //DLAB = 0
  U2LCR  = 0x03;
}

void delay(long int cycles)
{
  long int i ;
  for(i=0;i<cycles;i++);
}

void putchar2 (unsigned char character)
{
  if (character == '\n')
  {
    //while (!(U2LSR & 0x20));
    //U2THR = null_ch;
  }
  while (!(U2LSR & 0x20));
  U2THR = character;
  //return (U2THR = character);
}

int getchar2 (void)
{
  while (!(U2LSR & 0x01));
  return (U2RBR);
}


int main(void)
{
  static unsigned long int counter;
  //unsigned char toggle;
  SCS |=0x00000001;
  FIO0DIR =0x0401;
  init_serial2();
  while(1)
  {
    counter++;
    delay(1000000);
        FIO0SET = 0x1;

        putchar2(counter);    //Echo terminal
        delay(1000000);
        FIO0CLR=1;// &= 0xFFFFFFFE;
  }
}


Any help would be extremely appreciated