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

LPC 2138 code is not executing

Hello;
I have one problem in LPC2138 Proto-Type board . I am able to write a code in its flash memory
using flash magic. Hex file is successfully loaded . but after Resetting or in power on mode code is not executed . I used 12 Mhz crystal . I tried LED blinking code.

  • Was it a precompiled program for a specific development board?

    What differs between your board, and the development board this blinky application was originally written for?

    Have you tested if it makes a difference if you run the program with external oscillator (your 12MHz crystal) or the internal RC oscillator?

    How do you know that your board can spin up the crystal? And does it resonate at 12MHz, or (maybe because it is incorrectly selected for the task or used with the wrong burden capacitors) might it oscillate at an overtone resulting in serious overclocking of your processor?

    Do you have any JTAG interface so you can debug?

    Do you have any other board you can test with?

    Any parts of the program you can simplify?

    Have you tested to play with GPIO pins in different parts of the startup file to see if any part of your code runs?

  • Hello sir,
    I am using ISP mode (UART 0 - RS232)for programming & External oscillator(12 MHZ ).
    I used flash magic for loading HEX file & it's successfully loaded. but after loading HEX file program is not executed .I check reset circuit it's properly working when reset switch is press reset pin make low(0).I include startup file in my LED Blinking project.
    I don't have any JTAG Interface. But my code working properly in Proteus .I don't know what actual issue is there any RESET PROBLEM or Crystal PROBLEM .& one thing is that sometimes when i touch the crystal XTAL 1(pin-62) pin using voltmeter probe(voltmeter in continuity or dc volt mode) LED start blinking or some time LED continuously ON .

    Hear my code- LED BLINKING
    #include <lpc213x.h>

    void delay(unsigned long val);
    int main(void)
    { IO1DIR = 0xFFFFFFFF; // Configure all pins on Port 0 as Output

    while(1) { IO1SET = 0xFFFFFFFF; // Turn on LEDs delay(5000000);

    IO1CLR = 0xFFFFFFFF; // Turn them off delay(5000000); } // return 0; // normally this wont execute
    }

    void delay(unsigned long val)
    { while(val>0) { val--; }
    }

    Thank you.

  • The capacitive load from the multimeter might make the crystal oscillator fail to operate. But it might also get an oscillator that doesn't run correctly to start generate the expected 12MHz.

    Best is to have access to an RF analyzer that can listen to the oscillator without electrical connection. Second best is probably a scope probe in 10:1 mode, after you have calibrated the capacitance using the test output of the oscilloscope.

    But notice that it makes a lot of difference which of the two crystal pins you look at. One oscillator on the processor is input and one is output. It's way better to probe the output pin that drives the crystal.

    I think NXP names the input pin XTAL1 and the output pin XTAL2 for your processor. That's at least the naming they have for a number of newer chips.

    But did you test to modify the code to run the RC oscillator instead? Just to figure out if your troubles are related to the crystal frequency and stability?