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

ARM:blink led flashing problem/hardware failure??

hi

i'm testing my first project using all in 1 development board eedt6.00 Keiluvision4 and flashmagic.
i use the sample source code:

#include <lpc21xx.h>

void wait (void)  {                                        /* wait function */
  long  d;
  for (d = 0; d < 10000; d++);                             /* only to delay for LED flashes */
}
int main (void)
 {
  unsigned int i;                                          /* LED var */
  IODIR1 = 0x00FF0000;                                     /* P1.16..23 defined as Outputs */
  while (1)
  {                                                        /* Loop forever */
    for (i = 1<<16; i < 1<<23; i <<= 1) {                  /* Blink LED 0,1,2,3,4,5,6 */
      IOSET1 = i;                                          /* Turn on LED */
      wait ();                                             /* call wait function */
      IOCLR1 = i;                                          /* Turn off LED */
    }
    for (i = 1<<23; i > 1<<16; i >>=1 ) {                  /* Blink LED 7,6,5,4,3,2,1 */
      IOSET1 = i;                                          /* Turn on LED */
      wait ();                                             /* call wait function */
      IOCLR1 = i;                                          /* Turn off LED */
    }
  }
}

debugging running with succes i see in the pheripals block 1 the io ports being swithched on and off
then i'm creating the hex file i get 0 errors and 0 warnings
in flashmagic i select the correct hex file and start the programming with verrification.
no problems, green and red led blinking. after that flashmagic says finished.
When connecting the 8 pins to the led's i get nothing. after messuring the io ports are 2.2 vdc stationairy. other io port for example port 1.31 reads 3.3 volt ???.

so program run correct in debugging mode, flashing seems all right, on the board led D1 is blinking D12 D16 D17 are lit.

thanks in advance
Thomas Crow

Parents
  • Your code is very hard to read, since you forgot the "pre" tags (note about how to post source code directly above the message input box).

    Are you sure that your delay function gives a reasonable delay, so the port pins isn't changing state too fast for you to see any blink, and too fast for the multimeter to see anything but an average value?

    One way to test.

    Do one set of code that only do IOSET1 and test running it.
    Do one set of code that only do IOCLR1 and test running it.

    Without any blink code anymore, one app should result in the LEDs being all on, and one app should have them all off. If that works, then the goal must be to figure out if you have a decent delay between the on and off lines.

    Note that software delays like you are using have big problems - it's up to the compiler and code generation to decide how long the delay takes. The compiler may even optimize away the delay loop if it hasn't any side effect. The processor have lots of hardware that may be used for measuring time.

    Another thing - there is no need to create new threads just to repost the source code formatted. It's enough to just add one more post to the existing thread. What do you think happens when Google picks up the other thread? How will a reader then know that you have moved on to a new thread?

Reply
  • Your code is very hard to read, since you forgot the "pre" tags (note about how to post source code directly above the message input box).

    Are you sure that your delay function gives a reasonable delay, so the port pins isn't changing state too fast for you to see any blink, and too fast for the multimeter to see anything but an average value?

    One way to test.

    Do one set of code that only do IOSET1 and test running it.
    Do one set of code that only do IOCLR1 and test running it.

    Without any blink code anymore, one app should result in the LEDs being all on, and one app should have them all off. If that works, then the goal must be to figure out if you have a decent delay between the on and off lines.

    Note that software delays like you are using have big problems - it's up to the compiler and code generation to decide how long the delay takes. The compiler may even optimize away the delay loop if it hasn't any side effect. The processor have lots of hardware that may be used for measuring time.

    Another thing - there is no need to create new threads just to repost the source code formatted. It's enough to just add one more post to the existing thread. What do you think happens when Google picks up the other thread? How will a reader then know that you have moved on to a new thread?

Children